-
Notifications
You must be signed in to change notification settings - Fork 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
LSP throwing an error on each and every character I type in the editor #12825
Comments
Hey @Gilgames000. Thanks for your report. I am using coc.nvim along with NeoVIM / VIM. Can you maybe tell me your vim-native LSP configuration such that I can reproduce your local environment? |
Sure @christianparpart! I use the built-in LSP client, the official nvim-lspconfig configuration for it, nvim-cmp and an auto-completion engine that uses LSPs as completion sources, and nvim-lsp-installer to easily install and manage LSP servers. You can install all of this using vim-plug
and then use The only problem is that I get the error quite randomly, meaning that it doesn't fire right away sometimes. Though it always shows up quite consistently after I write some code. I still couldn't figure out what code exactly triggers it since it shows up quite often anyway... |
I tried enabling
Looks like a new message 🧐 |
Yes, thanks @Gilgames000. Seems like neovim is doing something fishy here. It looks like it's not senting the initialization as its first step. I'll keep you posted. :) |
I see, thanks! Should I open an issue on neovim repo? Or the lsp repo? Since you seemed to imply that the problem is on their end. Correct me if I'm wrong! |
Hey @christianparpart this morning I decided to go back to coc.nvim for the time being just for Solidity since you said it works fine for you so I set it up using the config I found in your dotfiles. But now I'm facing the same problem and error message on coc.nvim too. Here's the log:
and then the log goes on and on with the same error message being spammed for each keystroke I press when I'm editing a Solidity file. |
I'm having the exact same error but with coq_nvim. Used the same method as @Gilgames000 to install solc. |
Facing the same error on MacOS, same installation method. The language server works great for a few minutes, then starts throwing this error on every keystroke - haven't been able to find out what triggers it yet. |
I noticed you mentioned that nvim is doing something weird with the initialization, so I think this may be related: Running
|
Having the same issues as well. Running
Read my log files and this is the first error that showed up for me
|
I'm with the same issue with coc.nvim. Everytime I open a solidity file, solc crashed.
Did anyone find a solution? If I ran
|
It seems that this error is most prevalent when I am also running a hardhat node while simultaneously working in a solidity file. When I spin down the hardhat node, the solc LSP seems to run fine unless I use There could be some underlying conflict caused by running the LSP and a local node in simultaneity on a localhost. Side note: Running the local node on a different port: My workflow now has been to spin down the node, modify the code, then spin the node back up. Tis a bit a bugger, but a smidge better than the constant initialization errors upon each keystroke. |
@BitlyTwiser solc is pretty strict about when calls are allowed, i.e. it doesn't allow a request to document-highlight if the server has not yet received the initialization call just yet. Would you mind trying out a debug binary? What distribution / OS are you testing on? |
@christianparpart
I shall attempt to perform some development on the Solidity smart contracts in the next few days to determine if I am yet running into LSP issues. I would indeed be more than happy assist via utilizing a debugging binary if the issue yet persists. |
@BitlyTwiser I've fixed a bug related to URL decoding. This might maybe also fix your problem. Related fix-PR: #13473 Would you mind giving that a try? In case you need a prebuilt binary for Ubuntu Linux, here's one created by the CI: https://output.circle-artifacts.com/output/job/1ddf7057-73e4-4ff4-92f4-4bff0a5ba70e/artifacts/0/solc EDIT: You may need to |
@oscariquelme01, the only LSP that worked for me on Neovim was vscode-solidity. I installed it using nvim-lsp-installer, which now migrates to mason. Mason doesn't support vscode-solidity yet, but I'm working on a PR to add. You can find my conf on my dotfiles repo |
@anajuliabit Thanks a lot for the dotfiles! I ll be trying to figure out how to set up solidity_ls in the mean time. Quick question tho, where did you find the list of configuration options for the solidity_ls language server? I can't find it anywhere :( |
Personally, I've been having a lot more luck with solidity-ls for the time being. Configuration for this lsp is here |
Any progress to this, having the same issue just like @anajuliabit |
@oscariquelme01 they called the package |
I am getting this frequently. The LSP is not usable for myself. I can produce this be deleting some lines and undoing deletion. Have you found a workaround? |
I have similar issue(0.8.17) with solc. I switched from lunarvim to astronvim which uses mason-lspconfig out of the box. With that I install solidity-ls through :LspInstall solidity which for the moment is more complete. |
Similar issue. The day I installed it it worked just fine, but after a restart I cannot get this to work. Fails as described above. NeoVim v0.7.2 installed via Mason. |
Hey @oliversavio, I recommend using solidity-ls for the time being that was just added to mason.nvim if you use it. It's been working great for me until the solc lsp gets fixed |
Also having this issue. Would really appreciate this getting fixed! |
I seem to be getting this error when using
|
@christianparpart any progress on this? I can confirm the |
@christianparpart I can also confirm that the problem persists using #13473 ( |
Same error here nvim v0.8.0 Arch Linux and Ubuntu WSL2. |
Yes, I decided to autocompile my code, setting a node env var to speed it up. I get my errors from the compiler output instead of decorations in my text editor. I have the terminal in a split, and turned on a simple plugin I wrote that will autosave the file currently open on changes. So essentially I'm constantly compiling the code and seeing the output in the right split. This is from my package.json
|
@zkSoju you are probably missing the |
I was able to make this works, I realized that I had to install solc I was trying to do "npm install -g solc", but when you do that the execution commad is solcjs and dosen't work. |
any updates for folks using solc here with neovim? =( |
Did anyone find a solution for this issue? I am still getting error every time I enter or delete a character. |
I've managed to get the full LSP experience for Solidity (syntax highlighting, autocompletion, go-to definition etc.) *For anyone wondering how to set this up step by step (I'm using AstroNvim):
*That's how I did it, but I think that you could also simply do Update: That's correct. You can skip the above steps and just do the AstroNvim uses mason, but since this LSP is not provided by default, we have to set it up manually. This documentation page on custom lsp config in astro nvim describes how to do this. I am assuming you have your own -- Extend LSP configuration
lsp = {
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
"solidity"
}, After that set up the server settings: -- Add overrides for LSP server settings, the keys are the name of the server
["server-settings"] = {
solidity = {
cmd = { 'nomicfoundation-solidity-language-server', '--stdio' },
filetypes = { 'solidity' },
root_dir = require("lspconfig.util").find_git_ancestor,
single_file_support = true,
},
}, You should be ready to go. Cheers 🎉 I've described this in greater detail on my blog - Solidity LSP Neovim setup |
Sorry guys. I've quit working for EF some months ago for personal reasons. And given my private-life priorities I do not see myself continuing to work on solc/lsp in my free time any time soon either. Given the fact that the team however seems understaffed, I do not thing there'll be any progress any time soon. Maybe @NunoFilipeSantos or someone else from the team can shed more light into this? Stay safe, |
Thanks Chris for chiming in! To add a bit of context to this: The team is not understaffed, we just have a roadmap that we try to stick to and allocate our resources accordingly. If you're curious, you can check out the roadmap project board for 2023 here. |
Hi @christianparpart answering since you tagged me.
|
I opened a PR to add nomicfoundation LSP to mason registry mason-org/mason-registry#1322 |
Thanks for the PR! I've actually been using nomic's LSP for a while, but I've been too lazy to open a PR in the mason repo 😅 |
Thanks @anajuliabit for the recommendation and help with installation! It's been working great for me. Because it has been integrated into the Mason Registry (see here), you can just install it easily through For those using their own nvim config, you can create a new local configs = require 'lspconfig.configs'
if not configs.nomic_solidity then
configs.nomic_solidity = {
default_config = {
cmd = { 'nomicfoundation-solidity-language-server', '--stdio' },
filetypes = { 'solidity' },
root_dir = require("lspconfig.util").find_git_ancestor,
-- require("lspconfig.util").root_pattern "foundry.toml",
single_file_support = true,
settings = {},
},
}
end And then you can overwrite another server (such as if server_name == "solidity" then
require("lspconfig").nomic_solidity.setup({
on_attach = handler.on_attach,
-- ...
})
return
end Hope that helps! |
local lspconfig = require("lspconfig")
lspconfig.solidity.setup({
cmd = { "nomicfoundation-solidity-language-server", "--stdio" },
filetypes = { "solidity" },
root_dir = require("lspconfig.util").find_git_ancestor,
single_file_support = true,
}) This way should work as well |
Hi @ChmielewskiKamil @anajuliabit @trevorgjohnson, I've followed both the blog post, and the Mason route and can not get Following the blog-post I've checked and I could run the binary To date I've been using Any ideas? EDIT: Thanks everyone. |
Hi all. Unfortunately, the LSP is currently experimental, and since we have no plans to work on it in the near future, I'll be closing this issue. If anything changes in the meantime, we'll likely re-open this. |
Description
The LSP throws an error whenever I'm editing a .sol file. The error gets triggered every time I type a character. Restarting the LSP or reinstalling it doesn't fix the problem.
Environment
Steps to Reproduce
Open any .sol file and start typing.
Error message:
The text was updated successfully, but these errors were encountered: