mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	feat(treesitter): add :InspectTree command (#22477)
This commit is contained in:
		| @@ -89,8 +89,9 @@ The following new APIs or features were added. | ||||
|  | ||||
|   See |lsp-semantic_tokens| for more information. | ||||
|  | ||||
| • |vim.treesitter.inspect_tree()| opens a split window showing a text | ||||
|   representation of the nodes in a language tree for the current buffer. | ||||
| • |vim.treesitter.inspect_tree()| and |:InspectTree| opens a split window | ||||
|   showing a text representation of the nodes in a language tree for the current | ||||
|   buffer. | ||||
|  | ||||
| • Added support for the `willSave` and `willSaveWaitUntil` capabilities to the | ||||
|   LSP client. `willSaveWaitUntil` allows a server to modify a document before it | ||||
|   | ||||
| @@ -603,6 +603,8 @@ inspect_tree({opts})                           *vim.treesitter.inspect_tree()* | ||||
|     to toggle the display of the source language of each node, and press | ||||
|     <Enter> to jump to the node under the cursor in the source buffer. | ||||
|  | ||||
|     Can also be shown with `:InspectTree`.                      *:InspectTree* | ||||
|  | ||||
|     Parameters: ~ | ||||
|       • {opts}  (table|nil) Optional options table with the following possible | ||||
|                 keys: | ||||
|   | ||||
| @@ -424,6 +424,8 @@ end | ||||
| --- display of the source language of each node, and press <Enter> to jump to the node under the | ||||
| --- cursor in the source buffer. | ||||
| --- | ||||
| --- Can also be shown with `:InspectTree`. *:InspectTree* | ||||
| --- | ||||
| ---@param opts table|nil Optional options table with the following possible keys: | ||||
| ---                      - lang (string|nil): The language of the source buffer. If omitted, the | ||||
| ---                        filetype of the source buffer is used. | ||||
|   | ||||
| @@ -5,3 +5,7 @@ vim.api.nvim_create_user_command('Inspect', function(cmd) | ||||
|     vim.show_pos() | ||||
|   end | ||||
| end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true }) | ||||
|  | ||||
| vim.api.nvim_create_user_command('InspectTree', function() | ||||
|   vim.treesitter.inspect_tree() | ||||
| end, { desc = 'Inspect treesitter language tree for buffer' }) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Christian Clason
					Christian Clason