dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.57k stars 1.44k forks source link

Improve documentation on how to configure linters #4544

Closed MaxG87 closed 1 year ago

MaxG87 commented 1 year ago

Today it took me quite some time to figure out how I could pass custom arguments to linters I use with ALE. I went through the documentation now, searching for "argument" and checking all "let g:" snippets, but could not find any example.

I think this is a very cool and helpful feature. I want to ask to improve the documentation such that by reading the README one is able to find an explanation or a pointer to it.

pbnj commented 1 year ago

@MaxG87 - Improving docs is a good idea. I am curious if you used vim's built-in help system to read through ale's docs and didn't find what you need?

For example, in vim, you can run :h g:ale_<language>_<linter>_options, like :h g:ale_python_pylint_options, this shows the following docs

g:ale_python_pylint_options                       *g:ale_python_pylint_options*
                                                  *b:ale_python_pylint_options*
  Type: |String|
  Default: `''`

  This variable can be changed to add command-line arguments to the pylint
  invocation.

  For example, to dynamically switch between programs targeting Python 2 and
  Python 3, you may want to set >

  let g:ale_python_pylint_executable = 'python3'   " or 'python' for Python 2
  let g:ale_python_pylint_options = '--rcfile /path/to/pylint.rc'
  " The virtualenv detection needs to be disabled.
  let g:ale_python_pylint_use_global = 0

  after making sure it's installed for the appropriate Python versions (e.g.
  `python3 -m pip install --user pylint`).
MaxG87 commented 1 year ago

I went through the README of this repository. I wasn't aware of the :h g:ale_... documentation, but I must admit that I find the build in documentation of VIM a bit hard to approach. Maybe I haven't get used to it so far, but that's why I checked the README file.

pbnj commented 1 year ago

I recommend getting to learn vim's :help and :helpgrep system as it is by far the most basic and the best way of finding information about virtually anything in vim.

Alternatively, you can use the GitHub search functionality on this repo to search for relevant keywords (e.g. ale python pylint) and find relevant information. The ale documentation you get using Vim's :help is stored in doc/ directory in this repo. For example, see doc/ale-python.txt.