Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arduino-language-server does not error on failed compilation from arduino-cli #79

Open
danieldides opened this issue Jun 27, 2021 · 0 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@danieldides
Copy link

Bug Report

Current behavior

When starting the language server (I'm using neovim's LSP client), the invocation to the arduino-cli tool for a compilation step before calling clangd can error out without crashing the language server. This causes an ambiguous behavior where the language server appears to be operating and waiting on clangd, but has failed a necessary step to invoke the server.

Expected behavior

I would expect the language server to crash on failure to pre-process the ino files into cpp files and pass off to clangd. It might even make sense to show an error message here that suggests there's an issue with the arduino-cli involvement and to investigate there. For me, I had not installed the the platform core for the board.

The arduino-cli responds with a JSON object noting that the compiler has failed. I think on "success": false the LS should exit and display a message.

Additionally (this should be an issue on the arduino-cli project), it would be nice if the error message from the arduino-cli tool made it to the LS. All the LS receives back is:

2021/06/27 00:24:32 arduino-cli output: {
  "compiler_out": "",
  "compiler_err": "",
  "builder_result": null,
  "success": false
}

however when compiling the code manually (not letting the LS do it for me), the error message is much more clear:

Error during build: platform not installed

Environment

  • Language Server version (commit hash): 64a0e42a7a3d713629d3066d7555fb32cf19c3ec
  • CLI version used (output of arduino-cli version): arduino-cli alpha Version: 0.18.3 Commit: d710b642 Date: 2021-05-14T12:36:58Z
  • OS and platform: Ubuntu 20.04.1 LTS

Additional context

Started logging.
2021/06/27 00:24:32 logging to /home/daniel/Projects/personal/arduino/OLED/inols.log
2021/06/27 00:24:32 Initial board configuration: { arduino:avr:uno}
2021/06/27 00:24:32 Language server build path: /tmp/arduino-language-server819982533
2021/06/27 00:24:32 Language server build sketch root: /tmp/arduino-language-server819982533/sketch
2021/06/27 00:24:32 IDE --> LS     CL: REQUEST initialize 1:
2021/06/27 00:24:32 IDE --> initialize 1  locked
2021/06/27 00:24:32 IDE --> initialize 1  unlocked
2021/06/27 00:24:32 IDE <-- LS     CL: ANSWER UNBOUND (1):
2021/06/27 00:24:32 INIT--- initializing workbench
2021/06/27 00:24:32 INIT---  locked
2021/06/27 00:24:32     --> initialize(file:///home/daniel/Projects/personal/arduino/OLED)
2021/06/27 00:24:32 running:  /home/daniel/bin/arduino-cli --config-file /home/daniel/.arduino15/arduino-cli.yaml compile --fqbn arduino:avr:uno --only-compilation-database --clean --source-override /tmp/797020000 --build-path /tmp/arduino-language-server819982533 --format json /home/daniel/Projects/personal/arduino/OLED
2021/06/27 00:24:32 IDE --> LS     CL: NOTIFICATION initialized:
2021/06/27 00:24:32 arduino-cli output: {
  "compiler_out": "",
  "compiler_err": "",
  "builder_result": null,
  "success": false
}

2021/06/27 00:24:32 INIT--- initializing workbench (done)
2021/06/27 00:24:32 INIT---  unlocked
2021/06/27 00:24:32 IDE --> initialized notif1  read-locked
2021/06/27 00:24:32 IDE --> initialized notif1 notification is not propagated to clangd
2021/06/27 00:24:32 IDE --> initialized notif1  read-unlocked
2021/06/27 00:24:32 IDE --> LS     CL: NOTIFICATION textDocument/didOpen:
2021/06/27 00:24:32 IDE --> textDocument/didOpen notif2  locked
2021/06/27 00:24:32 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)
2021/06/27 00:24:32 IDE --> textDocument/didOpen notif2  unlocked (waiting clangd)
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants