Skip to content

Commit 9c332bb

Browse files
committed
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.
1 parent 508ca69 commit 9c332bb

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Diff for: handler/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ func (handler *InoHandler) generateBuildEnvironment() (*paths.Path, error) {
141141
CompilerOut string `json:"compiler_out"`
142142
CompilerErr string `json:"compiler_err"`
143143
BuilderResult cmdBuilderRes `json:"builder_result"`
144+
Success bool `json:"success"`
144145
}
145146
var res cmdRes
146147
if err := json.Unmarshal(cmdOutput.Bytes(), &res); err != nil {
147148
return nil, errors.Errorf("parsing arduino-cli output: %s", err)
148149
}
149-
150150
// Return only the build path
151151
log.Println("arduino-cli output:", cmdOutput)
152152
return res.BuilderResult.BuildPath, nil

Diff for: handler/handler.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -691,9 +691,7 @@ func examineCompileCommandsJSON(compileCommandsDir *paths.Path) map[string]bool
691691

692692
compilers[compiler] = true
693693
}
694-
if len(compilers) == 0 {
695-
panic("main compiler not found")
696-
}
694+
697695
// Save back compile_commands.json with OS native file separator and extension
698696
compileCommands.SaveToFile()
699697

0 commit comments

Comments
 (0)