From da1e4dcd1e5ebf340b1edbedb18dc2ba139e6e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Janou=C5=A1ek?= Date: Wed, 2 Feb 2022 01:28:52 +0000 Subject: Allow to configure haskell-language-server LSP config (#4038) --- ale_linters/haskell/hls.vim | 2 ++ doc/ale-haskell.txt | 14 ++++++++++++++ test/linter/test_haskell_hls.vader | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/ale_linters/haskell/hls.vim b/ale_linters/haskell/hls.vim index ae0556a4..7f9efc38 100644 --- a/ale_linters/haskell/hls.vim +++ b/ale_linters/haskell/hls.vim @@ -4,6 +4,7 @@ " ). It search more project root files. " call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') +call ale#Set('haskell_hls_config', {}) function! ale_linters#haskell#hls#FindRootFile(buffer) abort let l:serach_root_files = [ @@ -60,4 +61,5 @@ call ale#linter#Define('haskell', { \ 'command': function('ale_linters#haskell#hls#GetCommand'), \ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, \ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')}, \}) diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt index 1f41880d..9e65cc62 100644 --- a/doc/ale-haskell.txt +++ b/doc/ale-haskell.txt @@ -142,6 +142,20 @@ g:ale_haskell_hls_executable *g:ale_haskell_hls_executable* language server. +g:ale_haskell_hls_config *g:ale_haskell_hls_config* + *b:ale_haskell_hls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary with configuration settings for HLS. For example, to see more + completions: +> + let g:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}} +< + Refer to HLS documentation for possible settings: + https://haskell-language-server.readthedocs.io/en/latest/configuration.html#language-specific-server-options + + =============================================================================== stack-build *ale-haskell-stack-build* diff --git a/test/linter/test_haskell_hls.vader b/test/linter/test_haskell_hls.vader index e64aab6f..4452d53c 100644 --- a/test/linter/test_haskell_hls.vader +++ b/test/linter/test_haskell_hls.vader @@ -25,3 +25,8 @@ Execute(The executable should be configurable): let g:ale_haskell_hls_executable = 'foobar' AssertLinter 'foobar', ale#Escape('foobar') . ' --lsp' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}} + AssertLSPConfig {'haskell': {'maxCompletions': 250}} -- cgit v1.2.3