Skip to content

Commit

Permalink
fix(lsp): Request document sync on open/close
Browse files Browse the repository at this point in the history
Without sending `open_close: true` to the client, it may not issue an `textDocument/didOpen` event with document text to allow the diagnostics and text cache to be initialized after opening, but prior to editing, the document.  Format requests also emit "Format request arrived before text synchronized" in this state.  The didClose event probably also doesn't arrive to see cache entries removed.

Observed in neovim 0.8.3 using internal client, while vim with prabirshrestha/vim-lsp sends the event regardless (but does not currently issue didClose).
  • Loading branch information
merrilymeredith committed Mar 5, 2023
1 parent a8bd8a4 commit bb2c61b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def for(name)
diagnostic_provider: true,
execute_command_provider: true,
text_document_sync: Proto::Interface::TextDocumentSyncOptions.new(
change: Proto::Constant::TextDocumentSyncKind::FULL
change: Proto::Constant::TextDocumentSyncKind::FULL,
open_close: true
)
)
))
Expand Down

0 comments on commit bb2c61b

Please sign in to comment.