https://github.com/askfiy/lsp_extra_dim
Dim unused parameters from neovim..
https://github.com/askfiy/lsp_extra_dim
Last synced: 11 months ago
JSON representation
Dim unused parameters from neovim..
- Host: GitHub
- URL: https://github.com/askfiy/lsp_extra_dim
- Owner: askfiy
- License: mpl-2.0
- Created: 2023-03-15T16:45:09.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-07T02:31:00.000Z (over 2 years ago)
- Last Synced: 2024-08-10T15:40:32.645Z (almost 2 years ago)
- Language: Lua
- Size: 201 KB
- Stars: 19
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# README
## INTRODUCTION
`lsp_extra_dim` is a `neovim` plugin written 100% in `lua`. Aims to provide dimmed styles for some unused `variables`, `functions`, `parameters` and disable `Lsp Diagnostic Style`

He is inspired by [neodim](https://github.com/zbirenbaum/neodim) and [dim](https://github.com/0oAstro/dim.lua). But with some cool features.
## USE
From lazy.nvim:
```lua
{
"askfiy/lsp_extra_dim",
event = { "LspAttach" },
config = function ()
require("lsp_extra_dim").setup()
end
}
```
## CONFIG
The configurations that can be passed in setup are:
```lua
return {
hooks = {
-- see: README/CONCEPT
-- after the default filter function runs, the following hook function will be executed
lsp_filter = function(diagnostics)
-- get all used diagnostics
return diagnostics
end,
},
-- disable diagnostic styling while dimming the colors?
--------------------------------------
-- {} : do not disable any diagnostic styles
-- "all" : disable all diagnostic styles
-- { "parameter", "function", "keyword.function"} : only disable diagnostic styles for specific captures
--------------------------------------
-- see `https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md`
disable_diagnostic_style = "all",
-- customize different files for different file types disable_diagnostic_style
filetype_options = {
-- python = {
-- disable_diagnostic_style = {
-- "parameter",
-- "type"
-- }
-- }
},
}
```
## CONCEPT
This is a plugin to disable unused extra style in LSP The implementation method is very simple:
- 1. Customize the vim.diagnostic.handlers[signs|virtual_text].show method
- 2. Override the show method of handlers other than underline, Filtering out unused resources
- 3. Underline's show method will still dim them, but other handler's show methods will disable hints such as dummy text
So, he has 1 filtering steps:
- 1. Screening on `lsp diagnostic` level
Filtering at `lsp diagnostic` level will remove all diagnostics containing `unused` (but some diagnostics that qualify in `disable_diagnostic_style` will be kept)
In the configuration of `setup`, `lsp_filter` are the hook functions defined after the default filter function runs.
## CASE
Disable all diagnostic styles:

--snippet--
```lua
config = function ()
require("lsp_extra_dim").setup({
disable_diagnostic_style = "all"
})
```
Do not disable any diagnostic styles:

--snippet--
```lua
config = function ()
require("lsp_extra_dim").setup({
disable_diagnostic_style = {}
})
```
Disable diagnostic style for function arguments only:

--snippet--
```lua
config = function ()
require("lsp_extra_dim").setup({
disable_diagnostic_style = {
"parameter"
}
})
```