Skip to content

Commit

Permalink
fix: don't use tree-sitter to get module name for mod snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed May 13, 2024
1 parent dfb3921 commit e381847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
tree-sitter-haskell v0.21.0 rewrite.
Because there are not many queries, this plugin maintains backward
compatibility with the previous tree-sitter-haskell implementation for now.
- Don't use tree-sitter to get the module name for the `mod` snippet,
as this is most likely not set. Instead, use `<filename>:t:r`.

## [1.4.3] - 2023-12-15

Expand Down
5 changes: 1 addition & 4 deletions lua/haskell-snippets/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ end

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

local function get_module_name_node()
Expand Down

0 comments on commit e381847

Please sign in to comment.