Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replace dependency while waiting for fix to be merged #199

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

Closed
speelbarrow wants to merge 2 commits into arduino:main from speelbarrow:main

Conversation

Copy link

@speelbarrow speelbarrow commented Nov 3, 2024
edited
Loading

Please check if the PR fulfills these requirements


mike-lloyd03, mirzahilmi, defliez, snail-with-tea, and brandoncc reacted with thumbs up emoji molegl and brandoncc reacted with heart emoji
Copy link

CLAassistant commented Nov 3, 2024
edited
Loading

CLA assistant check
All committers have signed the CLA.

Copy link
Author

speelbarrow commented Nov 3, 2024
edited
Loading

It should be noted that this would cause go install github.com/arduino/arduino-language-server@... to no longer work:

-> speelbarrow ~/Git/arduino-language-server (main) ✓ go install github.com/speelbarrow/arduino-language-ser
ver@v0.0.0-20241103180208-6064dc30028f 
go: downloading github.com/speelbarrow/arduino-language-server v0.0.0-20241103180208-6064dc30028f
go: github.com/speelbarrow/arduino-language-server@v0.0.0-20241103180208-6064dc30028f (in github.com/speelba
rrow/arduino-language-server@v0.0.0-20241103180208-6064dc30028f):
 The go.mod file for the module providing named packages contains one or
 more replace directives. It must not contain directives that would cause
 it to be interpreted differently than if it were the main module.

If you choose not to merge this PR for that reason, I request that you at least leave it open so that others using Neovim v0.10+ can find this fix.

Workaround install instructions are:

git clone https://github.com/speelbarrow/arduino-language-server.git
cd arduino-language-server
go install
defliez reacted with thumbs up emoji

@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project labels Nov 4, 2024
Copy link

It should be noted that this would cause go install github.com/arduino/arduino-language-server@... to no longer work:

-> speelbarrow ~/Git/arduino-language-server (main) ✓ go install github.com/speelbarrow/arduino-language-ser
ver@v0.0.0-20241103180208-6064dc30028f 
go: downloading github.com/speelbarrow/arduino-language-server v0.0.0-20241103180208-6064dc30028f
go: github.com/speelbarrow/arduino-language-server@v0.0.0-20241103180208-6064dc30028f (in github.com/speelba
rrow/arduino-language-server@v0.0.0-20241103180208-6064dc30028f):
 The go.mod file for the module providing named packages contains one or
 more replace directives. It must not contain directives that would cause
 it to be interpreted differently than if it were the main module.

If you choose not to merge this PR for that reason, I request that you at least leave it open so that others using Neovim v0.10+ can find this fix.

Workaround install instructions are:

git clone https://github.com/speelbarrow/arduino-language-server.git
cd arduino-language-server
go install

Hey,
thanks for your pr!
this workaround doesn"t fix the version problem which is currently in nvim 0.1.x or do I miss here something?
Just tried it and got the same errors as in the original verison.
Damn, why is this lsp stuff such a mess!

Copy link
Author

this workaround doesn"t fix the version problem which is currently in nvim 0.1.x or do I miss here something? Just tried it and got the same errors as in the original verison. Damn, why is this lsp stuff such a mess!

@diffusive0047 This workaround allows the language server to properly attach to the buffer, which lets it work at all. The message in :LspInfo that I'm assuming you're referring to doesn't get in the way of the language server operating (as far as I can tell). But please let me know if I'm misunderstanding what error you're talking about and I'll look into it further.

Copy link

cristobaltapia commented Dec 4, 2024
edited
Loading

Hi @speelbarrow I just tested this and it is working for me. Also had to use clangd from my system, as there were issues with the one provided by Mason.

Edit: no, apparently it is not working. I was sure that the buffer was attached first, but now not any more :/ .


Edit 2:

Here are some logs:

