Skip to content

Add lsp-flush-delayed-changes-before-next-message option #4512

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

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Added a new optional ~:action-filter~ argument when defining LSP clients that allows code action requests to be modified before they are sent to the server. This is used by the Haskell language server client to work around an ~lsp-mode~ parsing quirk that incorrectly sends ~null~ values instead of ~false~ in code action requests.
* Add support for C# via the [[https://github.com/dotnet/roslyn/tree/main/src/LanguageServer][Roslyn language server]].
* Add basic support for [[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics][pull diagnostics]] requests.
* Add ~lsp-flush-delayed-changes-before-next-message~ customization point to enforce throttling document change notifications.

** 9.0.0
* Add language server config for QML (Qt Modeling Language) using qmlls.
Expand Down
17 changes: 14 additions & 3 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6743,13 +6743,24 @@ textDocument/didOpen for the new file."

(advice-add 'set-visited-file-name :around #'lsp--on-set-visited-file-name)

(defvar lsp--flushing-delayed-changes nil)
(defcustom lsp-flush-delayed-changes-before-next-message t
"If non-nil send the document changes update before sending other messages.

If nil, and `lsp-debounce-full-sync-notifications' is non-nil,
change notifications will be throttled by
`lsp-debounce-full-sync-notifications-interval' regardless of
other messages."
:group 'lsp-mode
:type 'boolean)

(defvar lsp--not-flushing-delayed-changes t)

(defun lsp--send-no-wait (message proc)
"Send MESSAGE to PROC without waiting for further output."

(unless lsp--flushing-delayed-changes
(let ((lsp--flushing-delayed-changes t))
(when (and lsp--not-flushing-delayed-changes
lsp-flush-delayed-changes-before-next-message)
(let ((lsp--not-flushing-delayed-changes nil))
(lsp--flush-delayed-changes)))
(lsp-process-send proc message))

Expand Down
Loading