-
Notifications
You must be signed in to change notification settings - Fork 156
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
fsac crashes when the file is empty #1091
Comments
Can you try with starting FSAC with |
I'm on a different machine this morning, but still tried it and no bueno. What does adaptive do?
|
This doesn't look like an crash though. Just some exceptions for analyzers. While still annoying, it's not crashing.
Newer implementation of the LSP server using F# Data Adaptive to help keep track of dependencies. |
Actually, I just realized that it doesn't crash immediately when the buffer is empty, but after I input something in the buffer. I think this has something to do with the lack of a new line in the buffer. According to POSIX, a text file must end with a newline so an empty buffer like this is not considered a valid text file, but it would still be nice to handle empty buffers. I tried debugging this code-wise yesterday but didn't get very far. Here's a recording of the issue if it helps: fsautocomplete-bug.mov |
OK! Had my first breakthrough, seems FSAC crashes on I patched the FsAutoComplete.Lsp.fs file locally with this and it's not crashing anymore. match change.Range with
| None -> // replace entire content
NamedText(filePath, change.Text)
+ | Some rangeToReplace
+ when rangeToReplace.Start.Character = 0 && rangeToReplace.Start.Line = 0 &&
+ rangeToReplace.End.Character = 0 && rangeToReplace.End.Line = 0 ->
+ NamedText(filePath, change.Text)
| Some rangeToReplace -> I still get some warning messages about positions out of range, most likely from the server's other capabilities though. |
@augustfengd that change makes good sense - if you sent it up in a PR (as well as a parallel change to the same login in AdaptiveFSharpLspServer.fs please!) we'd take it in a heartbeat :) |
Hey! :) I had a look at the |
Hello!
I think there may be an edge case bug when the text file sent to the fsautocomplete is completely empty. The steps to reproduce on Emacs with lsp-mode is:
dotnet new console -lang 'F#'
)Program.fs
C-x h backspace
)The text was updated successfully, but these errors were encountered: