diff --git a/source/code_navigation_server/requestHandler.ml b/source/code_navigation_server/requestHandler.ml index 4841d14495e..54c84bf8ff2 100644 --- a/source/code_navigation_server/requestHandler.ml +++ b/source/code_navigation_server/requestHandler.ml @@ -46,8 +46,9 @@ let get_modules ~module_tracker ~build_system path = ~module_tracker ~lookup_artifact:(BuildSystem.lookup_artifact build_system) with + (* In case there's no build system artifacts for this source, lookup the module as if it's built + by a no-op build system (using normal source path mapping) *) | [] -> - (* Lookup the module as if it's built by a no-op build system *) Server.PathLookup.modules_of_source_path source_path ~module_tracker diff --git a/source/code_navigation_server/test/buildSystemTest.ml b/source/code_navigation_server/test/buildSystemTest.ml index e3e749c4500..a6257ba6d21 100644 --- a/source/code_navigation_server/test/buildSystemTest.ml +++ b/source/code_navigation_server/test/buildSystemTest.ml @@ -250,6 +250,7 @@ let test_build_system_path_lookup context = let root = ScratchProject.source_root_of project in let path_a = PyrePath.create_relative ~root ~relative:"a.py" |> PyrePath.absolute in let path_b = PyrePath.create_relative ~root ~relative:"b.py" |> PyrePath.absolute in + let path_c = PyrePath.create_relative ~root ~relative:"c.py" |> PyrePath.absolute in let expected_error = Analysis.AnalysisError.Instantiated.of_yojson (`Assoc @@ -290,8 +291,7 @@ let test_build_system_path_lookup context = Query (Query.LocationOfDefinition { path = path_a; client_id; position = position 2 12 })) ~kind:"FileNotOpened"; - (* Try open both `a.py` (no artifact path), `b.py` (artifact path), and `c.py` - (nonexistent) *) + (* Try open `a.py` (no artifact path), `b.py` (artifact path), and `c.py` (nonexistent) *) ScratchProject.ClientConnection.assert_response ~request: Request.(Command (Command.FileOpened { path = path_a; content = None; client_id })) @@ -302,14 +302,7 @@ let test_build_system_path_lookup context = ~expected:Response.Ok; ScratchProject.ClientConnection.assert_error_response ~request: - Request.( - Command - (Command.FileOpened - { - path = PyrePath.create_relative ~root ~relative:"c.py" |> PyrePath.absolute; - content = None; - client_id; - })) + Request.(Command (Command.FileOpened { path = path_c; content = None; client_id })) ~kind:"ModuleNotTracked"; (* Server should be aware of `b.py` on type error query *) ScratchProject.ClientConnection.assert_response