From 4d6cc2fbc9d8b060f98318fb4ba391ab843e20e3 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Thu, 23 Jul 2020 14:27:28 +0200 Subject: [PATCH 1/2] Fixed path of the gen cpp and compile_flags files. #28 has fixed the location of the `ino` file but the generated `cpp` and `compile_flags.txt` were not moved into the sketch folder. Touching the `ino` file triggered a `'textDocument/didChange'` event, but the `updateFileData` call failed as the files were not found. This commit moves the files into the appropriate location. Signed-off-by: Akos Kitta --- handler/builder.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/builder.go b/handler/builder.go index 8bda9b1..170bbd2 100644 --- a/handler/builder.go +++ b/handler/builder.go @@ -53,8 +53,8 @@ func generateCpp(inoCode []byte, sourcePath, fqbn string) (cppPath string, cppCo } // Generate compile_flags.txt - cppPath = filepath.Join(rootTempDir, sketchFileName+".cpp") - flagsPath, err := generateCompileFlags(rootTempDir, inoPath, sourcePath, fqbn) + cppPath = filepath.Join(sketchTempPath, sketchFileName+".cpp") + flagsPath, err := generateCompileFlags(sketchTempPath, inoPath, sourcePath, fqbn) if err != nil { return } @@ -63,7 +63,7 @@ func generateCpp(inoCode []byte, sourcePath, fqbn string) (cppPath string, cppCo } // Generate target file - cppCode, err = generateTargetFile(rootTempDir, inoPath, cppPath, fqbn) + cppCode, err = generateTargetFile(sketchTempPath, inoPath, cppPath, fqbn) return } From 98e078cf8d036b03c79031d333eb06e1f2994b61 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Mon, 27 Jul 2020 09:26:25 +0200 Subject: [PATCH 2/2] Do not escape line breaks for 'window/showMessage' Theia cannot handle them. Signed-off-by: Akos Kitta --- handler/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/handler.go b/handler/handler.go index 43e6161..f6c4c98 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -840,7 +840,7 @@ func (handler *InoHandler) parseCommandArgument(rawArg interface{}) interface{} func (handler *InoHandler) showMessage(ctx context.Context, msgType lsp.MessageType, message string) { params := lsp.ShowMessageParams{ Type: msgType, - Message: strings.ReplaceAll(message, "\n", "
"), + Message: message, } handler.StdioConn.Notify(ctx, "window/showMessage", ¶ms) }