Skip to content

Commit e86003c

Browse files
committed
fixed didOpen error return
1 parent 5902ba6 commit e86003c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Diff for: handler/handler.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,17 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
149149
inoURI = p.TextDocument.URI
150150
log.Printf("--> didOpen(%s@%d as '%s')", p.TextDocument.URI, p.TextDocument.Version, p.TextDocument.LanguageID)
151151

152-
res, err := handler.didOpen(ctx, p)
153-
154-
if res == nil {
152+
if res, e := handler.didOpen(p); e != nil {
153+
params = nil
154+
err = e
155+
} else if res == nil {
155156
log.Println(" --X notification is not propagated to clangd")
156-
return nil, err // do not propagate to clangd
157+
return nil, nil // do not propagate to clangd
158+
} else {
159+
log.Printf(" --> didOpen(%s@%d as '%s')", res.TextDocument.URI, res.TextDocument.Version, p.TextDocument.LanguageID)
160+
params = res
157161
}
158162

159-
log.Printf(" --> didOpen(%s@%d as '%s')", res.TextDocument.URI, res.TextDocument.Version, p.TextDocument.LanguageID)
160-
params = res
161163

162164
case *lsp.DidChangeTextDocumentParams:
163165
// notification "textDocument/didChange"
@@ -530,7 +532,7 @@ func startClangd(compileCommandsDir, sketchCpp *paths.Path) (io.WriteCloser, io.
530532
}
531533
}
532534

533-
func (handler *InoHandler) didOpen(ctx context.Context, inoDidOpen *lsp.DidOpenTextDocumentParams) (*lsp.DidOpenTextDocumentParams, error) {
535+
func (handler *InoHandler) didOpen(inoDidOpen *lsp.DidOpenTextDocumentParams) (*lsp.DidOpenTextDocumentParams, error) {
534536
// Add the TextDocumentItem in the tracked files list
535537
inoItem := inoDidOpen.TextDocument
536538
handler.docs[inoItem.URI] = &inoItem

0 commit comments

Comments
 (0)