-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove read file contents request sent to extension by language server (use is file check) #3198
Conversation
} | ||
export const getLocationToOpen = (uri: string): Location => { | ||
const position = Position.create(0, 0) | ||
const range = Range.create(position, position) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[F] Turns out that we can open the file using an empty range (previously this didn't work or I had done the wrong thing to test). This means we don't need the file contents at all (for now). We can simply check whether or not the URI relates to a file. If it does then we can create a location with the URI string and an empty range. Passing this back to the client will open the file. If there are multiple locations (files) then the user will be prompted which one they want to open. That's the reason that we can't just ask the extension to open the file without first returning information to the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have to check whether or not the file is a file on the extension side because the LSP might not be running in a context that can access the file system (e.g Codespaces)
…r (use is file check)
0cc2af3
to
8c6db6f
Compare
Code Climate has analyzed commit 801067b and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 80.9% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.9% (0.0% change). View more on Code Climate. |
This PR removes the need for the language server to request that the extension reads the contents of files. We may need to bring this back in the future but for now we don't need it.
Comments inline.
Closes #2529 (cc @shcheklein)