-
Notifications
You must be signed in to change notification settings - Fork 93
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
Error in Neovim: “attempt to compare string with number” #609
Comments
It sounds like an issue of lintr reporting the row number and column number: https://github.com/REditorSupport/languageserver/blob/master/R/diagnostics.R#L17 We may need to check if the numbers are NAs? |
Are you able to reproduce the issue? Otherwise I am happy to patch my local ‘languageserver’ version with instrumentation code. Unfortunately I know absolutely nothing about the Lua/client side of things. |
It has been a while since I used neovim and it seems that neovim supports LSP officially. Could you share how you configure neovim to setup R languageserver? |
Here’s a minimal configuration (the config is macOS but on a Linux system using the path cat ~/Library/Preferences/nvim/init.lua vim.opt.runtimepath:append('~/Library/Preferences/nvim/mason.nvim')
vim.opt.runtimepath:append('~/Library/Preferences/nvim/nvim-lspconfig')
require('mason').setup()
require('lspconfig').r_language_server.setup{} Afterwards, do the following inside the nvim config path to initialise the LSP support plugins: git clone --depth 1 [email protected]:williamboman/mason.nvim.git
git clone --depth 1 [email protected]:neovim/nvim-lspconfig.git
nvim +:MasonInstall\ r-languageserver And restart Neovim afterwards. … in theory these plugins are not necessary but in practice the manual nvim LSP configuration is so complicated that it is recommended to use these plugins. |
Hi, I went ahead and locally modified languageserver/R/diagnostics.R Line 28 in adc2189
result == structure(
list(
filename = "/path/to/test.r",
line_number = 2L,
column_number = 0L,
type = "style",
message = "Indentation should be 4 spaces but is 0 spaces.",
line = "b = 2",
ranges = list(c(0L, 4L)),
linter = "indentation_linter"
),
class = c("lint", "list")
)
text == "b = 2"
cols == c(4, NA) So there’s a |
If vim.opt.runtimepath:append('~/Library/Preferences/nvim/nvim-lspconfig')
require('lspconfig').r_language_server.setup{} remember There's no need to use mason to install r-language-server |
with neovim 0.9, I can't reproduce the problem. I guess maybe neovim 0.9 has improved the robustness of error handling. In fact if you go to the source code of in the latest commit of neovim the function
|
@milanglacier I am running nvim v0.9.0 and I can still reproduce this bug. The line numbers in the stack trace did change slightly, but the line number now is not 396, it’s 406:
|
Sadly, the same error occurred for me today, even after applying the #614 patch. |
Replaced `nvim-lsp-installer` with `mason`. Try to clean up `lsp` config. Disabled `r_language_server` for now until an error gets fixed. <REditorSupport/languageserver#609>
Based on the error stack traceback, this is related to #481. Unfortunately #565 did not fix it, and the error persists in the current HEAD revision (adc2189).
To reproduce the issue, create a file containing the following and open it in Neovim with LSP configured to use ‘languageserver’:
Here’s the full error message:
The text was updated successfully, but these errors were encountered: