arduino / arduino-language-server

An Arduino Language Server based on Clangd to Arduino code autocompletion
GNU Affero General Public License v3.0
117 stars 11 forks source link

flag provided but not defined error. #162

Closed ubaldot closed 1 year ago

ubaldot commented 1 year ago

Describe the problem

I am using Vim9 with https://github.com/yegappan/lsp registered as it follows

{
    name: 'arduino-language-server',
    filetype: ['arduino'],
    path: $HOME .. '/Documents/arduino-language-server/arduino-language-server',
    debug: true,
    args: ['-clangd /usr/bn/clangd',
            '-cli-config /Users/ubaldot/Library/Arduino15/arduino-cli.yaml',
            '-cli /opt/homebrew/bin/arduino-cli',
            '-fqbn arduino:avr:uno']
}

but when I open a .ino file I get the following error

flag provided but not defined: -clangd /usr/bin/clangd
Usage of /Users/ubaldot/Documents/arduino-language-server/arduino-language-server:
  -board-name string
        User-friendly board name to use initially (can be changed via JSON-RPC)
  -clangd string
        Path to clangd executable
  -cli string
        Path to arduino-cli executable
      ......

I tried to google a bit and it seems a problem with go which I don't have installed, I am using the released version of vim-arduino.

However, if I run the server from the a zsh shell everything seems to work:

$ ./arduino-language-server -cli-config /Users/ubaldot/Library/Arduino15/arduino-cli.yaml -cli /opt/homebrew/bin/arduino-cli -fqbn arduino:avr:uno -clangd /usr/bin/clangd
20:01:18.765902 LS: : Initial board configuration: arduino:avr:uno
20:01:18.766053 LS: : arduino-language-server Version: 0.7.4 Commit: d620b0b Date: 2023-01-11T15:42:52Z
20:01:18.766065 LS: : Language server build path: /private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server2278060418
20:01:18.766068 LS: : Language server build sketch root: /private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server2278060418/sketch
20:01:18.766072 LS: : Language server FULL build path: /private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server1433768

arduino-language-server is a language server that provides IDE-like features to editors.

It should be used via an editor plugin rather than invoked directly. For more information, see:
https://github.com/arduino/arduino-language-server/
https://microsoft.github.io/language-server-protocol/

Given that I am not sure if the problem is due to the lsp-client that I am using or due to vim-arduino (or due to myself ahahah) after googling the error and find out that may be golang related I posted here.

To reproduce

1) Install the mentioned lsp client and register the client as shown above, 2) Open a .ino file, 3) Call :LspServer debug errors and you will see the error.

Expected behavior

Lsp client working with no errors.

Arduino Language Server version

arduino-language-server Version: 0.7.4 Commit: d620b0b Date: 2023-01-11T15:42:52Z

Arduino CLI version

arduino-cli Version: 0.33.0 Commit: ca60d4b4 Date: 2023-05-29T15:18:18Z

Operating system

macOS

Operating system version

13.4 (22F66)

Additional context

No response

Issue checklist

per1234 commented 1 year ago
flag provided but not defined: -clangd /usr/bin/clangd

This error occurs when the flag and argument are combined into a quoted string argument like this:

arduino-language-server "-clangd /usr/bin/clangd"

Please try breaking the flags and arguments into separate elements in the args list of your configuration and then comment here to let us know whether the error still occurs:

{
    name: 'arduino-language-server',
    filetype: ['arduino'],
    path: $HOME .. '/Documents/arduino-language-server/arduino-language-server',
    debug: true,
    args: ['-clangd',
           '/usr/bn/clangd',
           '-cli-config',
           '/Users/ubaldot/Library/Arduino15/arduino-cli.yaml',
           '-cli',
           '/opt/homebrew/bin/arduino-cli',
           '-fqbn',
           'arduino:avr:uno']
}
ubaldot commented 1 year ago

This! Thanks!