-
Notifications
You must be signed in to change notification settings - Fork 256
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
Do not kill LSP server process when exception occurs in doc change handler, and prevent out of range exception #2664
Do not kill LSP server process when exception occurs in doc change handler, and prevent out of range exception #2664
Conversation
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.
Just minor updates
message = "Related location (could not read file " + fileName + ")"; | ||
} | ||
var content = File.ReadAllText(fileName); | ||
message = FormatRelated(content.Substring(range.StartToken.pos, rangeLength)); |
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.
I guess trading the previously optimized code for this simple but costly one is worth the fact that we don't need to deal with encodings. That's fair.
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.
I think all included files should be loaded into memory and available through some in memory filesystem, so then there wouldn't be any file read here. The file read here seems like it might significantly effect performance, but at least it's better than the crash.
Co-authored-by: Mikaël Mayer <MikaelMayer@users.noreply.github.com>
Co-authored-by: Mikaël Mayer <MikaelMayer@users.noreply.github.com>
…into textFromOtherFile
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.
This looks good to me. It has the further advantage that it'll properly respect the encoding of the file (assuming that the token position and length do) rather than using byte offsets.
3be43de
Changes
Testing
Manual testing with VSCode
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.