From fc10d4a354d9e209a8e55f6f619eb43aeb1ffcd7 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Mon, 20 Dec 2021 01:19:35 +0900 Subject: [PATCH] Remove redundant goroutine --- langserver/handler.go | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/langserver/handler.go b/langserver/handler.go index 9a38235..a0dfc72 100644 --- a/langserver/handler.go +++ b/langserver/handler.go @@ -254,25 +254,21 @@ func (h *langHandler) linter() { } for diagURI, diagnostics := range uriToDiagnostics { - copiedDiagnostics := diagnostics - copiedDiagURI := diagURI if diagURI == "file:" { - copiedDiagURI = uri + diagURI = uri } - go func() { - version := 0 - if _, ok := h.files[uri]; ok { - version = h.files[uri].Version - } - h.conn.Notify( - ctx, - "textDocument/publishDiagnostics", - &PublishDiagnosticsParams{ - URI: copiedDiagURI, - Diagnostics: copiedDiagnostics, - Version: version, - }) - }() + version := 0 + if _, ok := h.files[uri]; ok { + version = h.files[uri].Version + } + h.conn.Notify( + ctx, + "textDocument/publishDiagnostics", + &PublishDiagnosticsParams{ + URI: diagURI, + Diagnostics: diagnostics, + Version: version, + }) } }() }