We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1474cae commit d4e4355Copy full SHA for d4e4355
lua/debugprint/init.lua
@@ -74,13 +74,18 @@ local find_treesitter_variable = function()
74
-- Once get_node_at_cursor() is in NeoVim core, the nvim-treesitter
75
-- dependency can be removed: https://github.com/neovim/neovim/pull/18232
76
local node = ts_utils.get_node_at_cursor()
77
- local node_type = node:type()
78
- local variable_name = vim.treesitter.query.get_node_text(node, 0)
79
80
- if node_type ~= "identifier" then
+ if node == nil then
81
return nil
82
else
83
- return variable_name
+ local node_type = node:type()
+ local variable_name = vim.treesitter.query.get_node_text(node, 0)
+
84
+ if node_type ~= "identifier" then
85
+ return nil
86
+ else
87
+ return variable_name
88
+ end
89
end
90
91
0 commit comments