mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	Merge pull request #794 from venkyr77/inlay-hint-support
lsp: add inlayHints support
This commit is contained in:
		
				commit
				
					
						0fc84ed868
					
				
			
		
					 3 changed files with 24 additions and 0 deletions
				
			
		|  | @ -300,6 +300,7 @@ | ||||||
| - Add neo-tree integration for Bufferline. | - Add neo-tree integration for Bufferline. | ||||||
| - Add more applicable filetypes to illuminate denylist. | - Add more applicable filetypes to illuminate denylist. | ||||||
| - Disable mini.indentscope for applicable filetypes. | - Disable mini.indentscope for applicable filetypes. | ||||||
|  | - Enable inlay hints support - `config.vim.lsp.inlayHints`. | ||||||
| 
 | 
 | ||||||
| [tebuevd](https://github.com/tebuevd): | [tebuevd](https://github.com/tebuevd): | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
|   pkgs, |   pkgs, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|  |   inherit (lib.generators) mkLuaInline; | ||||||
|   inherit (lib.modules) mkIf; |   inherit (lib.modules) mkIf; | ||||||
|   inherit (lib.strings) optionalString; |   inherit (lib.strings) optionalString; | ||||||
|   inherit (lib.trivial) boolToString; |   inherit (lib.trivial) boolToString; | ||||||
|  | @ -28,6 +29,25 @@ in { | ||||||
|         sourcePlugins = ["cmp-nvim-lsp"]; |         sourcePlugins = ["cmp-nvim-lsp"]; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|  |       autocmds = | ||||||
|  |         if cfg.inlayHints.enable | ||||||
|  |         then [ | ||||||
|  |           { | ||||||
|  |             callback = mkLuaInline '' | ||||||
|  |               function(event) | ||||||
|  |                 local bufnr = event.buf | ||||||
|  |                 local client = vim.lsp.get_client_by_id(event.data.client_id) | ||||||
|  |                 if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then | ||||||
|  |                   vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) | ||||||
|  |                 end | ||||||
|  |               end | ||||||
|  |             ''; | ||||||
|  |             desc = "LSP on-attach enable inlay hints autocmd"; | ||||||
|  |             event = ["LspAttach"]; | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |         else []; | ||||||
|  | 
 | ||||||
|       pluginRC.lsp-setup = '' |       pluginRC.lsp-setup = '' | ||||||
|         vim.g.formatsave = ${boolToString cfg.formatOnSave}; |         vim.g.formatsave = ${boolToString cfg.formatOnSave}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,6 +5,9 @@ in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; |     enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; | ||||||
|     formatOnSave = mkEnableOption "format on save"; |     formatOnSave = mkEnableOption "format on save"; | ||||||
|  |     inlayHints = { | ||||||
|  |       enable = mkEnableOption "inlay hints"; | ||||||
|  |     }; | ||||||
|     mappings = { |     mappings = { | ||||||
|       goToDefinition = |       goToDefinition = | ||||||
|         mkMappingOption "Go to definition" |         mkMappingOption "Go to definition" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 GitHub
					GitHub