stevearc / vim-arduino

Vim plugin for compiling and uploading arduino sketches
MIT License
337 stars 23 forks source link

Not working with arduino-cli on MacOS #61

Open Curs3W4ll opened 1 month ago

Curs3W4ll commented 1 month ago

Describe the bug I tried using this plugin, using arduino-cli.

System information

To Reproduce Steps to reproduce the behavior:

  1. Install only arduino-cli only
  2. Install the plugin
  3. Open a .ino file
  4. See this error message
    Error detected while processing BufReadPost Autocommands for "*":
    Error executing lua callback: .../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:35:
    Error executing lua: .../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /Users/corentin/.local/share/nvim/lazy/vim-arduino/ftplugin/arduino.vim[5]..function arduino#InitializeConfig[62]..arduino#ReloadBoards, line 37: Vim(echoerr):Could not find any boards.txt or programmers.txt files. Please set g:arduino_dir and/or g:arduino_home_dir (see help for details)
    stack traceback:
        [C]: in function 'nvim_cmd'
        .../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:36: in function <.../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        .../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:35: in function <.../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:10>
    stack traceback:
        [C]: in function 'nvim_buf_call'
        .../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:35: in function <.../latest/nvim-macos-arm64/share/nvim/runtime/filetype.lua:10>

Expected behavior The plugin should work without any error?

Working command This is not an issue with arduino-cli, so I don't think this is relevant?

stevearc commented 1 month ago

You shouldn't need an Arduino IDE installation for this to work, but the last time I tested it (several years at this point), arduino-cli had some bugs with listing board details

https://github.com/stevearc/vim-arduino/blob/2ded67cdf09bb07c4805d9e93d478095ed3d8606/autoload/arduino.vim#L110-L112

I am very far away from a computer that has arduino-cli set up and won't be able to test this myself. If you're interested you could try checking if the commands work now, and refactor the logic to rely on that instead. You could even try just making it gracefully fall back to using the arduino-cli; it's not like that would be worse than failing entirely.