Skip to content

Commit 8be8579

Browse files
committed
Add missing deferred handlePanic function calls
Including a deferred handlePanic function call in the missed goroutines will help us identify and track down errors in the wild. Signed-off-by: Remy Suen <[email protected]>
1 parent 97f1ac2 commit 8be8579

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

internal/pkg/server/didChangeConfiguration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func (s *Server) WorkspaceDidChangeConfiguration(ctx *glsp.Context, params *prot
1818
scopes := configuration.Documents()
1919
if len(scopes) > 0 {
2020
go func() {
21+
defer s.handlePanic("WorkspaceDidChangeConfiguration")
22+
2123
s.FetchConfigurations(scopes)
2224
s.recomputeDiagnostics()
2325
}()

internal/pkg/server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ func (s *Server) updateTelemetrySetting(value string) {
247247
// rather than doing it globally.
248248
func (s *Server) registerFormattingCapability() {
249249
go func() {
250+
defer s.handlePanic("registerFormattingCapability")
251+
250252
time.Sleep(registerCapabilityDelay)
251253
dockerbakeLanguage := string(protocol.DockerBakeLanguage)
252254
dockerbakeDocumentSelctor := protocol.DocumentSelector{protocol.DocumentFilter{Language: &dockerbakeLanguage}}

internal/pkg/server/text_document_sync.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
func (s *Server) TextDocumentDidOpen(ctx *glsp.Context, params *protocol.DidOpenTextDocumentParams) error {
1717
_, _ = s.docs.Write(ctx.Context, uri.URI(params.TextDocument.URI), params.TextDocument.LanguageID, params.TextDocument.Version, []byte(params.TextDocument.Text))
1818
go func() {
19+
defer s.handlePanic("TextDocumentDidOpen")
20+
1921
s.FetchConfigurations([]protocol.DocumentUri{params.TextDocument.URI})
2022
_ = s.computeDiagnostics(ctx.Context, params.TextDocument.URI, params.TextDocument.Text, params.TextDocument.Version)
2123
}()

0 commit comments

Comments
 (0)