Skip to content

Commit

Permalink
Only send lsp status updates when the lsp status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgomez committed Nov 26, 2024
1 parent 3ad3c9b commit 44280c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ls.nim
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type
outStream*: FileStream
stdinContext*: ptr ReadStdinContext
projectErrors*: seq[ProjectError]
lastStatusSent: JsonNode
#List of errors (crashes) nimsuggest has had since the lsp session started

Certainty* = enum
Expand Down Expand Up @@ -362,9 +363,11 @@ proc getLspStatus*(ls: LanguageServer): NimLangServerStatus {.raises: [].} =
result.projectErrors = ls.projectErrors

proc sendStatusChanged*(ls: LanguageServer) {.raises: [].} =
let status: NimLangServerStatus = ls.getLspStatus()
ls.notify("extension/statusUpdate", %*status)

let status = %*ls.getLspStatus()
if status != ls.lastStatusSent:
ls.notify("extension/statusUpdate", status)
ls.lastStatusSent = status

proc addProjectFileToPendingRequest*(
ls: LanguageServer, id: uint, uri: string
) {.async.} =
Expand Down

0 comments on commit 44280c0

Please sign in to comment.