diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ale-c.txt | 133 | ||||
-rw-r--r-- | doc/ale-cpp.txt | 126 | ||||
-rw-r--r-- | doc/ale-development.txt | 82 | ||||
-rw-r--r-- | doc/ale-elixir.txt | 2 | ||||
-rw-r--r-- | doc/ale-handlebars.txt | 6 | ||||
-rw-r--r-- | doc/ale-markdown.txt | 11 | ||||
-rw-r--r-- | doc/ale-php.txt | 45 | ||||
-rw-r--r-- | doc/ale-powershell.txt | 7 | ||||
-rw-r--r-- | doc/ale-python.txt | 13 | ||||
-rw-r--r-- | doc/ale-ruby.txt | 4 | ||||
-rw-r--r-- | doc/ale-rust.txt | 31 | ||||
-rw-r--r-- | doc/ale-sql.txt | 2 | ||||
-rw-r--r-- | doc/ale-supported-languages-and-tools.txt | 13 | ||||
-rw-r--r-- | doc/ale.txt | 447 |
14 files changed, 673 insertions, 249 deletions
diff --git a/doc/ale-c.txt b/doc/ale-c.txt index fc0d941a..b0d94b8e 100644 --- a/doc/ale-c.txt +++ b/doc/ale-c.txt @@ -1,22 +1,36 @@ =============================================================================== ALE C Integration *ale-c-options* +For basic checking of problems with C files, ALE offers the `cc` linter, which +runs either `clang`, or `gcc`. See |ale-c-cc|. + =============================================================================== Global Options +g:ale_c_always_make *g:ale_c_always_make* + *b:ale_c_always_make* + Type: |Number| + Default: `has('unix') && !has('macunix')` + + If set to `1`, use `--always-make` for `make`, which means that output will + always be parsed from `make` dry runs with GNU make. BSD `make` does not + support this option, so you probably want to turn this option off when using + a BSD variant. + + g:ale_c_build_dir_names *g:ale_c_build_dir_names* *b:ale_c_build_dir_names* Type: |List| Default: `['build', 'bin']` - A list of directory names to be used when searching upwards from cpp - files to discover compilation databases with. For directory named `'foo'`, - ALE will search for `'foo/compile_commands.json'` in all directories on and above - the directory containing the cpp file to find path to compilation database. - This feature is useful for the clang tools wrapped around LibTooling (namely - here, clang-tidy) + A list of directory names to be used when searching upwards from cpp files + to discover compilation databases with. For directory named `'foo'`, ALE + will search for `'foo/compile_commands.json'` in all directories on and + above the directory containing the cpp file to find path to compilation + database. This feature is useful for the clang tools wrapped around + LibTooling (namely here, clang-tidy) g:ale_c_build_dir *g:ale_c_build_dir* @@ -55,6 +69,11 @@ g:ale_c_parse_makefile *g:ale_c_parse_makefile* set for C or C++ compilers. This can make it easier to determine the correct build flags to use for different files. + NOTE: When using this option on BSD, you may need to set + |g:ale_c_always_make| to `0`, and `make -n` will not provide consistent + results if binaries have already been built, so use `make clean` when + editing your files. + WARNING: Running `make -n` automatically can execute arbitrary code, even though it's supposed to be a dry run, so enable this option with care. You might prefer to use the buffer-local version of the option instead with @@ -94,22 +113,58 @@ g:ale_c_astyle_project_options *g:ale_c_astyle_project_options* =============================================================================== -clang *ale-c-clang* +cc *ale-c-cc* + *ale-c-gcc* + *ale-c-clang* -g:ale_c_clang_executable *g:ale_c_clang_executable* - *b:ale_c_clang_executable* +g:ale_c_cc_executable *g:ale_c_cc_executable* + *b:ale_c_cc_executable* Type: |String| - Default: `'clang'` + Default: `'<auto>'` + + This variable can be changed to use a different executable for a C compiler. - This variable can be changed to use a different executable for clang. + ALE will try to use `clang` if Clang is available, otherwise ALE will + default to checking C code with `gcc`. -g:ale_c_clang_options *g:ale_c_clang_options* - *b:ale_c_clang_options* +g:ale_c_cc_options *g:ale_c_cc_options* + *b:ale_c_cc_options* Type: |String| Default: `'-std=c11 -Wall'` - This variable can be changed to modify flags given to clang. + This variable can be change to modify flags given to the C compiler. + + +=============================================================================== +ccls *ale-c-ccls* + +g:ale_c_ccls_executable *g:ale_c_ccls_executable* + *b:ale_c_ccls_executable* + Type: |String| + Default: `'ccls'` + + This variable can be changed to use a different executable for ccls. + + +g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* + *b:ale_c_ccls_init_options* + Type: |Dictionary| + Default: `{}` + + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -295,25 +350,6 @@ g:ale_c_flawfinder_error_severity *g:ale_c_flawfinder_error_severity* =============================================================================== -gcc *ale-c-gcc* - -g:ale_c_gcc_executable *g:ale_c_gcc_executable* - *b:ale_c_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_c_gcc_options *g:ale_c_gcc_options* - *b:ale_c_gcc_options* - Type: |String| - Default: `'-std=c11 -Wall'` - - This variable can be change to modify flags given to gcc. - - -=============================================================================== uncrustify *ale-c-uncrustify* g:ale_c_uncrustify_executable *g:ale_c_uncrustify_executable* @@ -333,35 +369,4 @@ g:ale_c_uncrustify_options *g:ale_c_uncrustify_options* =============================================================================== -ccls *ale-c-ccls* - -g:ale_c_ccls_executable *g:ale_c_ccls_executable* - *b:ale_c_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* - *b:ale_c_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-cpp.txt b/doc/ale-cpp.txt index fbe31370..17894e6e 100644 --- a/doc/ale-cpp.txt +++ b/doc/ale-cpp.txt @@ -1,12 +1,16 @@ =============================================================================== ALE C++ Integration *ale-cpp-options* +For basic checking of problems with C++ files, ALE offers the `cc` linter, +which runs either `clang++`, or `gcc`. See |ale-cpp-cc|. + =============================================================================== Global Options The following C options also apply to some C++ linters too. +* |g:ale_c_always_make| * |g:ale_c_build_dir_names| * |g:ale_c_build_dir| * |g:ale_c_parse_makefile| @@ -38,41 +42,58 @@ g:ale_cpp_astyle_project_options *g:ale_cpp_astyle_project_options* =============================================================================== -clang *ale-cpp-clang* +cc *ale-cpp-cc* + *ale-cpp-gcc* + *ale-cpp-clang* -g:ale_cpp_clang_executable *g:ale_cpp_clang_executable* - *b:ale_cpp_clang_executable* +g:ale_cpp_cc_executable *g:ale_cpp_cc_executable* + *b:ale_cpp_cc_executable* Type: |String| - Default: `'clang++'` + Default: `'<auto>'` + + This variable can be changed to use a different executable for a C++ compiler. - This variable can be changed to use a different executable for clang. + ALE will try to use `clang++` if Clang is available, otherwise ALE will + default to checking C++ code with `gcc`. -g:ale_cpp_clang_options *g:ale_cpp_clang_options* - *b:ale_cpp_clang_options* +g:ale_cpp_cc_options *g:ale_cpp_cc_options* + *b:ale_cpp_cc_options* Type: |String| Default: `'-std=c++14 -Wall'` - This variable can be changed to modify flags given to clang. + This variable can be change to modify flags given to the C++ compiler. =============================================================================== -clangd *ale-cpp-clangd* +ccls *ale-cpp-ccls* -g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* - *b:ale_cpp_clangd_executable* +g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* + *b:ale_cpp_ccls_executable* Type: |String| - Default: `'clangd'` + Default: `'ccls'` - This variable can be changed to use a different executable for clangd. + This variable can be changed to use a different executable for ccls. -g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* - *b:ale_cpp_clangd_options* - Type: |String| - Default: `''` +g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* + *b:ale_cpp_ccls_init_options* + Type: |Dictionary| + Default: `{}` - This variable can be changed to modify flags given to clangd. + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -107,6 +128,25 @@ g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* =============================================================================== +clangd *ale-cpp-clangd* + +g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* + *b:ale_cpp_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* + *b:ale_cpp_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + +=============================================================================== clang-format *ale-cpp-clangformat* See |ale-c-clangformat| for information about the available options. @@ -296,60 +336,10 @@ g:ale_cpp_flawfinder_options *g:ale-cpp-flawfinder* =============================================================================== -gcc *ale-cpp-gcc* - -g:ale_cpp_gcc_executable *g:ale_cpp_gcc_executable* - *b:ale_cpp_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* - *b:ale_cpp_gcc_options* - Type: |String| - Default: `'-std=c++14 -Wall'` - - This variable can be changed to modify flags given to gcc. - - -=============================================================================== uncrustify *ale-cpp-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== -ccls *ale-cpp-ccls* - -g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* - *b:ale_cpp_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* - *b:ale_cpp_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-development.txt b/doc/ale-development.txt index faa570c1..afd9798f 100644 --- a/doc/ale-development.txt +++ b/doc/ale-development.txt @@ -13,6 +13,7 @@ CONTENTS *ale-development-contents* 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| + 4.3. Running Tests in a Windows VM....|ale-development-windows-tests| =============================================================================== 1. Introduction *ale-development-introduction* @@ -170,6 +171,11 @@ will run all of the tests in Vader, Vint checks, and several Bash scripts for finding extra issues. Run `./run-tests --help` to see all of the options the script supports. Note that the script supports selecting particular test files. +Once you get used to dealing with Vim and NeoVim compatibility issues, you +probably want to use `./run-tests --fast -q` for running tests with only the +fastest available Vim version, and with success messages from tests +suppressed. + Generally write tests for any changes you make. The following types of tests are recommended for the following types of code. @@ -354,4 +360,80 @@ given the above setup are as follows. =============================================================================== +4.3 Running Tests in a Windows VM *ale-development-windows-tests* + +Tests are run for ALE in a build of Vim 8 for Windows via AppVeyor. These +tests can frequently break due to minor differences in paths and how escaping +is done for commands on Windows. If you are a Linux or Mac user, running these +tests locally can be difficult. Here is a process that will make that easier. + +First, you want to install a Windows image with VirtualBox. Install VirtualBox +and grab a VirtualBox image for Windows such as from here: +https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ + +NOTE: If you need to enter a password for the virtual machine at any point, +the password is "Passw0rd!" without the double quotes. + +NOTE: If your trial period for Windows runs out, run the commands like the +wallpaper tells you to. + +Your virtual machine will need to have PowerShell installed. Before you go any +further, confirm that PowerShell is installed in your Windows virtual machine. + +Consult the VirtualBox documentation on how to install "Guest Additions." +You probably want to install "Guest Additions" for most things to work +properly. + +After you've loaded your virtual machine image, go into "Settings" for your +virtual machine, and "Shared Folders." Add a shared folder with the name +"ale", and set the "Folder Path" to the path to your ALE repository, for +example: "/home/w0rp/ale" + +Find out which drive letter "ale" has been mounted as in Windows. We'll use +"E:" as the drive letter, for example. Open the command prompt as an +administrator by typing in `cmd` in the start menu, right clicking on the +command prompt application, and clicking "Run as administrator." Click "Yes" +when prompted to ask if you're sure you want to run the command prompt. You +should type in the following command to mount the "ale" directory for testing, +where "E:" is replaced with your drive letter. > + + mklink /D C:\testplugin E: +< +Close the administrator Command Prompt, and try running the command +`type C:\testplugin\LICENSE` in a new Command Prompt which you are NOT running +as administrator. You should see the license for ALE in your terminal. After +you have confirmed that you have mounted ALE on your machine, search in the +Start Menu for "power shell," run PowerShell as an administrator, and issue +the following commands to install the correct Vim and Vader versions for +running tests. > + + Add-Type -A System.IO.Compression.FileSystem + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip -OutFile C:\vim.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim') + rm C:\vim.zip + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip -OutFile C:\rt.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim') + rm C:\rt.zip + + Invoke-WebRequest https://github.com/junegunn/vader.vim/archive/c6243dd81c98350df4dec608fa972df98fa2a3af.zip -OutFile C:\vader.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vader.zip', 'C:\') + mv C:\vader.vim-c6243dd81c98350df4dec608fa972df98fa2a3af C:\vader + rm C:\vader.zip +< +After you have finished installing everything, you can run all of the tests +in Windows by opening a Command Prompt NOT as an administrator by navigating +to the directory where you've mounted the ALE code, which must be named +`C:\testplugin`, and by running the `run-tests.bat` batch file. > + + cd C:\testplugin + run-tests +< +It will probably take several minutes for all of the tests to run. Be patient. +You can run a specific test by passing the filename as an argument to the +batch file, for example: `run-tests test/test_c_flag_parsing.vader` . This will +give you results much more quickly. + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-elixir.txt b/doc/ale-elixir.txt index 5864f728..de9daacf 100644 --- a/doc/ale-elixir.txt +++ b/doc/ale-elixir.txt @@ -6,7 +6,7 @@ ALE Elixir Integration *ale-elixir-options* mix *ale-elixir-mix* -The `mix` linter is disabled by default, as it can bee too expensive to run. +The `mix` linter is disabled by default, as it can be too expensive to run. See `:help g:ale_linters` diff --git a/doc/ale-handlebars.txt b/doc/ale-handlebars.txt index 5daec5b3..4a5a3870 100644 --- a/doc/ale-handlebars.txt +++ b/doc/ale-handlebars.txt @@ -14,7 +14,8 @@ ember-template-lint *ale-handlebars-embertemplatelint* g:ale_handlebars_embertemplatelint_executable *g:ale_handlebars_embertemplatelint_executable* - Type: |String| *b:ale_handlebars_embertemplatelint_executable* + *b:ale_handlebars_embertemplatelint_executable* + Type: |String| Default: `'ember-template-lint'` See |ale-integrations-local-executables| @@ -22,7 +23,8 @@ g:ale_handlebars_embertemplatelint_executable g:ale_handlebars_embertemplatelint_use_global *g:ale_handlebars_embertemplatelint_use_global* - Type: |Number| *b:ale_handlebars_embertemplatelint_use_global* + *b:ale_handlebars_embertemplatelint_use_global* + Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| diff --git a/doc/ale-markdown.txt b/doc/ale-markdown.txt index 4e27eb91..99848878 100644 --- a/doc/ale-markdown.txt +++ b/doc/ale-markdown.txt @@ -3,6 +3,17 @@ ALE Markdown Integration *ale-markdown-options* =============================================================================== +markdownlint *ale-markdown-markdownlint* + +g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options* + *b:ale_markdown_markdownlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to markdownlint. + + +=============================================================================== mdl *ale-markdown-mdl* g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable* diff --git a/doc/ale-php.txt b/doc/ale-php.txt index 645decd7..9fe868f8 100644 --- a/doc/ale-php.txt +++ b/doc/ale-php.txt @@ -189,42 +189,55 @@ g:ale_php_psalm_executable *g:ale_php_psalm_executable* This variable sets the executable used for psalm. -g:ale_psalm_langserver_options *g:ale_psalm_langserver_options* - *b:ale_psalm_langserver_options* + +g:ale_php_psalm_options *g:ale_php_psalm_options* + *b:ale_php_psalm_options* Type: |String| Default: `''` This variable can be set to pass additional options to psalm. + +g:ale_php_psalm_use_global *g:ale_php_psalm_use_global* + *b:ale_php_psalm_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== -php-cs-fixer *ale-php-php-cs-fixer* +php-cs-fixer *ale-php-php-cs-fixer* -g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* - *b:ale_php_cs_fixer_executable* +g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* + *b:ale_php_cs_fixer_executable* Type: |String| Default: `'php-cs-fixer'` This variable sets executable used for php-cs-fixer. -g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* - *b:ale_php_cs_fixer_use_global* - Type: |Boolean| - Default: `get(g:, 'ale_use_global_executables', 0)` - - This variable force globally installed fixer. -g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* - *b:ale_php_cs_fixer_options* +g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* + *b:ale_php_cs_fixer_options* Type: |String| Default: `''` This variable can be set to pass additional options to php-cs-fixer. + +g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* + *b:ale_php_cs_fixer_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== -php *ale-php-php* +php *ale-php-php* -g:ale_php_php_executable *g:ale_php_php_executable* - *b:ale_php_php_executable* +g:ale_php_php_executable *g:ale_php_php_executable* + *b:ale_php_php_executable* Type: |String| Default: `'php'` diff --git a/doc/ale-powershell.txt b/doc/ale-powershell.txt index c28ef9ea..485c9bd0 100644 --- a/doc/ale-powershell.txt +++ b/doc/ale-powershell.txt @@ -25,13 +25,6 @@ Installation Install PSScriptAnalyzer by any means, so long as it can be automatically imported in PowerShell. -Some PowerShell plugins set the filetype of files to `ps1`. To continue using -these plugins, use the ale_linter_aliases global to alias `ps1` to `powershell` - -> - " Allow ps1 filetype to work with powershell linters - let g:ale_linter_aliases = {'ps1': 'powershell'} -< g:ale_powershell_psscriptanalyzer_executable *g:ale_powershell_psscriptanalyzer_executable* diff --git a/doc/ale-python.txt b/doc/ale-python.txt index 60b0771d..6b1a6d33 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -169,13 +169,14 @@ flake8 *ale-python-flake8* g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory* *b:ale_python_flake8_change_directory* - Type: |Number| - Default: `1` + Type: |String| + Default: `project` - If set to `1`, ALE will switch to the directory the Python file being - checked with `flake8` is in before checking it. This helps `flake8` find - configuration files more easily. This option can be turned off if you want - to control the directory Python is executed from yourself. + If set to `project`, ALE will switch to the project root before checking file. + If set to `file`, ALE will switch to directory the Python file being + checked with `flake8` is in before checking it. + You can turn it off with `off` option if you want to control the directory + Python is executed from yourself. g:ale_python_flake8_executable *g:ale_python_flake8_executable* diff --git a/doc/ale-ruby.txt b/doc/ale-ruby.txt index 29a39c97..8815404a 100644 --- a/doc/ale-ruby.txt +++ b/doc/ale-ruby.txt @@ -180,8 +180,8 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* =============================================================================== standardrb *ale-ruby-standardrb* -g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* - *b:ale_ruby_standardrb_executable* +g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* + *b:ale_ruby_standardrb_executable* Type: String Default: `'standardrb'` diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt index 46d4714b..f4b4e7b7 100644 --- a/doc/ale-rust.txt +++ b/doc/ale-rust.txt @@ -31,11 +31,11 @@ Integration Information 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. - Only cargo is enabled by default. To switch to using rustc instead of cargo, - configure |g:ale_linters| appropriately: > + Only cargo and rls are enabled by default. To switch to using rustc instead + of cargo, configure |g:ale_linters| appropriately: > " See the help text for the option for more information. - let g:ale_linters = {'rust': ['rustc']} + let g:ale_linters = {'rust': ['rustc', 'rls']} < Also note that rustc 1.12. or later is needed. @@ -60,6 +60,7 @@ g:ale_rust_analyzer_config *g:ale_rust_analyzer_config* Dictionary with configuration settings for rust-analyzer. + =============================================================================== cargo *ale-rust-cargo* @@ -174,6 +175,18 @@ g:ale_rust_cargo_clippy_options only `cargo clippy` supports (e.g. `--deny`). +g:ale_rust_cargo_target_dir + *g:ale_rust_cargo_target_dir* + *b:ale_rust_cargo_target_dir* + + Type: |String| + Default: `''` + + Use a custom target directory when running the commands for ALE. This can + help to avoid "waiting for file lock on build directory" messages when + running `cargo` commands manually while ALE is performing its checks. + + =============================================================================== rls *ale-rust-rls* @@ -240,23 +253,25 @@ g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* > let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] + g:ale_rust_ignore_secondary_spans *g:ale_rust_ignore_secondary_spans* *b:ale_rust_ignore_secondary_spans* Type: Number Default: 0 - When set to 1, instructs the Rust error repporting to ignore secondary - spans. The problem with secondary spans is that they sometimes appear in - error messages before the main cause of the error, for example: > + When set to 1, instructs the Rust error reporting to ignore secondary spans. + The problem with secondary spans is that they sometimes appear in error + messages before the main cause of the error, for example: > 1 src/main.rs|98 col 5 error| this function takes 4 parameters but 5 - parameters were supplied: defined here + parameters were supplied: defined here 2 src/main.rs|430 col 32 error| this function takes 4 parameters but 5 - parameters were supplied: expected 4 parameters + parameters were supplied: expected 4 parameters < This is due to the sorting by line numbers. With this option set to 1, the 'defined here' span will not be presented. + =============================================================================== rustfmt *ale-rust-rustfmt* diff --git a/doc/ale-sql.txt b/doc/ale-sql.txt index 2807271b..398e24d3 100644 --- a/doc/ale-sql.txt +++ b/doc/ale-sql.txt @@ -3,7 +3,7 @@ ALE SQL Integration *ale-sql-options* =============================================================================== -pgformatter *ale-sql-pgformatter* +pgformatter *ale-sql-pgformatter* g:ale_sql_pgformatter_executable *g:ale_sql_pgformatter_executable* *b:ale_sql_pgformatter_executable* diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index 2dc05287..c6bcf421 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -21,6 +21,7 @@ Notes: * `drafter` * AsciiDoc * `alex`!! + * `languagetool`!! * `proselint` * `redpen` * `textlint` @@ -47,7 +48,7 @@ Notes: * C * `astyle` * `ccls` - * `clang` + * `clang` (`cc`) * `clangd` * `clang-format` * `clangtidy`!! @@ -55,7 +56,7 @@ Notes: * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * C# * `csc`!! @@ -65,7 +66,7 @@ Notes: * C++ (filetype cpp) * `astyle` * `ccls` - * `clang` + * `clang` (`cc`) * `clangcheck`!! * `clangd` * `clang-format` @@ -75,7 +76,7 @@ Notes: * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * Chef * `cookstyle` @@ -118,6 +119,8 @@ Notes: * `dartanalyzer`!! * `dartfmt`!! * `language_server` +* Dhall + * `dhall-format` * Dockerfile * `dockerfile_lint` * `hadolint` @@ -446,6 +449,7 @@ Notes: * `sqlfmt` * `sqlformat` * `sqlint` + * `sql-lint` * Stylus * `stylelint` * SugarSS @@ -453,6 +457,7 @@ Notes: * Swift * `sourcekit-lsp` * `swiftformat` + * `swift-format` * `swiftlint` * Tcl * `nagelfar`!! diff --git a/doc/ale.txt b/doc/ale.txt index c7664da0..6ef137c1 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -9,8 +9,9 @@ CONTENTS *ale-contents* 1. Introduction.........................|ale-introduction| 2. Supported Languages & Tools..........|ale-support| 3. Linting..............................|ale-lint| - 3.1 Adding Language Servers...........|ale-lint-language-servers| - 3.2 Other Sources.....................|ale-lint-other-sources| + 3.1 Linting On Other Machines.........|ale-lint-other-machines| + 3.2 Adding Language Servers...........|ale-lint-language-servers| + 3.3 Other Sources.....................|ale-lint-other-sources| 4. Fixing Problems......................|ale-fix| 5. Language Server Protocol Support.....|ale-lsp| 5.1 Completion........................|ale-completion| @@ -146,9 +147,68 @@ ALE offers several options for controlling which linters are run. * Disabling only a subset of linters. - |g:ale_linters_ignore| * Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| +You can stop ALE any currently running linters with the |ALELintStop| command. +Any existing problems will be kept. ------------------------------------------------------------------------------- -3.1 Adding Language Servers *ale-lint-language-servers* +3.1 Linting On Other Machines *ale-lint-other-machines* + +ALE offers support for running linters or fixers on files you are editing +locally on other machines, so long as the other machine has access the file +you are editing. This could be a linter or fixer run inside of a Docker image, +running in a virtual machine, running on a remote server, etc. + +In order to run tools on other machines, you will need to configure your tools +to run via scripts that execute commands on those machines, such as by setting +the ALE `_executable` options for those tools to a path for a script to run, +or by using |g:ale_command_wrapper| to specify a script to wrap all commands +that are run by ALE, before they are executed. For tools that ALE runs where +ALE looks for locally installed executables first, you may need to set the +`_use_global` options for those tools to `1`, or you can set +|g:ale_use_global_executables| to `1` before ALE is loaded to only use global +executables for all tools. + +In order for ALE to properly lint or fix files which are running on another +file system, you must provide ALE with |List|s of strings for mapping paths to +and from your local file system and the remote file system, such as the file +system of your Docker container. See |g:ale_filename_mappings| for all of the +different ways these filename mappings can be configured. + +For example, you might configure `pylint` to run via Docker by creating a +script like so. > + + #!/usr/bin/env bash + + exec docker run -i --rm -v "$(pwd):/data" cytopia/pylint "$@" +< + +You will run to run Docker commands with `-i` in order to read from stdin. + +With the above script in mind, you might configure ALE to lint your Python +project with `pylint` by providing the path to the script to execute, and +mappings which describe how to between the two file systems in your +`python.vim` |ftplugin| file, like so: > + + if expand('%:p') =~# '^/home/w0rp/git/test-pylint/' + let b:ale_linters = ['pylint'] + let b:ale_python_pylint_use_global = 1 + " This is the path to the script above. + let b:ale_python_pylint_executable = '/home/w0rp/git/test-pylint/pylint.sh' + " /data matches the path in Docker. + let b:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/w0rp/git/test-pylint', '/data'], + \ ], + \} + endif +< + +You might consider using a Vim plugin for loading Vim configuration files +specific to each project, if you have a lot of projects to manage. + + +------------------------------------------------------------------------------- +3.2 Adding Language Servers *ale-lint-language-servers* ALE comes with many default configurations for language servers, so they can be detected and run automatically. ALE can connect to other language servers @@ -189,7 +249,7 @@ address to connect to instead. > ------------------------------------------------------------------------------- -3.2 Other Sources *ale-lint-other-sources* +3.3 Other Sources *ale-lint-other-sources* Problems for a buffer can be taken from other sources and rendered by ALE. This allows ALE to be used in combination with other plugins which also want @@ -287,6 +347,8 @@ are supported for running the commands. file will be created, containing the lines from the file after previous adjustment have been done. + See |ale-command-format-strings| for formatting options. + `read_temporary_file` When set to `1`, ALE will read the contents of the temporary file created for `%t`. This option can be used for commands which need to modify some file on disk in @@ -356,6 +418,10 @@ by default. Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will still be run when you manually run |ALEFix|. +Fixers can be run on another machines, just like linters, such as fixers run +from a Docker container, running in a virtual machine, running a remote +server, etc. See |ale-lint-other-machines|. + =============================================================================== 5. Language Server Protocol Support *ale-lsp* @@ -402,12 +468,56 @@ is loaded. The delay for completion can be configured with |g:ale_completion_delay|. This setting should not be enabled if you wish to use ALE as a completion source for other plugins. +ALE automatic completion will not work when 'paste' is active. Only set +'paste' when you are copy and pasting text into your buffers. + +ALE automatic completion will interfere with default insert completion with +`CTRL-N` and so on (|compl-vim|). You can write your own keybinds and a +function in your |vimrc| file to force insert completion instead, like so: > + + function! SmartInsertCompletion() abort + " Use the default CTRL-N in completion menus + if pumvisible() + return "\<C-n>" + endif + + " Exit and re-enter insert mode, and use insert completion + return "\<C-c>a\<C-n>" + endfunction + + inoremap <silent> <C-n> <C-R>=SmartInsertCompletion()<CR> +< ALE provides an 'omnifunc' function |ale#completion#OmniFunc| for triggering completion manually with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| > " Use ALE's function for omnicompletion. set omnifunc=ale#completion#OmniFunc < + *ale-completion-fallback* + +You can write your own completion function and fallback on other methods of +completion by checking if there are no results that ALE can determine. For +example, for Python code, you could fall back on the `python3complete` +function. > + + function! TestCompletionFunc(findstart, base) abort + let l:result = ale#completion#OmniFunc(a:findstart, a:base) + + " Check if ALE couldn't find anything. + if (a:findstart && l:result is -3) + \|| (!a:findstart && empty(l:result)) + " Defer to another omnifunc if ALE couldn't find anything. + return python3complete#Complete(a:findstart, a:base) + endif + + return l:result + endfunction + + set omnifunc=TestCompletionFunc +< +See |complete-functions| for documentation on how to write completion +functions. + ALE will only suggest so many possible matches for completion. The maximum number of items can be controlled with |g:ale_completion_max_suggestions|. @@ -421,6 +531,15 @@ completion information with Deoplete, consult Deoplete's documentation. ALE by can support automatic imports from external modules. This behavior can be enabled by setting the |g:ale_completion_autoimport| variable to `1`. +You can manually request imports for symbols at the cursor with the +|ALEImport| command. The word at the cursor must be an exact match for some +potential completion result which includes additional text to insert into the +current buffer, which ALE will assume is code for an import line. This command +can be useful when your code already contains something you need to import. + +You can execute other commands whenever ALE inserts some completion text with +the |ALECompletePost| event. + When working with TypeScript files, ALE can remove warnings from your completions by setting the |g:ale_completion_tsserver_remove_warnings| variable to 1. @@ -501,15 +620,9 @@ displayed. ------------------------------------------------------------------------------- 5.4 Find References *ale-find-references* -ALE supports finding references for symbols though any enabled LSP linters. -ALE will display a preview window showing the places where a symbol is -referenced in a codebase when a command is run. The following commands are -supported: - -|ALEFindReferences| - Find references for the word under the cursor. - -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports finding references for symbols though any enabled LSP linters +with the |ALEFindReferences| command. See the documentation for the command +for a full list of options. ------------------------------------------------------------------------------- 5.5 Hovering *ale-hover* @@ -552,13 +665,9 @@ Documentation for symbols at the cursor can be retrieved using the ------------------------------------------------------------------------------- 5.6 Symbol Search *ale-symbol-search* -ALE supports searching for workspace symbols via LSP linters. The following -commands are supported: - -|ALESymbolSearch| - Search for symbols in the workspace. - -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports searching for workspace symbols via LSP linters with the +|ALESymbolSearch| command. See the documentation for the command +for a full list of options. =============================================================================== 6. Global Options *ale-options* @@ -678,13 +787,18 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting should not be enabled if you wish to use ALE as a completion source for other completion plugins. + ALE automatic completion will not work when 'paste' is active. Only set + 'paste' when you are copy and pasting text into your buffers. + A buffer-local version of this setting `b:ale_completion_enabled` can be set to `0` to disable ALE's automatic completion support for a single buffer. ALE's completion support must be enabled globally to be enabled locally. See |ale-completion| -g:ale_completion_tsserver_remove_warnings *g:ale_completion_tsserver_remove_warnings* + + *g:ale_completion_tsserver_remove_warnings* +g:ale_completion_tsserver_remove_warnings Type: Number Default: `0` @@ -693,6 +807,7 @@ g:ale_completion_tsserver_remove_warnings *g:ale_completion_tsserver_remove_warn including those that are a warning. Warnings can be excluded from completed items by setting it to `1`. + g:ale_completion_autoimport *g:ale_completion_autoimport* Type: Number @@ -807,7 +922,7 @@ g:ale_default_navigation *g:ale_default_navigation* Default: `'buffer'` The default method for navigating away from the current buffer to another - buffer, such as for |ALEFindReferences:|, or |ALEGoToDefinition|. + buffer, such as for |ALEFindReferences|, or |ALEGoToDefinition|. g:ale_disable_lsp *g:ale_disable_lsp* @@ -1118,7 +1233,7 @@ g:ale_list_window_size *g:ale_list_window_size* g:ale_lint_delay *g:ale_lint_delay* - + *b:ale_lint_delay* Type: |Number| Default: `200` @@ -1126,6 +1241,9 @@ g:ale_lint_delay *g:ale_lint_delay* be run after text is changed. This option is only meaningful with the |g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`. + A buffer-local option, `b:ale_lint_delay`, can be set to change the delay + for different buffers, such as in |ftplugin| files. + g:ale_lint_on_enter *g:ale_lint_on_enter* @@ -1238,6 +1356,7 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'csh': 'sh', \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', + \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', \ 'systemverilog': 'verilog', @@ -1282,6 +1401,90 @@ g:ale_linter_aliases *g:ale_linter_aliases* < No linters will be loaded when the buffer's filetype is empty. + +g:ale_filename_mappings *g:ale_filename_mappings* + *b:ale_filename_mappings* + + Type: |Dictionary| or |List| + Default: `{}` + + Either a |Dictionary| mapping a linter or fixer name, as displayed in + |:ALEInfo|, to a |List| of two-item |List|s for filename mappings, or just a + |List| of two-item |List|s. When given some paths to files, the value of + this setting will be used to convert filenames on a local file system to + filenames on some remote file system, such as paths in a Docker image, + virtual machine, or network drive. + + For example: > + + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \} +< + With the above configuration, a filename such as `/home/john/proj/foo.py` + will be provided to the linter/fixer as `/data/foo.py`, and paths parsed + from linter results such as `/data/foo.py` will be converted back to + `/home/john/proj/foo.py`. + + You can use `*` as to apply a |List| of filename mappings to all other + linters or fixers not otherwise matched. > + + " Use one List of paths for pylint. + " Use another List of paths for everything else. + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \ '*': [ + \ ['/home/john/proj', '/other-data'], + \ ], + \} +< + If you just want every single linter or fixer to use the same filename + mapping, you can just use a |List|. > + + " Same as above, but for ALL linters and fixers. + let g:ale_filename_mappings = [ + \ ['/home/john/proj', '/data'], + \] +< + You can provide many such filename paths for multiple projects. Paths are + matched by checking if the start of a file path matches the given strings, + in a case-sensitive manner. Earlier entries in the |List| will be tried + before later entries when mapping to a given file system. + + Buffer-local options can be set to the same values to override the global + options, such as in |ftplugin| files. + + NOTE: Only fixers registered with a short name can support filename mapping + by their fixer names. See |ale-fix|. Filename mappings set for all tools by + using only a |List| for the setting will also be applied to fixers not in + the registry. + + NOTE: In order for this filename mapping to work correctly, linters and + fixers must exclusively determine paths to files to lint or fix via ALE + command formatting as per |ale-command-format-strings|, and paths parsed + from linter files must be provided in `filename` keys if a linter returns + results for more than one file at a time, as per |ale-loclist-format|. If + you discover a linter or fixer which does not behave properly, please report + it as an issue. + + If you are running a linter or fixer through Docker or another remote file + system, you may have to mount your temporary directory, which you can + discover with the following command: > + + :echo fnamemodify(tempname(), ':h:h') +< + You should provide a mapping from this temporary directory to whatever you + mount this directory to in Docker, or whatever remote file system you are + working with. + + You can inspect the filename mappings ALE will use with the + |ale#GetFilenameMappings()| function. + + g:ale_linters *g:ale_linters* *b:ale_linters* Type: |Dictionary| @@ -1302,7 +1505,7 @@ g:ale_linters *g:ale_linters* \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], - \ 'rust': ['cargo'], + \ 'rust': ['cargo', 'rls'], \ 'spec': [], \ 'text': [], \ 'vue': ['eslint', 'vls'], @@ -2318,16 +2521,15 @@ documented in additional help files. bibclean..............................|ale-bib-bibclean| c.......................................|ale-c-options| astyle................................|ale-c-astyle| - clang.................................|ale-c-clang| + cc....................................|ale-c-cc| + ccls..................................|ale-c-ccls| clangd................................|ale-c-clangd| clang-format..........................|ale-c-clangformat| clangtidy.............................|ale-c-clangtidy| cppcheck..............................|ale-c-cppcheck| cquery................................|ale-c-cquery| flawfinder............................|ale-c-flawfinder| - gcc...................................|ale-c-gcc| uncrustify............................|ale-c-uncrustify| - ccls..................................|ale-c-ccls| chef....................................|ale-chef-options| cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| @@ -2341,9 +2543,10 @@ documented in additional help files. cmake-format..........................|ale-cmake-cmakeformat| cpp.....................................|ale-cpp-options| astyle................................|ale-cpp-astyle| - clang.................................|ale-cpp-clang| - clangd................................|ale-cpp-clangd| + cc....................................|ale-cpp-cc| + ccls..................................|ale-cpp-ccls| clangcheck............................|ale-cpp-clangcheck| + clangd................................|ale-cpp-clangd| clang-format..........................|ale-cpp-clangformat| clangtidy.............................|ale-cpp-clangtidy| clazy.................................|ale-cpp-clazy| @@ -2351,9 +2554,7 @@ documented in additional help files. cpplint...............................|ale-cpp-cpplint| cquery................................|ale-cpp-cquery| flawfinder............................|ale-cpp-flawfinder| - gcc...................................|ale-cpp-gcc| uncrustify............................|ale-cpp-uncrustify| - ccls..................................|ale-cpp-ccls| c#......................................|ale-cs-options| csc...................................|ale-cs-csc| mcs...................................|ale-cs-mcs| @@ -2501,6 +2702,7 @@ documented in additional help files. luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| markdown................................|ale-markdown-options| + markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| prettier..............................|ale-markdown-prettier| remark-lint...........................|ale-markdown-remark-lint| @@ -2763,18 +2965,29 @@ ALEFindReferences *ALEFindReferences* The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + The selection can be opened again with the |ALERepeatSelection| command. You can jump back to the position you were at before going to a reference of something with jump motions like CTRL-O. See |jump-motions|. A plug mapping `<Plug>(ale_find_references)` is defined for this command. + You can define additional plug mapping with any additional options you want + like so: > + nnoremap <silent> <Plug>(my_mapping) :ALEFindReferences -relative<Return> +< ALEFix *ALEFix* Fix problems with the current buffer. See |ale-fix| for more information. + If the command is run with a bang (`:ALEFix!`), all warnings will be + suppressed, including warnings about no fixers being defined, and warnings + about not being able to apply fixes to a file because it has been changed. + A plug mapping `<Plug>(ale_fix)` is defined for this command. @@ -2807,7 +3020,13 @@ ALEGoToDefinition `<options>` *ALEGoToDefinition* command. Otherwise, Vim will refuse to leave the buffer you're jumping from unless you have saved your edits. - A plug mapping `<Plug>(ale_go_to_definition)` is defined for this command. + The following Plug mappings are defined for this command, which correspond + to the following commands. + + `<Plug>(ale_go_to_definition)` - `:ALEGoToDefinition` + `<Plug>(ale_go_to_definition_in_tab)` - `:ALEGoToDefinition -tab` + `<Plug>(ale_go_to_definition_in_split)` - `:ALEGoToDefinition -split` + `<Plug>(ale_go_to_definition_in_vsplit)` - `:ALEGoToDefinition -vsplit` ALEGoToTypeDefinition *ALEGoToTypeDefinition* @@ -2829,8 +3048,13 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. - A plug mapping `<Plug>(ale_go_to_type_definition)` is defined for this - command. + The following Plug mappings are defined for this command, which correspond + to the following commands. + + `<Plug>(ale_go_to_type_definition)` - `:ALEGoToTypeDefinition` + `<Plug>(ale_go_to_type_definition_in_tab)` - `:ALEGoToTypeDefinition -tab` + `<Plug>(ale_go_to_type_definition_in_split)` - `:ALEGoToTypeDefinition -split` + `<Plug>(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit` ALEHover *ALEHover* @@ -2846,6 +3070,23 @@ ALEHover *ALEHover* A plug mapping `<Plug>(ale_hover)` is defined for this command. +ALEImport *ALEImport* + + Try to import a symbol using `tsserver` or a Language Server. + + ALE will look for completions for the word at the cursor which contain + additional text edits that possible insert lines to import the symbol. The + first match with additional text edits will be used, and may add other code + to the current buffer other than import lines. + + If linting is enabled, and |g:ale_lint_on_text_changed| is set to ever check + buffers when text is changed, the buffer will be checked again after changes + are made. + + A Plug mapping `<Plug>(ale_import)` is defined for this command. This + mapping should only be bound for normal mode. + + ALEOrganizeImports *ALEOrganizeImports* Organize imports using tsserver. Currently not implemented for LSPs. @@ -2853,9 +3094,10 @@ ALEOrganizeImports *ALEOrganizeImports* ALERename *ALERename* - Rename a symbol using TypeScript server or Language Server. + Rename a symbol using `tsserver` or a Language Server. - The user will be prompted for a new name. + The symbol where the cursor is resting will be the symbol renamed, and a + prompt will open to request a new name. ALERepeatSelection *ALERepeatSelection* @@ -2870,18 +3112,28 @@ ALESymbolSearch `<query>` *ALESymbolSearch* The arguments provided to this command will be used as a search query for finding symbols in the workspace, such as functions, types, etc. + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + *:ALELint* ALELint *ALELint* Run ALE once for the current buffer. This command can be used to run ALE manually, instead of automatically, if desired. - This command will also run linters where `lint_file` is set to `1`, or in - other words linters which check the file instead of the Vim buffer. + This command will also run linters where `lint_file` is evaluates to `1`, + meaning linters which check the file instead of the Vim buffer. A plug mapping `<Plug>(ale_lint)` is defined for this command. +ALELintStop *ALELintStop* + + Stop any currently running jobs for checking the current buffer. + + Any problems from previous linter results will continue to be shown. + + ALEPrevious *ALEPrevious* ALEPreviousWrap *ALEPreviousWrap* ALENext *ALENext* @@ -3059,6 +3311,15 @@ ale#Env(variable_name, value) *ale#Env()* 'set VAR="some value" && command' # On Windows +ale#GetFilenameMappings(buffer, name) *ale#GetFilenameMappings()* + + Given a `buffer` and the `name` of either a linter for fixer, return a + |List| of two-item |List|s that describe mapping to and from the local and + foreign file systems for running a particular linter or fixer. + + See |g:ale_filename_mappings| for details on filename mapping. + + ale#Has(feature) *ale#Has()* Return `1` if ALE supports a given feature, like |has()| for Vim features. @@ -3081,9 +3342,9 @@ ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()* The linters will always be run in the background. Calling this function again from the same buffer - An optional `linting_flag` argument can be given. If `linting_flag` - is `'lint_file'`, then linters where the `lint_file` option is set to `1` will be - run. Linters with `lint_file` set to `1` are not run by default. + An optional `linting_flag` argument can be given. If `linting_flag` is + `'lint_file'`, then linters where the `lint_file` option evaluates to `1` + will be run. Otherwise, those linters will not be run. An optional `buffer_number` argument can be given for specifying the buffer to check. The active buffer (`bufnr('')`) will be checked by default. @@ -3173,23 +3434,36 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* < The following `options` can be provided. - `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for - selecting which output streams to read lines from. + `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or + `'none`' for selecting which output streams to read + lines from. - The default is `'stdout'` + The default is `'stdout'` - `executable` - An executable for formatting into `%e` in the command. - If this option is not provided, formatting commands with - `%e` will not work. + `executable` - An executable for formatting into `%e` in the + command. If this option is not provided, formatting + commands with `%e` will not work. - `read_buffer` - If set to `1`, the buffer will be piped into the - command. + `read_buffer` - If set to `1`, the buffer will be piped into the + command. - The default is `0`. + The default is `0`. + + `input` - When creating temporary files with `%t` or piping + text into a command `input` can be set to a |List| of + text to use instead of the buffer's text. + + `filename_mappings` - A |List| of two-item |List|s describing filename + mappings to apply for formatted filenames in the + command string, as per |g:ale_filename_mappings|. + + If the call to this function is being used for a + linter or fixer, the mappings should be provided with + this option, and can be retrieved easily with + |ale#GetFilenameMappings()|. + + The default is `[]`. - `input` - When creating temporary files with `%t` or piping text - into a command `input` can be set to a |List| of text to - use instead of the buffer's text. ale#command#EscapeCommandPart(command_part) *ale#command#EscapeCommandPart()* @@ -3404,24 +3678,30 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* if a command manually reads from a temporary file instead, etc. + This option behaves as if it was set to `0` when the + `lint_file` option evaluates to `1`. + *ale-lint-file* - `lint_file` A |Number| (`0` or `1`) indicating whether a command - should read the file instead of the Vim buffer. This - option can be used for linters which must check the - file on disk, and which cannot check a Vim buffer - instead. - - Linters set with this option will not be run as a - user types, per |g:ale_lint_on_text_changed|. Linters - will instead be run only when events occur against - the file on disk, including |g:ale_lint_on_enter| - and |g:ale_lint_on_save|. Linters with this option - set to `1` will also be run when linters are run - manually, per |ALELintPost-autocmd|. - - When this option is set to `1`, `read_buffer` will - be set automatically to `0`. The two options cannot - be used together. + `lint_file` A |Number| (`0` or `1`), or a |Funcref| for a function + accepting a buffer number for computing either `0` or + `1`, indicating whether a command should read the file + instead of the Vim buffer. This option can be used + for linters which must check the file on disk, and + which cannot check a Vim buffer instead. + + The result can be computed with |ale#command#Run()|. + + Linters where the eventual value of this option + evaluates to `1` will not be run as a user types, per + |g:ale_lint_on_text_changed|. Linters will instead be + run only when events occur against the file on disk, + including |g:ale_lint_on_enter| and + |g:ale_lint_on_save|. Linters where this option + evaluates to `1` will also be run when the |ALELint| + command is run. + + When this option is evaluates to `1`, ALE will behave + as if `read_buffer` was set to `0`. *ale-lsp-linters* `lsp` A |String| for defining LSP (Language Server Protocol) @@ -3560,6 +3840,16 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* command, so literal character sequences `%s` and `%t` can be escaped by using `%%s` and `%%t` instead, etc. + Some |filename-modifiers| can be applied to `%s` and `%t`. Only `:h`, `:t`, + `:r`, and `:e` may be applied, other modifiers will be ignored. Filename + modifiers can be applied to the format markers by placing them after them. + + For example: > + 'command': '%s:h %s:e %s:h:t', +< + Given a path `/foo/baz/bar.txt`, the above command string will generate + something akin to `'/foo/baz' 'txt' 'baz'` + If a callback for a command generates part of a command string which might possibly contain `%%`, `%s`, `%t`, or `%e`, where the special formatting behavior is not desired, the |ale#command#EscapeCommandPart()| function can @@ -3709,6 +3999,23 @@ g:ale_want_results_buffer *g:ale_want_results_buffer* figure out which buffer other sources should lint. +ALECompletePost *ALECompletePost-autocmd* + *ALECompletePost* + + This |User| autocmd is triggered after ALE inserts an item on + |CompleteDone|. This event can be used to run commands after a buffer + is changed by ALE as the result of completion. For example, |ALEFix| can + be configured to run automatically when completion is done: > + + augroup FixAfterComplete + autocmd! + " Run ALEFix when completion items are added. + autocmd User ALECompletePost ALEFix! + " If ALE starts fixing a file, stop linters running for now. + autocmd User ALEFixPre ALELintStop + augroup END +< + ALELintPre *ALELintPre-autocmd* *ALELintPre* ALELintPost *ALELintPost-autocmd* |