diff --git a/analysis/.depend b/analysis/.depend index 5da702b83..ee38311cc 100644 --- a/analysis/.depend +++ b/analysis/.depend @@ -10,7 +10,7 @@ src/FindFiles.cmx : src/Utils.cmx src/SharedTypes.cmx \ src/Files.cmx src/BuildSystem.cmx src/Hover.cmx : src/Utils.cmx src/SharedTypes.cmx src/Shared.cmx \ src/References.cmx src/ProcessCmt.cmx -src/Infix.cmx : src/Log.cmx src/Files.cmx +src/Infix.cmx : src/Log.cmx src/Log.cmx : src/ModuleResolution.cmx : src/Infix.cmx src/Files.cmx src/NewCompletions.cmx : src/Utils.cmx src/Uri2.cmx src/SharedTypes.cmx \ @@ -33,7 +33,7 @@ src/References.cmx : src/Utils.cmx src/Uri2.cmx src/SharedTypes.cmx \ src/Shared.cmx : src/PrintType.cmx src/Files.cmx src/SharedTypes.cmx : src/Utils.cmx src/Uri2.cmx src/Shared.cmx \ src/Infix.cmx -src/Uri2.cmx : src/Files.cmx +src/Uri2.cmx : src/Utils.cmx : src/Protocol.cmx src/vendor/Json.cmx : src/vendor/res_outcome_printer/res_comment.cmx : \ diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml index 2e477b4c9..021ec267a 100644 --- a/analysis/src/Commands.ml +++ b/analysis/src/Commands.ml @@ -21,7 +21,7 @@ let dump files = Shared.cacheTypeToString := true; files |> List.iter (fun path -> - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in let result = match ProcessCmt.getFullFromCmt ~uri with | None -> "[]" @@ -30,7 +30,7 @@ let dump files = print_endline result) let completion ~path ~line ~col ~currentFile = - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in let result = match ProcessCmt.getFullFromCmt ~uri with | None -> "[]" @@ -43,7 +43,7 @@ let completion ~path ~line ~col ~currentFile = print_endline result let hover ~path ~line ~col = - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in let result = match ProcessCmt.getFullFromCmt ~uri with | None -> Protocol.null @@ -79,7 +79,7 @@ let hover ~path ~line ~col = print_endline result let definition ~path ~line ~col = - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in let result = match ProcessCmt.getFullFromCmt ~uri with | None -> Protocol.null @@ -114,7 +114,7 @@ let definition ~path ~line ~col = print_endline result let references ~path ~line ~col = - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in let result = match ProcessCmt.getFullFromCmt ~uri with | None -> Protocol.null @@ -143,7 +143,7 @@ let references ~path ~line ~col = print_endline result let documentSymbol ~path = - let uri = Uri2.fromLocalPath path in + let uri = Uri2.fromPath path in match ProcessCmt.getFullFromCmt ~uri with | None -> print_endline Protocol.null | Some {file} -> diff --git a/analysis/src/Files.ml b/analysis/src/Files.ml index 3372c4eef..03f6bfd6c 100644 --- a/analysis/src/Files.ml +++ b/analysis/src/Files.ml @@ -97,17 +97,3 @@ let rec collect ?(checkDir = fun _ -> true) path test = |> List.concat else [] | _ -> if test path then [path] else [] - -let fileConcat a b = - if - b <> "" - && b.[0] = '.' - && String.length b >= 2 - && b.[1] = Filename.dir_sep.[0] - then Filename.concat a (String.sub b 2 (String.length b - 2)) - else Filename.concat a b - -let isFullPath b = - b.[0] = '/' || (Sys.win32 && String.length b > 1 && b.[1] = ':') - -let maybeConcat a b = if b <> "" && isFullPath b then b else fileConcat a b diff --git a/analysis/src/FindFiles.ml b/analysis/src/FindFiles.ml index 0d0a3a20c..5f58af993 100644 --- a/analysis/src/FindFiles.ml +++ b/analysis/src/FindFiles.ml @@ -117,7 +117,7 @@ let collectFiles directory = let findProjectFiles ~debug namespace root sourceDirectories compiledBase = let files = sourceDirectories - |> List.map (Files.fileConcat root) + |> List.map (Filename.concat root) |> ifDebug debug "Source directories" (String.concat " - ") |> List.map (fun name -> Files.collect name isSourceFile) |> List.concat |> Utils.dedup @@ -248,7 +248,7 @@ let findDependencyFiles ~debug base config = | Some compiledBase -> if debug then Log.log ("Compiled base: " ^ compiledBase); let compiledDirectories = - directories |> List.map (Files.fileConcat compiledBase) + directories |> List.map (Filename.concat compiledBase) in let compiledDirectories = match namespace with diff --git a/analysis/src/Infix.ml b/analysis/src/Infix.ml index 610161ff4..e8678c65d 100644 --- a/analysis/src/Infix.ml +++ b/analysis/src/Infix.ml @@ -27,4 +27,4 @@ let logIfAbsent message x = None | _ -> x -let ( /+ ) = Files.fileConcat +let ( /+ ) = Filename.concat diff --git a/analysis/src/Uri2.ml b/analysis/src/Uri2.ml index 437632a99..a37efa70a 100644 --- a/analysis/src/Uri2.ml +++ b/analysis/src/Uri2.ml @@ -1,8 +1,6 @@ module Uri : sig type t - val fromLocalPath : string -> t - val fromPath : string -> t val isInterface : t -> bool @@ -28,10 +26,6 @@ end = struct let fromPath path = {path; uri = pathToUri path} - let fromLocalPath localPath = - let path = Files.maybeConcat (Unix.getcwd ()) localPath in - fromPath path - let isInterface {path} = Filename.check_suffix path "i" let toPath {path} = path