Skip to content

Conversation

@mrossinek
Copy link

The README states that "Diagnostics are only updated when files are
saved or opened/closed". However, I noticed that during my usage of
fortls with Neovim through the builtin LSP implementation, saving a file
did not cause the diagnostics to update.

After digging into Neovim's code I noticed that it never sent out any
textDocument/didSave notifications to the client. Initially I thought
this was a bug on their end until I noticed that the reason why Neovim
didn't send those notifications was because the server (fortls) did not
provide the corresponding server capability. Instead, it only provided
an integer indicating the textDocumentSyncKind for the change
notifications.

Looking into the specification of the LSP here 1 I noticed that the
server should/can actually provide a more detailed description of its
capabilities. This commit, does exactly that.

Notice the final structure of the TextDocumentSyncOptions at the end
of the linked paragraph.

The README states that "Diagnostics are only updated when files are
saved or opened/closed". However, I noticed that during my usage of
fortls with Neovim through the builtin LSP implementation, saving a file
did not cause the diagnostics to update.

After digging into Neovim's code I noticed that it never sent out any
`textDocument/didSave` notifications to the client. Initially I thought
this was a bug on their end until I noticed that the reason why Neovim
didn't send those notifications was because the server (fortls) did not
provide the corresponding server capability. Instead, it only provided
an integer indicating the `textDocumentSyncKind` for the `change`
notifications.

Looking into the specification of the LSP here [1] I noticed that the
server should/can actually provide a more detailed description of its
capabilities. This commit, does exactly that.

[1]: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_didClose
Notice the final structure of the `TextDocumentSyncOptions` at the end
of the linked paragraph.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant