Commit graph

108 commits

Author SHA1 Message Date
Sanchayan Maity 549bc29b6f
nvim: lsp: Update capabilities check
Dynamic capabilities were introduced in neovim with commit ddd92a7.

With dynamic registration of LSP capabilities, a client's `server_capabilities`
is no longer a sufficient indicator to see if a server supports a feature. We
instead need to use `client.supports_method(<method>)` which  considers both
the dynamic capabilities and static `server_capabilities`.
2023-07-11 16:08:31 +05:30
Sanchayan Maity 8db1867f30
nvim: plugins: Drop nvim-lightbulb
Drop nvim-lightbulb and just add the needed functionality. This also
fixes a minor bug where the code action detection was incorrectly
being done under codeLensProvider instead of codeActionProvider.
2023-07-06 18:26:07 +05:30
Sanchayan Maity d159850db2
nvim: lsp: inlay_hint() has been moved to vim.lsp 2023-07-01 09:14:26 +05:30
Sanchayan Maity 0265000a4f
nvim: lsp/statusline: Add support for LSP progress
Use the same timer loop for updating LSP progress in status line
which we use for updating git ahead, behind status.
2023-06-24 15:30:22 +05:30
Sanchayan Maity 9d8130d160
nvim: lsp: Minor clean up
Define functions in a consistent way through out. We like the pattern
`local function_name = function()` instead of `local function_name()`
for defining functions.
2023-06-22 12:21:42 +05:30
Sanchayan Maity 31c9213c0a
nvim: lsp: Add support for inlay hints
Make sure to disable inlay hints by default. It seems to be quite
bug ridden at the moment. However, we add a key mapping to toggle
inlay hints.
2023-06-22 12:19:30 +05:30
Sanchayan Maity 8f05d13b11
nvim: plugins: Drop inlayhints
Drop lsp-inlayhints now that upstream merged support for inlay hints.

https://github.com/neovim/neovim/pull/23984
https://github.com/neovim/neovim/pull/24071
2023-06-20 16:58:13 +05:30
Sanchayan Maity 5674bbdc06
nvim: lsp: Add support for reloading Cargo workspace
While at it, refactor the custom setup and clean up for clients in
a single function.
2023-05-25 13:41:58 +05:30
Sanchayan Maity 3987cb202b
nvim: lsp: Update completion kind symbols
This broke due to an update with the nerd-fonts package.

See related
https://www.reddit.com/r/archlinux/comments/1358gvh/switch_from_ttfnerdfontssymbols2048emmono_broke/
https://github.com/ryanoasis/nerd-fonts/issues/1190

Stole one or two icons from
https://github.com/onsails/lspkind.nvim/pull/64

and the rest fixed by nerdfix.
https://github.com/loichyan/nerdfix
2023-05-03 11:19:57 +05:30
Sanchayan Maity fe7ca593ae
nvim: lsp: Enable semantic token highlighting
This effectively reverts commit 0c9e0eb.
2023-04-12 11:14:42 +05:30
Sanchayan Maity c37a0db46a
nvim: lsp: Fix luacheck warning on setting non-standard global variable 2023-03-06 13:33:40 +05:30
Sanchayan Maity 0002d02e6c
nvim: lsp: Drop unnecessary if check 2023-03-05 00:13:28 +05:30
Sanchayan Maity 0c9e0eb164
nvim: lsp: Disable semantic token highlighting
It produces somewhat bad syntax highlighting in some cases. For example,
in typescript, the variable and it's type annotation get the same colour.
2023-01-05 09:38:26 +05:30
Sanchayan Maity f68aed5238
nvim: lsp: Add mapping for clearing code lens 2023-01-03 20:04:27 +05:30
Sanchayan Maity ac65aa26cb nvim: lsp: Use local leader for running code lens
We use <Leader>l for linting. This should have been done as part of
commit b294f19.
2022-12-12 10:11:20 +05:30
Sanchayan Maity 4d970ce70c nvim: lsp: Fix error in LspDetach
Some language servers like HLS take longer to attach and if we exit
soon before LSP attach had a chance to finish (may be?), server
capabilities field does not seem to be valid in client object and
we get the below error. Check if it valid first.

Error detected while processing LspDetach Autocommands for "*":
Error executing lua callback: /home/core/.config/nvim/lua/lsp.lua:215: attempt to index field 'server_capabilities' (a nil value)
stack traceback:
        /home/core/.config/nvim/lua/lsp.lua:215: in function </home/core/.config/nvim/lua/lsp.lua:209>
        [C]: in function 'nvim_exec_autocmds'
        /usr/local/share/nvim/runtime/lua/vim/lsp.lua:1140: in function </usr/local/share/nvim/runtime/lua/vim/lsp.lua:1139>
Error executing lua callback: /home/core/.config/nvim/lua/lsp.lua:215: attempt to index field 'server_capabilities' (a nil value)
stack traceback:
        /home/core/.config/nvim/lua/lsp.lua:215: in function </home/core/.config/nvim/lua/lsp.lua:209>
        [C]: in function 'nvim_exec_autocmds'
        /usr/local/share/nvim/runtime/lua/vim/lsp.lua:1140: in function </usr/local/share/nvim/runtime/lua/vim/lsp.lua:1139>
2022-11-29 20:26:28 +05:30
Sanchayan Maity 6d7a9fe9b3 nvim: lsp: Use vim.notify to report error 2022-10-02 17:04:25 +05:30
Sanchayan Maity 05c27960f7 nvim: lsp: Disable logging
Disable logging completely. The set_log_level call needs to be at the
top level else some log message related to startup still gets logged
if the call is done in on_attach.
2022-09-18 12:34:41 +05:30
Sanchayan Maity 4b18ecad6d nvim: Use ex commands as methods instead of string on vim.cmd 2022-09-17 10:56:51 +05:30
Sanchayan Maity b398542a94 nvim: lsp: Minor clean up of autocmd callbacks 2022-09-13 18:16:08 +05:30
Sanchayan Maity 108403ca3d nvim: lsp: Drop custom range formatting function
With commit 11167ab, vim.lsp.buf.format now has a range argument
which defaults to current selection in visual mode.
2022-09-13 18:16:08 +05:30
Sanchayan Maity 9a26ef9c10 nvim: Drop nvim-lspconfig
Use the new vim.lsp.start API and LspAttach/Detach auto commands.
Drop nvim-lspconfig in the process.

LSP server specific configuration has been taken from nvim-lspconfig.
2022-08-31 12:21:28 +05:30
Sanchayan Maity 8e8f6110e5 nvim: lsp: Fix argument ordering to on_attach for inlay hint 2022-08-29 17:35:47 +05:30
Sanchayan Maity 490fe4e853 nvim: plugins: Drop rust-tools & use lsp-inlayhints
We do not use any of the other features provided by rust-tools and
only ever needed the inlay hints. Now that there is a plugin for
that which also allows us to use inlay hints for other languages
use that.

There are two options
https://github.com/lvimuser/lsp-inlayhints.nvim
https://github.com/simrat39/inlay-hints.nvim

The second one is from the rust-tools author himself but we could
not get that to work.
2022-08-19 16:59:19 +05:30
Sanchayan Maity 1cf5377ae5 nvim: lsp: Remove obsolete flag for clangd 2022-08-06 11:41:09 +05:30
Sanchayan Maity 01dfb0429c nvim: lsp: range_code_action is deprecated
See PR
https://github.com/neovim/neovim/pull/19551
2022-08-03 14:24:58 +05:30
Sanchayan Maity 918df63073 nvim: Fix group argument to nvim_create_autocmd 2022-05-06 12:04:35 +05:30
Sanchayan Maity 363ba685aa nvim: lsp/ftplugin/rust: Remove crate graph 2022-05-06 11:25:09 +05:30
Sanchayan Maity ef00957fae nvim: lsp: Refactor configuration setting for clients 2022-05-05 21:00:25 +05:30
Sanchayan Maity 223ffe7505 nvim: lsp: Enable additionalTextEdits for completion item 2022-05-05 20:59:32 +05:30
Sanchayan Maity 211cd39138 nvim: plugins/lsp: Drop nvim-lsp-ts-utils
The plugin is in maintenance mode and typescript.nvim does not support
inlay hints. We already use eslint language server and extra commands
provided by lsp-ts-utils/typescript.nvim is something we have never
used. Just drop it.
2022-05-02 10:34:44 +05:30
Sanchayan Maity 59b1696ffa nvim: lsp: Refactor setting up of autocmd for code lens & document highlight 2022-05-02 09:33:38 +05:30
Sanchayan Maity fdc17306b7 nvim: lsp: Refactor setting up of key mappings 2022-05-02 09:33:38 +05:30
Sanchayan Maity 59c9556325 nvim: lsp: Sync with upstream
vim.lsp.buf.formatting function is deprecated and now replaces all the
below three functions with vim.lsp.buf.format.

