Skip to content

Commit

Permalink
Remove redundant goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
Matts966 committed Dec 19, 2021
1 parent 58eca46 commit fc10d4a
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions langserver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
}()
}
Expand Down

0 comments on commit fc10d4a

Please sign in to comment.