@@ -306,7 +306,7 @@ proc cancelLspForegroundRequest*(
306
306
if c.isInitialized:
307
307
let fgRes = c.getForegroundWaitingResponse(bufferId)
308
308
if fgRes.isSome:
309
- let err = c.cancelForegroundRequest(bufferId)
309
+ let err = waitFor c.cancelForegroundRequest(bufferId)
310
310
if err.isOk:
311
311
return Result[LspMethod, string ].ok fgRes.get.lspMethod
312
312
else :
@@ -342,15 +342,15 @@ proc lspInitialize*(
342
342
343
343
if not status.lspClients.contains(langId):
344
344
# Init a LSP client and start a LSP server.
345
- var c = initLspClient(
345
+ var c = waitFor initLspClient(
346
346
$ status.settings.lsp.languages[langId].command)
347
347
if c.isErr:
348
348
return Result[(), string ].err c.error
349
349
350
350
status.lspClients[langId] = c.get
351
351
352
352
# Initialize request
353
- let err = status.lspClients[langId].initialize(
353
+ let err = waitFor status.lspClients[langId].initialize(
354
354
status.bufStatus[^ 1 ].id,
355
355
initInitializeParams(
356
356
status.lspClients[langId].serverName,
@@ -446,7 +446,7 @@ proc addNewBuffer*(
446
446
status.settings.lsp.languages.contains(newBufStatus.langId):
447
447
if status.lspClients.contains(newBufStatus.langId):
448
448
# textDocument/didOpen notification
449
- let err = lspClient.textDocumentDidOpen(
449
+ let err = waitFor lspClient.textDocumentDidOpen(
450
450
$ newBufStatus.path.absolutePath,
451
451
newBufStatus.langId,
452
452
newBufStatus.buffer.toString)
@@ -689,15 +689,15 @@ proc sendLspSemanticTokenRequest*(c: var LspClient, b: BufferStatus) =
689
689
690
690
block :
691
691
# Cancel before completion request.
692
- let err = c.cancelRequest(
692
+ let err = waitFor c.cancelRequest(
693
693
b.id,
694
694
LspMethod.textDocumentSemanticTokensFull)
695
695
if err.isErr:
696
696
error fmt" lsp: { err.error} "
697
697
698
698
block :
699
699
# Send a textDocument/semanticTokens request to the LSP server.
700
- let err = c.textDocumentSemanticTokens(b.id, $ b.absolutePath)
700
+ let err = waitFor c.textDocumentSemanticTokens(b.id, $ b.absolutePath)
701
701
if err.isErr:
702
702
error fmt" lsp: { err.error} "
703
703
@@ -710,7 +710,7 @@ proc sendLspInlayHintRequest*(
710
710
711
711
block :
712
712
# Cancel before inlayHint request.
713
- let err = c.cancelRequest(b.id, LspMethod.textDocumentInlayHint)
713
+ let err = waitFor c.cancelRequest(b.id, LspMethod.textDocumentInlayHint)
714
714
if err.isErr: error fmt" lsp: { err.error} "
715
715
716
716
# Calc range from all views.
@@ -731,7 +731,7 @@ proc sendLspInlayHintRequest*(
731
731
if b.buffer[last].high >= 0 : b.buffer[last].high
732
732
else : 0
733
733
734
- let err = c.textDocumentInlayHint(b.id, $ b.absolutePath, hintRange)
734
+ let err = waitFor c.textDocumentInlayHint(b.id, $ b.absolutePath, hintRange)
735
735
if err.isErr: error fmt" lsp: { err.error} "
736
736
737
737
b.inlayHints.range = Range(
@@ -747,7 +747,7 @@ proc sendLspInlineValueRequest*(
747
747
748
748
block :
749
749
# Cancel before inlineValue request.
750
- let err = c.cancelRequest(b.id, LspMethod.textDocumentInlineValue)
750
+ let err = waitFor c.cancelRequest(b.id, LspMethod.textDocumentInlineValue)
751
751
if err.isErr: error fmt" lsp: { err.error} "
752
752
753
753
# Calc range from all views.
@@ -768,7 +768,7 @@ proc sendLspInlineValueRequest*(
768
768
if b.buffer[last].high >= 0 : b.buffer[last].high
769
769
else : 0
770
770
771
- let err = c.textDocumentInlineValue(b.id, $ b.absolutePath, valueRange)
771
+ let err = waitFor c.textDocumentInlineValue(b.id, $ b.absolutePath, valueRange)
772
772
if err.isErr: error fmt" lsp: { err.error} "
773
773
774
774
b.inlineValues.range = Range(
@@ -778,7 +778,7 @@ proc sendLspInlineValueRequest*(
778
778
proc sendLspCodeLens* (c: var LspClient, b: BufferStatus) =
779
779
# # Send textDocument/codeLens requests to the LSP server.
780
780
781
- let err = c.textDocumentCodeLens(b.id, $ b.absolutePath)
781
+ let err = waitFor c.textDocumentCodeLens(b.id, $ b.absolutePath)
782
782
if err.isErr:
783
783
error fmt" lsp: { err.error} "
784
784
@@ -832,7 +832,7 @@ proc updateSyntaxHighlightings(status: EditorStatus) =
832
832
833
833
if isSendDidChange():
834
834
# Send a textDocument/didChange notification to the LSP server.
835
- let err = client.textDocumentDidChange(
835
+ let err = waitFor client.textDocumentDidChange(
836
836
b.version,
837
837
absPath,
838
838
b.buffer.toString)
@@ -1527,7 +1527,7 @@ proc autoSave(status: var EditorStatus) =
1527
1527
1528
1528
if bufStatus.isEditMode and status.lspClients.contains(bufStatus.langId):
1529
1529
# Send textDocument/didSave notify to the LSP server.
1530
- let err = status.lspClients[bufStatus.langId].textDocumentDidSave(
1530
+ let err = waitFor status.lspClients[bufStatus.langId].textDocumentDidSave(
1531
1531
bufStatus.version,
1532
1532
$ bufStatus.path.absolutePath,
1533
1533
$ bufStatus.buffer)
0 commit comments