https://github.com/chrisgrieser/nvim-lsp-endhints

Display LSP inlay hints at the end of the line, rather than within the line.

https://github.com/chrisgrieser/nvim-lsp-endhints

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: researchgate.net
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

inlay-hints lsp-inlayhint neovim-plugin nvim-plugin

Keywords from Contributors

archival projection alfred-workflow pdf-summarization reference-management interactive generic sequences observability autograding
Last synced: 5 months ago · JSON representation

Repository

Display LSP inlay hints at the end of the line, rather than within the line.

Basic Info
  • Host: GitHub
  • Owner: chrisgrieser
  • License: mit
  • Language: Lua
  • Default Branch: main
  • Homepage:
  • Size: 85 KB
Statistics
  • Stars: 197
  • Watchers: 1
  • Forks: 6
  • Open Issues: 0
  • Releases: 0
Topics
inlay-hints lsp-inlayhint neovim-plugin nvim-plugin
Created over 1 year ago · Last pushed 6 months ago
Metadata Files
Readme Funding License

README.md

nvim-lsp-endhints 🪧

badge

Minimal plugin that displays LSP inlay hints at the end of the line, rather than within the line.

Showcase

Color scheme: nightfox.nvim, dawnfox variant

Table of Contents

Installation

Requirements - nvim 0.10+ - LSP client supports inlay hints (textDocument/inlayHint) - Inlay hints enabled in the config of the LSP

```lua -- lazy.nvim { "chrisgrieser/nvim-lsp-endhints", event = "LspAttach", opts = {}, -- required, even if empty },

-- packer use { "chrisgrieser/nvim-lsp-endhints", config = function() require("lsp-endhints").setup() -- required, even if empty end, } ```

Configuration

The .setup() call is required.

lua -- default settings require("lsp-endhints").setup { icons = { type = "󰜁 ", parameter = "󰏪 ", offspec = " ", -- hint kind not defined in official LSP spec unknown = " ", -- hint kind is nil }, label = { truncateAtChars = 20, padding = 1, marginLeft = 0, sameKindSeparator = ", ", }, extmark = { priority = 50, }, autoEnableHints = true, }

The hints use the default highlight group LspInlayHint.

Usage

By default, the plugin automatically enables inlay hints when attaching to an LSP, there is nothing to do other than loading the plugin.

All regular inlay hint functions like vim.lsp.inlay_hint.enable() work the same as before. Use them as described in the Neovim documentation to enable/disable/toggle hints manually.

You can switch between displaying inlay hints at the end of the line (this plugin) and within the line (Neovim default) by using the enable, disable and toggle functions:

```lua -- inlay hints will show at the end of the line (default) require("lsp-endhints").enable()

-- inlay hints will show as if the plugin was not installed require("lsp-endhints").disable()

-- toggle between the two require("lsp-endhints").toggle() ```

Background

FAQ

How to display hints only for the current line?

That is not supported by the plugin. However, it only takes a small snippet to implement it yourself. (Note that the linked snippet is not compatible with this plugin.)

Compatibility with other inlay hints plugins

Since this plugin overrides the nvim handler for "textDocument/inlayHint", other plugins that interact with inlay hints may be incompatible with it, and there is likely little there can be done about it.

However, if the other plugin is using specific commands related to inlay hints rather than permanently displaying them like nvim-lsp-endhints, you can temporarily disable endhints, trigger the other plugin, and then re-enable endhints. Binding that to a custom function should allow you to use the other plugin without issues then.

How to enable inlay hints for a language?

[!NOTE] Not all LSPs support inlay hints. The following list is not exhaustive, there are more LSPs that support inlay hints. Please refer to your LSP's documentation.

```lua -- lua-ls require("lspconfig").lua_ls.setup { settings = { Lua = { hint = { enable = true }, }, }, }

-- tsserver local inlayHints = { includeInlayParameterNameHints = "all", includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayFunctionParameterTypeHints = true, includeInlayVariableTypeHints = true, includeInlayVariableTypeHintsWhenTypeMatchesName = false, includeInlayPropertyDeclarationTypeHints = true, includeInlayFunctionLikeReturnTypeHints = true, includeInlayEnumMemberValueHints = true, } require("lspconfig").tsserver.setup { settings = { typescript = { inlayHints = inlayHints, }, javascript = { inlayHints = inlayHints, }, }, }

-- gopls require("lspconfig").gopls.setup { settings = { hints = { rangeVariableTypes = true, parameterNames = true, constantValues = true, assignVariableTypes = true, compositeLiteralFields = true, compositeLiteralTypes = true, functionTypeParameters = true, }, }, }

-- clangd require("lspconfig").clangd.setup { settings = { clangd = { InlayHints = { Designators = true, Enabled = true, ParameterNames = true, DeducedTypes = true, }, fallbackFlags = { "-std=c++20" }, }, }, } ```

About the author

In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.

Buy Me a Coffee at ko-fi.com

Owner

  • Name: Chris Grieser
  • Login: chrisgrieser
  • Kind: user
  • Location: Berlin, Germany
  • Company: Technical University of Berlin

Researcher in sociology & software developer

GitHub Events

Total
  • Issues event: 10
  • Watch event: 89
  • Delete event: 4
  • Issue comment event: 13
  • Push event: 32
  • Pull request event: 10
  • Fork event: 3
  • Create event: 3
Last Year
  • Issues event: 10
  • Watch event: 89
  • Delete event: 4
  • Issue comment event: 13
  • Push event: 32
  • Pull request event: 10
  • Fork event: 3
  • Create event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 99
  • Total Committers: 4
  • Avg Commits per committer: 24.75
  • Development Distribution Score (DDS): 0.04
Past Year
  • Commits: 99
  • Committers: 4
  • Avg Commits per committer: 24.75
  • Development Distribution Score (DDS): 0.04
Top Committers
Name Email Commits
Chris Grieser 7****r 95
dependabot[bot] 4****] 2
vxpm v****m@g****m 1
Mateus Melchiades m****e@d****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 11
  • Total pull requests: 6
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 2 days
  • Total issue authors: 11
  • Total pull request authors: 4
  • Average comments per issue: 2.27
  • Average comments per pull request: 1.67
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 11
  • Pull requests: 6
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 2 days
  • Issue authors: 11
  • Pull request authors: 4
  • Average comments per issue: 2.27
  • Average comments per pull request: 1.67
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • Wppopqpu (1)
  • julien-h (1)
  • FelipeLema (1)
  • vxpm (1)
  • Davidyz (1)
  • al-ce (1)
  • ford-prefect (1)
  • samyarkd (1)
  • druskus20 (1)
  • catgoose (1)
  • vunhatchuong (1)
Pull Request Authors
  • dependabot[bot] (7)
  • Tdback (2)
  • vxpm (2)
  • matbme (2)
Top Labels
Issue Labels
bug (5) enhancement (4)
Pull Request Labels
dependencies (7) github_actions (5)

Dependencies

.github/workflows/nvim-typecheck.yml actions
  • actions/checkout v4 composite
  • stevearc/nvim-typecheck-action v2 composite
.github/workflows/panvimdoc.yml actions
  • actions/checkout v4 composite
  • kdheepak/panvimdoc main composite
  • stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/semantic-pr-title.yml actions
  • amannn/action-semantic-pull-request v5 composite
.github/workflows/stale-bot.yml actions
  • actions/stale v8 composite
.github/workflows/stylua.yml actions
  • JohnnyMorganz/stylua-action v4 composite
  • actions/checkout v4 composite
  • stefanzweifel/git-auto-commit-action v4 composite