{"id":13524981,"url":"https://github.com/chrisgrieser/nvim-lsp-endhints","last_synced_at":"2025-10-10T00:46:00.392Z","repository":{"id":246776924,"uuid":"822152723","full_name":"chrisgrieser/nvim-lsp-endhints","owner":"chrisgrieser","description":"Display LSP inlay hints at the end of the line, rather than within the line.","archived":false,"fork":false,"pushed_at":"2025-03-25T13:03:06.000Z","size":68,"stargazers_count":162,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T02:03:22.610Z","etag":null,"topics":["inlay-hints","lsp-inlayhint","neovim-plugin","nvim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisgrieser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.paypal.me/ChrisGrieser","ko_fi":"pseudometa"}},"created_at":"2024-06-30T12:27:25.000Z","updated_at":"2025-03-28T15:45:31.000Z","dependencies_parsed_at":"2024-08-29T17:14:58.584Z","dependency_job_id":"67eff46b-3426-44fc-874c-e2a7dc4f79ed","html_url":"https://github.com/chrisgrieser/nvim-lsp-endhints","commit_stats":{"total_commits":68,"total_committers":3,"mean_commits":"22.666666666666668","dds":0.02941176470588236,"last_synced_commit":"391ef40521b631a8a2fb7aef78db6967ead6b39d"},"previous_names":["chrisgrieser/nvim-eol-lsp-hints"],"tags_count":0,"template":false,"template_full_name":"chrisgrieser/nvim-pseudometa-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-lsp-endhints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-lsp-endhints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-lsp-endhints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-lsp-endhints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisgrieser","download_url":"https://codeload.github.com/chrisgrieser/nvim-lsp-endhints/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280262,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inlay-hints","lsp-inlayhint","neovim-plugin","nvim-plugin"],"created_at":"2024-08-01T06:01:15.094Z","updated_at":"2025-10-10T00:46:00.383Z","avatar_url":"https://github.com/chrisgrieser.png","language":"Lua","funding_links":["https://www.paypal.me/ChrisGrieser","https://ko-fi.com/pseudometa","https://ko-fi.com/Y8Y86SQ91'"],"categories":["LSP","Lua"],"sub_categories":["(requires Neovim 0.5)"],"readme":"\u003c!-- LTeX: enabled=false --\u003e\n# nvim-lsp-endhints 🪧\n\u003c!-- LTeX: enabled=true --\u003e\n\u003ca href=\"https://dotfyle.com/plugins/chrisgrieser/nvim-lsp-endhints\"\u003e\n\u003cimg alt=\"badge\" src=\"https://dotfyle.com/plugins/chrisgrieser/nvim-lsp-endhints/shield\"/\u003e\u003c/a\u003e\n\nMinimal plugin that displays LSP inlay hints at the end of the line, rather than\nwithin the line.\n\n\u003cimg alt=\"Showcase\" width=70% src=\"https://github.com/chrisgrieser/nvim-lsp-endhints/assets/73286100/57894d2f-2c82-4e42-b1e3-ab103c928020\"\u003e\n\n*Color scheme: nightfox.nvim, dawnfox variant*\n\n## Table of Contents\n\n\u003c!-- toc --\u003e\n\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Background](#background)\n- [FAQ](#faq)\n\t* [How to display hints only for the current line?](#how-to-display-hints-only-for-the-current-line)\n\t* [Compatibility with other inlay hints plugins](#compatibility-with-other-inlay-hints-plugins)\n\t* [How to enable inlay hints for a language?](#how-to-enable-inlay-hints-for-a-language)\n- [About the author](#about-the-author)\n\n\u003c!-- tocstop --\u003e\n\n## Installation\n**Requirements**\n- nvim 0.10+\n- LSP client supports inlay hints (`textDocument/inlayHint`)\n- Inlay hints enabled in the config of the LSP\n\n```lua\n-- lazy.nvim\n{\n\t\"chrisgrieser/nvim-lsp-endhints\",\n\tevent = \"LspAttach\",\n\topts = {}, -- required, even if empty\n},\n\n-- packer\nuse {\n\t\"chrisgrieser/nvim-lsp-endhints\",\n\tconfig = function()\n\t\trequire(\"lsp-endhints\").setup() -- required, even if empty\n\tend,\n}\n```\n\n## Configuration\nThe `.setup()` call is required.\n\n```lua\n-- default settings\nrequire(\"lsp-endhints\").setup {\n\ticons = {\n\t\ttype = \"󰜁 \",\n\t\tparameter = \"󰏪 \",\n\t\toffspec = \" \", -- hint kind not defined in official LSP spec\n\t\tunknown = \" \", -- hint kind is nil\n\t},\n\tlabel = {\n\t\ttruncateAtChars = 20,\n\t\tpadding = 1,\n\t\tmarginLeft = 0,\n\t\tsameKindSeparator = \", \",\n\t},\n\textmark = {\n\t\tpriority = 50,\n\t},\n\tautoEnableHints = true,\n}\n```\n\nThe hints use the default highlight group `LspInlayHint`.\n\n## Usage\nBy default, the plugin automatically enables inlay hints when attaching to an\nLSP, there is nothing to do other than loading the plugin.\n\nAll regular inlay hint functions like `vim.lsp.inlay_hint.enable()` work the\nsame as before. Use them [as described in the Neovim\ndocumentation](https://neovim.io/doc/user/lsp.html#vim.lsp.inlay_hint.enable())\nto enable/disable/toggle hints manually.\n\nYou can switch between displaying inlay hints at the end of the line (this plugin)\nand within the line (Neovim default) by using the `enable`, `disable` and `toggle`\nfunctions:\n\n```lua\n-- inlay hints will show at the end of the line (default)\nrequire(\"lsp-endhints\").enable()\n\n-- inlay hints will show as if the plugin was not installed\nrequire(\"lsp-endhints\").disable()\n\n-- toggle between the two\nrequire(\"lsp-endhints\").toggle()\n```\n\n## Background\n- [The LSP specification stipulates that inlay hints have a fixed position in\n  the line, which Neovim core follows.](https://github.com/neovim/neovim/issues/28261#issuecomment-2194659088)\n- However, for many people, hints being positioned within the line disturbs the\n  flow of vim motions. This is particularly troublesome for languages with long\n  type hints, such as TypeScript.\n- [nvim-inlayhint](https://github.com/lvimuser/lsp-inlayhints.nvim) did pretty\n  much the same thing for nvim \u003c 0.10, but it is archived by now. Other than\n  being maintained, `nvim-lsp-endhints` just overrides the\n  `textDocument/inlayHint` handler introduced in nvim 0.10, resulting in a much\n  simpler and more maintainable implementation (~250 LoC instead of ~1000 LoC).\n\n## FAQ\n\n### How to display hints only for the current line?\nThat is not supported by the plugin. However, [it only takes a small snippet to\nimplement it\nyourself.](https://github.com/neovim/neovim/issues/28261#issuecomment-2130338921)\n(Note that the linked snippet is not compatible with this plugin.)\n\n### Compatibility with other inlay hints plugins\nSince this plugin overrides the nvim handler for `\"textDocument/inlayHint\"`,\nother plugins that interact with inlay hints may be incompatible with it, and\nthere is likely little there can be done about it.\n\nHowever, if the other plugin is using specific commands related to inlay hints\nrather than permanently displaying them like `nvim-lsp-endhints`, you can\ntemporarily disable `endhints`, trigger the other plugin, and then re-enable\n`endhints`. Binding that to a custom function should allow you to use the other\nplugin without issues then.\n\n### How to enable inlay hints for a language?\n\n\u003e [!NOTE]\n\u003e Not all LSPs support inlay hints. The following list is not exhaustive,\n\u003e there are more LSPs that support inlay hints. Please refer to your LSP's\n\u003e documentation.\n\n```lua\n-- lua-ls\nrequire(\"lspconfig\").lua_ls.setup {\n\tsettings = {\n\t\tLua = {\n\t\t\thint = { enable = true },\n\t\t},\n\t},\n}\n\n-- tsserver\nlocal inlayHints = {\n\tincludeInlayParameterNameHints = \"all\",\n\tincludeInlayParameterNameHintsWhenArgumentMatchesName = false,\n\tincludeInlayFunctionParameterTypeHints = true,\n\tincludeInlayVariableTypeHints = true,\n\tincludeInlayVariableTypeHintsWhenTypeMatchesName = false,\n\tincludeInlayPropertyDeclarationTypeHints = true,\n\tincludeInlayFunctionLikeReturnTypeHints = true,\n\tincludeInlayEnumMemberValueHints = true,\n}\nrequire(\"lspconfig\").tsserver.setup {\n\tsettings = {\n\t\ttypescript = {\n\t\t\tinlayHints = inlayHints,\n\t\t},\n\t\tjavascript = {\n\t\t\tinlayHints = inlayHints,\n\t\t},\n\t},\n}\n\n-- gopls\nrequire(\"lspconfig\").gopls.setup {\n\tsettings = {\n\t\thints = {\n\t\t\trangeVariableTypes = true,\n\t\t\tparameterNames = true,\n\t\t\tconstantValues = true,\n\t\t\tassignVariableTypes = true,\n\t\t\tcompositeLiteralFields = true,\n\t\t\tcompositeLiteralTypes = true,\n\t\t\tfunctionTypeParameters = true,\n\t\t},\n\t},\n}\n\n-- clangd\nrequire(\"lspconfig\").clangd.setup {\n\tsettings = {\n\t\tclangd = {\n\t\t\tInlayHints = {\n\t\t\t\tDesignators = true,\n\t\t\t\tEnabled = true,\n\t\t\t\tParameterNames = true,\n\t\t\t\tDeducedTypes = true,\n\t\t\t},\n\t\t\tfallbackFlags = { \"-std=c++20\" },\n\t\t},\n\t},\n}\n```\n\n## About the author\nIn my day job, I am a sociologist studying the social mechanisms underlying the\ndigital economy. For my PhD project, I investigate the governance of the app\neconomy and how software ecosystems manage the tension between innovation and\ncompatibility. If you are interested in this subject, feel free to get in touch.\n\n- [Website](https://chris-grieser.de/)\n- [Mastodon](https://pkm.social/@pseudometa)\n- [ResearchGate](https://www.researchgate.net/profile/Christopher-Grieser)\n- [LinkedIn](https://www.linkedin.com/in/christopher-grieser-ba693b17a/)\n\n\u003ca href='https://ko-fi.com/Y8Y86SQ91' target='_blank'\u003e\u003cimg height='36'\nstyle='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'\nborder='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-lsp-endhints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisgrieser%2Fnvim-lsp-endhints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-lsp-endhints/lists"}