File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file.
66The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
77and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
88
9+ ## Unreleased
10+
11+ ### Added
12+
13+ - Use tree-sitter if the parser for Haskell is installed,
14+ without requiring the nvim-treesitter plugin.
15+
916## [ 1.1.0] - 2023-11-05
1017
1118### Added
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ Use luarocks or your favourite plugin manager.
4949- [ ` haskell-language-server ` ] ( https://haskell-language-server.readthedocs.io/en/latest/installation.html )
5050 and [ ` haskell-tools.nvim ` ] ( https://github.com/mrcjkb/haskell-tools.nvim )
5151 (some snippets work better with LSP).
52- - [ ` nvim-treesitter ` ] ( https://github.com/nvim-treesitter/nvim-treesitter )
52+ - A Haskell tree-sitter parser or
53+ [ ` nvim-treesitter ` ] ( https://github.com/nvim-treesitter/nvim-treesitter )
5354 and the parser for haskell.
5455
5556## Quick setup
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ local choice = ls.choice_node
2424local dynamic = ls .dynamic_node
2525
2626local has_treesitter , parsers = pcall (require , ' nvim-treesitter.parsers' )
27- local hs_lang = has_treesitter and parsers .ft_to_lang (' haskell' )
27+ local hs_lang = has_treesitter and parsers .ft_to_lang (' haskell' ) or ' haskell'
28+ local has_haskell_parser = pcall (vim .treesitter .get_string_parser , ' ' , ' haskell' )
2829
2930local function get_module_name_node ()
3031 local module_name = util .lsp_get_module_name ()
@@ -77,7 +78,7 @@ local function get_qualified_name_node(args)
7778 end
7879 local import_stmt = ' import qualified ' .. module_name
7980 local choices = { insert (1 ) }
80- if hs_lang then
81+ if has_haskell_parser then
8182 local module_query = vim .treesitter .query .parse (hs_lang , ' (module) @mod' )
8283 local lang_tree = vim .treesitter .get_string_parser (import_stmt , hs_lang , { injections = { [hs_lang ] = ' ' } })
8384 local root = fast_parse (lang_tree ):root ()
You can’t perform that action at this time.
0 commit comments