Closed mawkler closed 2 years ago
Hello! Cool! Could you give the branch add-grammarly
(#349) a try? It seems fine to me, but the server seems pretty prone to spitting out errors - not sure if that's an issue with my local config or with the installation itself.
I decided to go with the unofficial npm package because this plugin is very much anchored to lspconfig (and the server config in lspconfig was based on that distribution).
Thanks for looking into this so quickly! I get this huge error message when the server starts:
And after closing that error message I get the following error message repeatadly whenever I try to do anything in Neovim:
Error executing luv callback:
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:556: cannot resume dead coroutine
stack traceback:
[C]: in function 'request_parser'
/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:556: in function </usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:545>
It also filled my ~/.cache/nvim/dap.log
with multiple gigabytes lol.
This is the minimal config that I'm using:
call plug#begin('~/.config/nvim/packages/')
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer', {'branch': 'add-grammarly'} " Adds LspInstall command
call plug#end()
lua << EOF
local function make_config()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
return {
capabilities = capabilities,
}
end
require('nvim-lsp-installer').on_server_ready(function(server)
local config = make_config()
server:setup(config)
end)
EOF
Hello! I'm the author of the PR for server on the lspconfig repo, and I happened to run into the same issue an hour or two ago, though I hadn't run into it before while working on the PR. From what I can tell, this is happening because the server itself is sending an invalid header in one of its responses. Are you able to share the raw file this happens with? For me it only occurs with a single file out of the dozens I've tested, and haven't figured out what makes it unique yet.
As for the huge logs, the server does print quite a few debug messages by default, I'm not sure if there's a way to change the verbosity of those logs, but I'll look into it.
This seemed to happen in all markdown files, take this repo's README for example.
Ok, I was able to reproduce that too, just to verify that we are both dealing with the exact same issue (if you have time), can you see what happens if you open this version of the README: README.md which has all of its HTML tags removed?
Just stopping by to say that I also got some errors with grammarly. I tried to open the README you specified, and it worked fine for me! I got my error when trying to open a README from a plugin I wrote. https://github.com/seblj/nvim-tabline/blob/master/README.md
In my example it has something to do with line number 5 (the line with the gif). If I remove that line, I don't get an error
@mtoohey31
Thank you for sharing @seblj, I thought it had something to do with HTML tags, but after playing around, it seems like the offending text is anything containing the word: content
. The section of text that originally triggered it for me was: Web Content Accessibility Guidelines 2.0
. I'm pretty sure this is a bug in the way the server is sending one of its requests on startup, because if you remove the word content, attach the server, then add the word back, there are no errors.
I'll open an issue on the upstream repo instead of the emacs fork, since I tested with the upstream version and it has the bug too. I might try taking a look into the server code too, I probably won't be able to figure anything out though.
Actually, on second thought, I'm not going to open an issue quite yet, I'd like to dig around and confirm that the issue is actually the server's request/response and not the way Neovim is handling things.
Glad I could be of help! Thanks for your work!
can you see what happens if you open this version of the README: README.md which has all of its HTML tags removed?
That version of the README is not crashing it! Diagnostics are working, but I'm getting method workspace/executeCommand is not supported by any of the servers registered for the current buffer
when trying to execute code actions (it does seem to apply the code action though, at least 60%1 of the time)
1 - very unscientific number
Somewhat OT, but: I get the feeling like the server relies on quite a lot of non-spec functionalities? The in-spec LSP functionalities seem quite.. basic? The diagnostics are pretty exhaustive, but they provide no detailed explanations or useful code actions - is this provided through other non-spec commands?
Yes, that's an accurate assessment. The configs on the nvim-lspconfig repo are supposed to be kept pretty minimal, but there are additional features that could be supported through proper implementation of off-spec handlers in a plugin. I left a few notes about those features at the end of the PR conversation on the nvim-lspconfig repo.
Hey @melkster and @williamboman ,
I have installed gramamrly
how do I see the results of linting?
According to LspInfo
the module is loaded.
I believe diagnostics should generally work out of the box, I can't recall if you actually have to configure something. As for code actions, you can bind <cmd>lua vim.lsp.buf.code_action()<CR>
to a key (or run it manually). I'd personally recommend https://github.com/stevearc/dressing.nvim + telescope for getting a nicer UI for the code action picker
@williamboman , I will take a look at the mentioned plugging but running lua vim.lsp.buf.code_action()
returns No code actions available
. Also, there are some configurations available, is there a way to set them via neovim?
I'd recommend checking out the Neovim from scratch series, especially this video about LSP: https://www.youtube.com/watch?v=NXysez2vS4Q. Btw when you run vim.lsp.buf.code_action()
, it will only return something if the cursor position is at a location where there is a code action (see :h vim.lsp.buf.code_action
for more info on how it works).
@williamboman , I believe I do have a general intuition of how Neovim and LSP work.
I took the example from the original repository and code_action()
ed on each word in the following sentence I got grammarly work in code.
, there are no code actions available, note that Grammarly shows warnings and suggestions for this sentence.
Hm weird. It works fine for me:
https://user-images.githubusercontent.com/6705160/148376664-bd70cf4c-1087-4962-b016-070ad147eb4f.mov
There are some extra, non-standard, functionalities that is not covered (see https://github.com/neovim/nvim-lspconfig/pull/1562#issuecomment-997485554). But diagnostics and code actions should be good to go!
For you, it works out of the box, this is super strange! I have copied the config from the README but maybe I miss something... If you have energy for this, I'd be very grateful if you could take a look at it: https://github.com/f-squirrel/scripts/blob/vim_lsp/dotfiles/vim/init.vim#L440
Version info:
NVIM v0.6.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az65-618
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
Run :checkhealth for more info
Thank you for sharing @seblj, I thought it had something to do with HTML tags, but after playing around, it seems like the offending text is anything containing the word:
content
. The section of text that originally triggered it for me was:Web Content Accessibility Guidelines 2.0
. I'm pretty sure this is a bug in the way the server is sending one of its requests on startup, because if you remove the word content, attach the server, then add the word back, there are no errors.I'll open an issue on the upstream repo instead of the emacs fork, since I tested with the upstream version and it has the bug too. I might try taking a look into the server code too, I probably won't be able to figure anything out though.
I can confirm this, I only get errors if the word content
is present.
Yes. This error is trigger by the content
word.
Which server would you like to request to be added?
Which languages does this server target?
asciidoc
,git-commit
,git-rebase
,json
,latex
,markdown
,mdx
,plaintext
,restructuredtext
, according to this file.How is this server distributed?