-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add arduino support #5277
Comments
The instructions from {
"cpu": {
"fqbn": "arduino:avr:uno",
"name": "Arduino Uno",
"port": "serial:///dev/ttyACM0"
}
} |
I've been tinkering with it for a while, but nothing is getting this to work. I get 'language server exited'. Maybe are there discrete steps? Perhasps my language.toml file isn't properly configured with the right args.. - Gentoo linux user. |
I spent some time trying to also make it work but with no luck. I can start the lsp in my terminal
but when included in
the lsp quits at internal clangd startup. I am also pretty sure the For now I am quite happy using platformIO Core in combination with clangd, although it can be a bit inconvenient when collaborating with others. If anyone wants to take a look, I can share my |
I don't know if you figured it out, but I was able to get some completion and hover to work with this setting in the root of my repo, the repo has a bunch of arduino projects
[[language]]
scope = "source.cpp"
name = "arduino"
file-types = ["ino"]
roots = ["*.ino", "sketch.yaml"]
language-server = { command = "arduino-language-server", args = ["--log"] } I am setting up my project with arduino-cli and I setup a This setup doesn't have the syntax highlighting, I don't know why but it's my first time with helix and I didn't have time to investigate yet |
I've managed to bodge syntax highlighting into working by adding the following to [language-server.arduino-lsp]
command = "arduino-language-server"
args = ["-cli", "arduino-cli", "-cli-config", "~/.arduino15/arduino-cli.yaml", "-clangd", "clangd"]
[[grammar]]
name = "cpp"
source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "a90f170f92d5d70e7c2d4183c146e61ba5f3a457" }
[[grammar]]
name = "arduino"
source = { git = "https://github.com/ObserverOfTime/tree-sitter-arduino", rev = "db929fc6822b9b9e1211678d508f187894ce0345"}
[[language]]
name = "arduino"
scope = "source.arduino"
injection-regex = "arduino"
file-types = ["ino"]
roots = [ "sketch.yaml"]
language-servers = [ "arduino-lsp" ] and by "borrowing" the 'cpp' and 'arduino' tree-sitter queries from nvim-treesitter, putting them in I'm not exactly sure why I needed to both use a more recent version of I am using the latest version of Helix which subtly changes the language server configuration ( |
Oh that's great, thank you, indeed it seems the queries are required. |
Oh you're right, I had just copied the args from a previous comment without thinking. |
@lieskjur said:
did you make that work properly in Helix? I keep having errors showing up in helix when modifying a platformio project about the Thanks |
@abondis This might be related to your problem---my Arduino language configuration also includes [[language]]
name = "arduino"
scope = "source.arduino"
injection-regex = "arduino"
file-types = ["ino", "cpp", "h"] # ⭐ this line is what matters
comment-token = "//"
roots = ["sketch.yaml"]
language-servers = ["arduino-language-server"]
indent = { tab-width = 4, unit = " " }
auto-format = true
[language.formatter]
command = "clang-format"
[language-server.arduino-language-server]
command = "arduino-language-server"
[[grammar]]
name = "cpp"
source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "a90f170f92d5d70e7c2d4183c146e61ba5f3a457" }
[[grammar]]
name = "arduino"
source = { git = "https://github.com/ObserverOfTime/tree-sitter-arduino", rev = "db929fc6822b9b9e1211678d508f187894ce0345" } |
I managed to get the language server working, but for some reason highlights aren't |
Have you run these commands after using the above config? helix -g fetch
helix -g build |
yeah I have done that. What should I be looking for in the logs to troubleshoot. Funnily the language server is running just fine |
Hm, I'm not sure why it's not working at the moment. A temporary solution I can think of for now is setting the grammar in [[language]]
name = "arduino"
grammar = "cpp"
# ... the rest of your config |
All is in the title. I've been enjoying Helix for rust / elm / python dev. I also have some DIY embedded projects and thought it would be awesome to have arduino support in Helix.
The text was updated successfully, but these errors were encountered: