From ac635f9dad6c392dd355252f1e94f05b1ba82748 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 9 Sep 2025 09:33:18 -0500 Subject: [PATCH 1/4] Re-enable displaying type errors in pyrefly --- ale_linters/python/pyrefly.vim | 2 ++ doc/ale-python.txt | 30 +++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ale_linters/python/pyrefly.vim b/ale_linters/python/pyrefly.vim index 135e0ddfb1..138f8caece 100644 --- a/ale_linters/python/pyrefly.vim +++ b/ale_linters/python/pyrefly.vim @@ -6,6 +6,7 @@ call ale#Set('python_pyrefly_use_global', get(g:, 'ale_use_global_executables', call ale#Set('python_pyrefly_auto_pipenv', 0) call ale#Set('python_pyrefly_auto_poetry', 0) call ale#Set('python_pyrefly_auto_uv', 0) +call ale#Set('python_pyrefly_config', {'python': {'pyrefly': {'displayTypeErrors': 'force-on'}}}) function! ale_linters#python#pyrefly#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyrefly_auto_pipenv')) @@ -54,4 +55,5 @@ call ale#linter#Define('python', { \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'cwd': function('ale_linters#python#pyrefly#GetCwd'), +\ 'lsp_config': {b -> ale#Var(b, 'python_pyrefly_config')}, \}) diff --git a/doc/ale-python.txt b/doc/ale-python.txt index eeea36d5f4..6dde74462c 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -1677,8 +1677,36 @@ g:ale_python_pyrefly_auto_uv Set the executable to `uv` if true. This is overridden by a manually-set executable. + *ale-options.python_pyrefly_config* + *g:ale_python_pyrefly_config* + *b:ale_python_pyrefly_config* +python_pyrefly_config +g:ale_python_pyrefly_config + Type: |Dictionary| + Default: `{'python': {'pyrefly': {'displayTypeErrors': 'force-on'}}}` + + Settings for configuring the `pyrefly` language server. + + Starting with `pyrefly` version `0.31.1` displaying type errors is + disabled by default. The default |g:ale_python_pyrefly_config| + enables `displayTypeErrors`. When explicitly configuring + |g:ale_python_pyrefly_config| ensure to configure `displayTypeErrors` + if desired. To disable `displayTypeErrors` set the value to `force-off` + or set to `default` to require a `pyrefly` configuration for the + project. + + A commonly used setting for `pyrefly` is disabling language services + apart from type checking, you can set this setting like so, or use + whatever other settings you want: > - + let b:ale_python_pyright_config = { + \ 'python': { + \ 'pyrefly': { + \ 'disableLanguageServices': v:true, + \ } + \ }, + \} +< =============================================================================== pyright *ale-python-pyright* From 91a2b17516416149e1790a6601e4c2a6185b9158 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 9 Sep 2025 09:39:23 -0500 Subject: [PATCH 2/4] Add test --- test/linter/test_pyrefly.vader | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/linter/test_pyrefly.vader b/test/linter/test_pyrefly.vader index 05e1ddf148..4833d3e4fb 100644 --- a/test/linter/test_pyrefly.vader +++ b/test/linter/test_pyrefly.vader @@ -67,3 +67,10 @@ Execute(uv is detected when python_pyrefly_auto_uv is set): AssertLinter 'uv', \ ale#Escape('uv') . ' run pyrefly lsp' + +Execute(Assert the default config): + AssertLSPConfig {'python': {'pyrefly': {'displayTypeErrors': 'force-on'}}} + + let b:ale_python_pyrefly_config = {} + + AssertLSPConfig {} From ab11a889f32995306986fb1bf5264d6e72656fb8 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 22 Sep 2025 16:45:38 -0500 Subject: [PATCH 3/4] clarify the disabled by default statement --- doc/ale-python.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ale-python.txt b/doc/ale-python.txt index 6dde74462c..ea7b168d46 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -1688,7 +1688,8 @@ g:ale_python_pyrefly_config Settings for configuring the `pyrefly` language server. Starting with `pyrefly` version `0.31.1` displaying type errors is - disabled by default. The default |g:ale_python_pyrefly_config| + disabled by default if no `pyrefly.toml` or `pyproject.toml` with a + `[tool.pyrefly]` section exists. The default |g:ale_python_pyrefly_config| enables `displayTypeErrors`. When explicitly configuring |g:ale_python_pyrefly_config| ensure to configure `displayTypeErrors` if desired. To disable `displayTypeErrors` set the value to `force-off` From ab40915a3c688c2f1ce8e1d12d5d5e68e9823a49 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 4 Nov 2025 09:16:29 -0600 Subject: [PATCH 4/4] Address linter issue --- doc/ale-python.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/ale-python.txt b/doc/ale-python.txt index ea7b168d46..5aa8e17d0f 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -1677,6 +1677,7 @@ g:ale_python_pyrefly_auto_uv Set the executable to `uv` if true. This is overridden by a manually-set executable. + *ale-options.python_pyrefly_config* *g:ale_python_pyrefly_config* *b:ale_python_pyrefly_config*