Add textDocument/references and textDocument/implementation to the LSP - #96
Open
trangius wants to merge 3 commits into
Open
Add textDocument/references and textDocument/implementation to the LSP#96trangius wants to merge 3 commits into
trangius wants to merge 3 commits into
Conversation
Example: a project where three programs share code: console/program.jai does #import,file "../repl.jai" 2dgame/program.jai does #import,file "../repl.jai" 3dgame/program.jai does #import,file "../repl.jai" repl.jai then imports the engine module. So the path to engine/foo.jai depends on which program we reached it from: .../console/../engine/foo.jai .../2dgame/../engine/foo.jai .../3dgame/../engine/foo.jai jails stored each as a separate entry in server.files. When the editor opens that same file, its path is just: .../engine/foo.jai That doesn't match any of the three above, so jails creates a fourth entry. That fourth entry isn't reachable from any program root in the load graph, so it has no siblings. Goto-definition, find references, and hover for anything outside the open file silently return nothing. Fix: strip `..` and `.` segments from the path whenever we store or look up a file, so all four end up as the same key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds LSP support for "Find All References" and "Go to Implementation."
Tested manually in Zed via the seg4lt/zed-jai extension.