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

Replace dependency while waiting for fix to be merged #199

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

speelbarrow
Copy link

@speelbarrow speelbarrow commented Nov 3, 2024

Please check if the PR fulfills these requirements


@CLAassistant
Copy link

CLAassistant commented Nov 3, 2024

CLA assistant check
All committers have signed the CLA.

@speelbarrow
Copy link
Author

speelbarrow commented Nov 3, 2024

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
[email protected]                           
go: downloading github.com/speelbarrow/arduino-language-server v0.0.0-20241103180208-6064dc30028f
go: github.com/speelbarrow/[email protected] (in github.com/speelba
rrow/[email protected]):
        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

@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project labels Nov 4, 2024
@diffusive0047
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
[email protected]                           
go: downloading github.com/speelbarrow/arduino-language-server v0.0.0-20241103180208-6064dc30028f
go: github.com/speelbarrow/[email protected] (in github.com/speelba
rrow/[email protected]):
        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!

@speelbarrow
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.

@cristobaltapia
Copy link

cristobaltapia commented Dec 4, 2024

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 
"

@defliez
Copy link

defliez commented Dec 5, 2024

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 :)

@MatthewWinnan
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 1\27[0m\n19:56:28.856392 \27[92m textDocument/didOpen: \27[93mlocked (waiting clangd)\27[0m\27[0m\n19:56:28.856402 \27[92m textDocument/didOpen: clangd startup failed: quitting Language server\27[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

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

Successfully merging this pull request may close these issues.

Arduino LS "rpc.lua" problem with neovim
7 participants