nvim: treesitter: Register haskell parser in ftplugin

4468c8b made PureScript use Haskell for treesitter queries. However,
setting them up globally sometimes seems to result in Haskell files
getting identified as PureScript and triggering a PureScript LSP
server attach. At least that's what the behaviour seems like.

To prevent this, register the usage of Haskell treesitter queries
in ftplugin viz. when PureScript file type is detected.
This commit is contained in:
Sanchayan Maity 2023-06-20 08:44:43 +05:30
parent 6f78a23ab3
commit d3775127f8
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3
2 changed files with 3 additions and 3 deletions

View file

@ -12,3 +12,6 @@ vim.api.nvim_create_autocmd({ "BufReadPre", "BufWinEnter" }, {
vim.bo.buflisted = false
end,
})
-- Make PureScript use Haskell parser and queries.
vim.treesitter.language.register('haskell', 'purescript')

View file

@ -17,8 +17,5 @@ require'nvim-treesitter.configs'.setup {
},
}
-- Make PureScript use Haskell parser and queries.
vim.treesitter.language.register('haskell', 'purescript')
vim.keymap.set('o', '<Leader>m', ':<C-U>lua require(\'tsht\').nodes()<CR>', { noremap=false, unique=true, silent=true })
vim.keymap.set('x', '<Leader>m', ':lua require(\'tsht\').nodes()<CR>' , { noremap=true , unique=true, silent=true })