Skip to content

Commit b00139b

Browse files
authored
fix: don't use tree-sitter to get module name for mod snippet (#28)
1 parent dfb3921 commit b00139b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
tree-sitter-haskell v0.21.0 rewrite.
1515
Because there are not many queries, this plugin maintains backward
1616
compatibility with the previous tree-sitter-haskell implementation for now.
17+
- Don't use tree-sitter to get the module name for the `mod` snippet,
18+
as this is most likely not set. Instead, use `<filename>:t:r`.
1719

1820
## [1.4.3] - 2023-12-15
1921

lua/haskell-snippets/module.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ end
6262

6363
---@return string | nil
6464
local function get_buf_module_name(_)
65-
local buf_content = table.concat(vim.api.nvim_buf_get_lines(0, 0, -1, false), '\n')
66-
return treesitter_module_name(function(mod)
67-
return mod
68-
end, buf_content, '(haskell (header module: (module) @mod))', '(haskell module: (module) @mod)')
65+
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':t:r')
6966
end
7067

7168
local function get_module_name_node()

0 commit comments

Comments
 (0)