[ERROR][2024年12月04日 22:05:48] .../vim/lsp/rpc.lua:770	"rpc"	"/usr/bin/arduino-language-server"	"stderr"	"22:05:48.564987 INIT --- : error starting clang: running --config-file /home/tapia/.arduino15/arduino-cli.yaml compile --fqbn --only-compilation-database --source-override /tmp/1085483171 --build-path /tmp/arduino-language-server2147930507/fullbuild --format json /home/tapia/Arduino/test-nano: exit status 1 
22:05:48.565018 textDocument/didOpen: locked (waiting clangd) 
22:05:48.565024 textDocument/didOpen: clangd startup failed: quitting Language server 
"
speelbarrow, Aloous, and samuelbles07 reacted with thumbs up emoji

Copy link

defliez commented Dec 5, 2024
edited
Loading

Hi @cristobaltapia!
@speelbarrow 's solution worked for me. Below is the course I followed to make it work. I am not sure if it's the most optimal way to go about it but it worked for me at least.

I cloned speelbarrow's repo in /tmp, entered the arduino-language-server directory and ran:
go install
go build

I then navigated to ~/.local/share/nvim/mason/bin, deleted the arduino-language-server symlink created by Mason and then created a new symlink to /tmp/arduino-language-server/arduino-language-server. I used clangd from Mason in my config.

My lsp.lua:

local lspconfig = require('lspconfig')
require('lspconfig').arduino_language_server.setup {
 cmd = {
 "/Users/valentino/.local/share/nvim/mason/bin/arduino-language-server",
 "-clangd", "/Users/valentino/.local/share/nvim/mason/bin//clangd",
 "-cli", "/usr/local/bin/arduino-cli",
 "-cli-config", "/Users/valentino/Library/Arduino15/arduino-cli.yaml",
 "-fqbn", "arduino:renesas_uno:unor4wifi"
 },
 root_dir = lspconfig.util.root_pattern("*.ino"),
 filetypes = { "arduino" },
 autostart = true,
 log_level = vim.lsp.protocol.MessageType.Log,
 settings = {
 arduino_language_server = {
 log = {
 verbosity = "debug"
 }
 }
 }
}

My environment:
OS: macOS 14.6.1
Neovim: v0.10.2
arduino-cli: 1.1.0
clangd (from Mason): 19.1.0

With these steps, the ALS attaches to the buffer when i open an .ino file in Neovim. Hope this is any help :)

tanay1337 reacted with thumbs up emoji

Copy link

Hi @speelbarrow.

I tested the proposed fix and I am obtaining the same errors as mentioned by @cristobaltapia.

I am including the arduino-language-server logs as well as the similar line under the lsp logs.

inols.log
inols-err.log

[ERROR][2024年12月14日 19:56:28] .../vim/lsp/rpc.lua:770 "rpc" "/nix/store/z4r1jsjvm4byqkfnlci2cl3kpad0pisk-arduino-language-server-latest/bin/arduino-language-server" "stderr" '19:56:28.856249 27円[96mINIT --- : error starting clang: running --config-file /home/matthew/.arduino15/arduino-cli.yaml compile --fqbn "nRFMicro-like Boards:nrf52:supermini" --only-compilation-database --source-override /tmp/3346771869 --build-path /tmp/arduino-language-server1204308188/fullbuild --format json /home/matthew/Arduino/SOFLE_FIRMWARE: exit status 127円[0m\n19:56:28.856392 27円[92m textDocument/didOpen: 27円[93mlocked (waiting clangd)27円[0m27円[0m\n19:56:28.856402 27円[92m textDocument/didOpen: clangd startup failed: quitting Language server27円[0m\n'

All that I am noticing is is that the following notifications generated by my sketch is not being propagated to clangd:
"commands":["clangd.applyFix","clangd.applyTweak"]}

Unfortunately this is quite out of my domain, I hope the logs at least provide some use.

My environment is:

  • NVIM v0.10.1
    • Build type: Release
    • LuaJIT 2.1.1713773202
  • clangd version 19.1.0-rc3
    • Features: linux
    • Platform: x86_64-unknown-linux-gnu
  • arduino-cli Version: 1.0.4
levinion reacted with thumbs up emoji

Copy link

Please consider merging this since it makes the language server usable in neovim. It would have been a much nicer experience if the mason install had just worked, but I had to customize the command to use speelbarrow's fork.

ruthen1um reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Arduino LS "rpc.lua" problem with neovim

AltStyle によって変換されたページ (->オリジナル) /