- vim.lsp.buf.formatting
- vim.lsp.buf.formatting_sync
- vim.lsp.buf.formatting_seq_sync

client.resolved_capabilities is no longer used. One must now access
client.server_capabilities which matches the same structure as the
protocol.

https://microsoft.github.io/language-server-protocol/specification

See neovim commit c618b31.
2022-05-01 19:50:07 +05:30
Sanchayan Maity 28049ed540 nvim: lsp: Use the new auto command API 2022-03-06 14:46:27 +05:30
Sanchayan Maity 22ef882154 nvim: lsp: Enable ESLint 2022-01-21 11:28:45 +05:30
Sanchayan Maity 6744dc6004 nvim: lsp: Do not enable document highlight on CursorHoldI 2022-01-04 15:15:47 +05:30
Sanchayan Maity 96977caa81 nvim: lsp: Fix typos & symbols in LSP protocol completion item kind 2021-12-29 18:54:57 +05:30
Sanchayan Maity 6a62f22855 nvim: lsp: Lower the debounce interval 2021-12-21 09:26:36 +05:30
Sanchayan Maity 7e943ae1c5 nvim: lsp: Update Python Jedi language server configuration 2021-12-21 09:26:36 +05:30
Sanchayan Maity b7762f552d nvim: lsp: Enable text for LSP protocol completion item kind 2021-12-16 18:52:53 +05:30
Sanchayan Maity 8e0fdbdaae nvim: Drop nvim-cmp
Auto-completion has mostly been annoying than of any actual use. Just
fancy annoying crap. Just use in built omni completion.
2021-12-14 15:44:33 +05:30
Sanchayan Maity 0fbd8d256e nvim: lsp: Enable code action only when supported 2021-12-10 19:50:19 +05:30
Sanchayan Maity 1891eef80a nvim: lsp: Enable nvim-lightbulb only if code lens is available 2021-12-10 19:50:19 +05:30
Sanchayan Maity 591077efb4 nvim: Update Python related configuration 2021-12-10 14:09:12 +05:30
Sanchayan Maity b41584d996 nvim: lsp: Enable document highlight only when supported 2021-12-10 14:09:12 +05:30
Sanchayan Maity 818a34a7ff nvim: lsp: Enable flake8 & pylint for pylsp
See documentation
https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
2021-12-06 10:28:30 +05:30
Sanchayan Maity 3be8a76fe7 nvim: lsp: Drop support for lua
We had added lua-language-server thinking it would be helpful for
Wireplumber development, but, due to the nature of lua and server
itself, the experience is utter crap in comparison to using LSP in
other languages.
2021-11-28 17:53:49 +05:30
Sanchayan Maity 49cf726ce0 nvim: plugins/lsp: Drop null-ls
See the below issue
https://github.com/jose-elias-alvarez/nvim-lsp-ts-utils/issues/87

We went with null-ls because we wanted formatting with prettier. Also
null-ls was recommended by nvim-lsp-ts-utils.

The advantage of null-ls is it provides formatting and diagnostics
together in one package.

However, we will get prettier by another means and for linting switch to
nvim-lint.
2021-11-28 17:53:42 +05:30
Sanchayan Maity 6ead0d94a7 nvim: lsp: Fix missing capabilities for tsserver
We missed setting this when enabling inlay hints.
2021-11-20 17:00:14 +05:30