Closed aabounegm closed 11 months ago
If you look at the message logs, is your client telling the server about those files? https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_synchronization
The VFS reflects what the client tells it the state of files is, and nothing else.
You are right, thank you! I didn't add syncOptions
before (I didn't understand what it's for), but after adding it the handler now works properly. Such a silly overlook on my behalf 😅, I will close the issue now.
For future reference, can you point me to any tutorial or good documentation for implementing an LSP server with this package specifically (most of the tutorials out there are for Node.js), preferably somewhat beginner-friendly?
Sorry, I don't know of any tutorials for using this library. You could look at some of the projects using it: HLS (very complex), static-ls (https://github.com/josephsumabat/static-ls), dhall (https://github.com/dhall-lang/dhall-haskell).
I'm trying to implement a language server with the latest versions of this package (
lsp-2.1.0.0
andlsp-types-2.0.1.0
), but I can't seem to be able to get the content of any file to analyze it. I followed the Reactor example (theSMethod_TextDocumentDidChange
handler in particular), butgetVirtualFile
returnsNothing
. My handler looks like so:but it always sends the error notification:![image](https://github.com/haskell/lsp/assets/11016151/cae3851f-3a12-4519-958b-8eb50864cab6)
I tested on Windows 11 and macOS, but no difference.
Full (but minimal) code can be found here. The hover handler works correctly, so I'm sure the server is running and communicates with the extension properly. For reference, the extension code can be found here.