diff options
| author | Alexander Makarov <next.meaning@gmail.com> | 2022-07-17 23:58:47 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-17 13:58:47 -0700 |
| commit | 55ecdbda227728fdd39a54ef1354b8f87bdf0b0f (patch) | |
| tree | dcfbab6d9b88cc318cfc3f403961f2e1a95d2b30 /lua | |
| parent | docs: update server_configurations.md (diff) | |
| download | nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar.gz nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar.bz2 nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar.lz nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar.xz nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.tar.zst nvim-lspconfig-55ecdbda227728fdd39a54ef1354b8f87bdf0b0f.zip | |
fix(hls): wrong root dir for multi-package projects #2010
Problem:
In haskell multi-package projects there is *.cabal file in every package folder,
so util.root_pattern always find root of the package but not project.
Solution:
Adjust the condition.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/hls.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lua/lspconfig/server_configurations/hls.lua b/lua/lspconfig/server_configurations/hls.lua index 32b3ea22..54b45e98 100644 --- a/lua/lspconfig/server_configurations/hls.lua +++ b/lua/lspconfig/server_configurations/hls.lua @@ -4,7 +4,12 @@ return { default_config = { cmd = { 'haskell-language-server-wrapper', '--lsp' }, filetypes = { 'haskell', 'lhaskell' }, - root_dir = util.root_pattern('*.cabal', 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml'), + root_dir = function(filepath) + return ( + util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath) + or util.root_pattern('*.cabal', 'package.yaml')(filepath) + ) + end, single_file_support = true, settings = { haskell = { @@ -34,10 +39,17 @@ return { https://github.com/haskell/haskell-language-server Haskell Language Server - ]], + ]], default_config = { - root_dir = [[root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml")]], + root_dir = [[ +function (filepath) + return ( + util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath) + or util.root_pattern('*.cabal', 'package.yaml')(filepath) + ) +end + ]], }, }, } |
