Awesome
contextprintf.nvim
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
Installation
- I only tested on Neovim 0.5
Use your favorite plugin manager to install
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'bryall/contextprint.nvim'
Supported Languages / Planned
- Lua
- Python
- Typescript
- C/C++
Options
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
}
})
to add context print statement
require('contextprint').add_statement()
Language Details
contextprint provides the following context for the supplied languages
Lua
- function
- function_definition
- for_statement
- for_in_statement
- repeat_statement
- while_statement
- if_statement
Typescript
- function_declaration
- class_declaration
- method_definition
- arrow_function
- if_statement
- for_statement
- for_in_statement
- do_statement
- while_statement
Python
- function_definition
- class_definition
- if_statement
- elif_statement
- else_statement
- for_statement
- while_statement