ionide / Ionide-vim

F# Vim plugin based on FsAutoComplete and LSP protocol
MIT License
178 stars 21 forks source link

error shown on every keystroke when file is not included in project #86

Open joprice opened 4 months ago

joprice commented 4 months ago

Describe the bug

When the LSP has trouble loading a file, for instance when it's not included in one of the discovered projects, an error is shown on every keystroke. Ideally, this would only happen once on initialization, as it makes it difficult to interact with the file or even to exit vim, since even dismissing the error with the escape key will cause it to retrigger.

And example error, where SOME_FILENAME is the fully qualified path:

ionide: -32603: [SOME_FILENAME] in LoadedProjects. Have the projects loaded yet
 or have you tried restoring your project/solution?

I'm hitting this currently while trying out Myriad code generation, which has the more specific problem of the original MyriadFile not being found by fsautocomplete.

To Reproduce

Open a file not included in an fsproj.

Expected behaviour

The error should be shown a single time on initialization to avoid interrupting workflows that are in an intermediate state (adding a new file to a project) or are not currently supported by fsautocomplete for whatever reason (such as the Myriad situation mentioned above).

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

joprice commented 4 months ago

For the myriad issue I mentioned, I had things misconfigured so don't have a persistent problem with the file not being part of the project, but still curious about whether the error could be made less jarring when trying to add new files or a project is in a temporary broken state.

cannorin commented 3 months ago

I think this is difficult to address since it is very natural for Neovim's LSP client to display an error whenever the LSP server reports it. I would have to add a hook to ignore a certain kind of LSP server error (Have the projects loaded yet in this case), which I haven't figured out how.