mirror of
https://github.com/zoriya/ts-comments.nvim.git
synced 2026-08-16 02:44:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52d0a587d5 | ||
|
|
87fc61f065 |
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/folke/ts-comments.nvim/compare/v1.0.0...v1.0.1) (2024-05-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* dont error when treesitter parser is not available ([87fc61f](https://github.com/folke/ts-comments.nvim/commit/87fc61f065db61e3e229b08765e2ea030c0eaf61))
|
||||||
|
|
||||||
## 1.0.0 (2024-05-20)
|
## 1.0.0 (2024-05-20)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -46,12 +46,12 @@ function M.setup(opts)
|
|||||||
if option ~= "commentstring" then
|
if option ~= "commentstring" then
|
||||||
return get_option(filetype, option)
|
return get_option(filetype, option)
|
||||||
end
|
end
|
||||||
local lang = vim.treesitter.language.get_lang(filetype)
|
local lang = vim.treesitter.language.get_lang(filetype) or filetype
|
||||||
|
|
||||||
local ret = opts.lang[lang]
|
local ret = opts.lang[lang]
|
||||||
if type(ret) == "table" then
|
if type(ret) == "table" then
|
||||||
local node = vim.treesitter.get_node({ ignore_injections = false })
|
local ok, node = pcall(vim.treesitter.get_node, { ignore_injections = false })
|
||||||
while node do
|
while ok and node do
|
||||||
if ret[node:type()] then
|
if ret[node:type()] then
|
||||||
ret = ret[node:type()]
|
ret = ret[node:type()]
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user