From 2fdf332e5c247dcfba9c02428c4c2cd8c097982a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 15 Sep 2021 13:00:16 +0200 Subject: [PATCH 1/3] Increased logging in textDocument/completion response message --- handler/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/handler.go b/handler/handler.go index 6ef25a7..f7bc634 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -1259,7 +1259,7 @@ func (handler *InoHandler) transformClangdResult(method string, inoURI, cppURI l } } r.Items = newItems - log.Printf("<-- completion(%d items)", len(r.Items)) + log.Printf("<-- completion(%d items) cppToIno=%v", len(r.Items), cppToIno) return r case *lsp.DocumentSymbolArrayOrSymbolInformationArray: From 19cbd823cdf29477fcd59a9a00cc0c9ae06d391b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 15 Sep 2021 13:00:25 +0200 Subject: [PATCH 2/3] Update inoURI after (the optional) inoToCpp conversion 2021/09/15 12:56:55 --> completion(file:///home/cmaglie/Arduino/Blink/Blink.ino:13:5) 2021/09/15 12:56:55 --> completion(file:///tmp/arduino-language-server299721744/sketch/Blink.ino.cpp:20:5) otherwise inoUri will still point to file:///home/cmaglie/Arduino/Blink/Blink.ino instead of file:///tmp/arduino-language-server299721744/sketch/Blink.ino.cpp --- handler/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/handler.go b/handler/handler.go index f7bc634..a197179 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -361,7 +361,6 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr case *lsp.CompletionParams: // method: "textDocument/completion" - inoURI = p.TextDocument.URI log.Printf("--> completion(%s:%d:%d)\n", p.TextDocument.URI, p.Position.Line, p.Position.Character) if res, e := handler.ino2cppTextDocumentPositionParams(&p.TextDocumentPositionParams); e == nil { @@ -370,6 +369,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr } else { err = e } + inoURI = p.TextDocument.URI case *lsp.CodeActionParams: // method "textDocument/codeAction" From 99245449303c95802040facf61cbda3d2d724f9e Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 15 Sep 2021 13:14:07 +0200 Subject: [PATCH 3/3] Fixed textDocument/hover response range coordinates Fix #68 --- handler/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/handler.go b/handler/handler.go index a197179..3a33155 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -391,7 +391,6 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr case *lsp.HoverParams: // method: "textDocument/hover" - inoURI = p.TextDocument.URI doc := &p.TextDocumentPositionParams log.Printf("--> hover(%s:%d:%d)\n", doc.TextDocument.URI, doc.Position.Line, doc.Position.Character) @@ -401,6 +400,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr } else { err = e } + inoURI = p.TextDocument.URI case *lsp.DocumentSymbolParams: // method "textDocument/documentSymbol"