neovim plugin to add context aware print debug statements
- Uses tree-sitter to find context of your current cursor and create a print statement in the current language that prints that context
- I only tested on Neovim 0.5
Use your favorite plugin manager to install
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'bryall/contextprint.nvim'
- Lua
- Python
- Typescript
- C/C++
Call the below statment to change the defaults
require('contextprint').setup({
separator_char = "#", // Global
<filetype> = {
separator = "#", // filetype specific
query = [[ <language specific queries> ]],
log = function(contents) to return print statement to insert
type_defaults = vim.tbl_extend to change name defaults
}
})
require('contextprint').add_statement()
contextprint provides the following context for the supplied languages
- function
- function_definition
- for_statement
- for_in_statement
- repeat_statement
- while_statement
- if_statement
- function_declaration
- class_declaration
- method_definition
- arrow_function
- if_statement
- for_statement
- for_in_statement
- do_statement
- while_statement
- function_definition
- class_definition
- if_statement
- elif_statement
- else_statement
- for_statement
- while_statement