Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simrat39/inlay-hints.nvim
almost not wip
https://github.com/simrat39/inlay-hints.nvim
Last synced: 3 months ago
JSON representation
almost not wip
- Host: GitHub
- URL: https://github.com/simrat39/inlay-hints.nvim
- Owner: simrat39
- Created: 2022-07-26T23:48:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-30T13:31:17.000Z (about 1 year ago)
- Last Synced: 2024-06-17T17:12:16.525Z (5 months ago)
- Language: Lua
- Homepage:
- Size: 54.7 KB
- Stars: 156
- Watchers: 7
- Forks: 8
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# inlay-hints.nvim
Neovim support for LSP Inlay Hints
## Prerequisites
- `neovim 0.7+`
## Installation
using `packer.nvim`
```lua
use('simrat39/inlay-hints.nvim')
```Look at the configuration information below to get started.
## Setup
Put this in your init.lua or any lua file that is sourced.
```lua
require("inlay-hints").setup()
```## Config
Pass a table to the setup call above with your configuration options.
For example:
```lua
require("inlay-hints").setup({
only_current_line = true,eol = {
right_align = true,
}
})
```
Take a look at all the possible configuration options [here](https://github.com/simrat39/inlay-hints.nvim/blob/main/lua/inlay-hints/config.lua#L3)## Usage
The plugin hooks itself to the on_attach callback of an LSP Server. Some servers might need extra configuration to enable inlay hints. See the examples below to get started.
### w/ sumneko_lua
```lua
local ih = require("inlay-hints")
local lspconfig = require("lspconfig")lspconfig.sumneko_lua.setup({
on_attach = function(c, b)
ih.on_attach(c, b)
end,
settings = {
Lua = {
hint = {
enable = true,
},
},
},
})
```### w/ rust-tools.nvim
```lua
local ih = require("inlay-hints")require("rust-tools").setup({
tools = {
on_initialized = function()
ih.set_all()
end,
inlay_hints = {
auto = false,
},
},
server = {
on_attach = function(c, b)
ih.on_attach(c, b)
end,
},
})
```### w/ tsserver
```lua
local ih = require("inlay-hints")
local lspconfig = require("lspconfig")lspconfig.tsserver.setup({
on_attach = function(c, b)
ih.on_attach(c, b)
end,
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = "all", -- 'none' | 'literals' | 'all';
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
},
})
```### w/ gopls
```lua
local ih = require("inlay-hints")
local lspconfig = require("lspconfig")lspconfig.gopls.setup({
on_attach = function(c, b)
ih.on_attach(c, b)
end,
settings = {
gopls = {
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
},
},
})```