From 9c332bba25cfe839956a176f416e3d464f9ad6d9 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 28 Jan 2021 12:58:12 +0100 Subject: [PATCH] Do not bail out if compile_commands.json is empty It may means that the sketch can not be preprocessed because it contains too many errors. In this case just keep it as-is and show the errors generated by clangd itself. --- handler/builder.go | 2 +- handler/handler.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/handler/builder.go b/handler/builder.go index 54eff22..8464f72 100644 --- a/handler/builder.go +++ b/handler/builder.go @@ -141,12 +141,12 @@ func (handler *InoHandler) generateBuildEnvironment() (*paths.Path, error) { CompilerOut string `json:"compiler_out"` CompilerErr string `json:"compiler_err"` BuilderResult cmdBuilderRes `json:"builder_result"` + Success bool `json:"success"` } var res cmdRes if err := json.Unmarshal(cmdOutput.Bytes(), &res); err != nil { return nil, errors.Errorf("parsing arduino-cli output: %s", err) } - // Return only the build path log.Println("arduino-cli output:", cmdOutput) return res.BuilderResult.BuildPath, nil diff --git a/handler/handler.go b/handler/handler.go index 1a0f8e0..be8247a 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -691,9 +691,7 @@ func examineCompileCommandsJSON(compileCommandsDir *paths.Path) map[string]bool compilers[compiler] = true } - if len(compilers) == 0 { - panic("main compiler not found") - } + // Save back compile_commands.json with OS native file separator and extension compileCommands.SaveToFile()