1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-07-19 14:52:53 +02:00
parent 2f164fee9b
commit cc997dc3d0
99 changed files with 1572 additions and 1151 deletions

View File

@ -10,6 +10,7 @@ CONTENTS *ale-development-contents*
2. Design Goals.........................|ale-design-goals|
3. Coding Standards.....................|ale-coding-standards|
4. Testing ALE..........................|ale-development-tests|
4.1. Writing Linter Tests.............|ale-development-linter-tests|
===============================================================================
1. Introduction *ale-development-introduction*
@ -111,6 +112,9 @@ these are reported with ALE's `custom-linting-rules` script. See
* Don't use the `shellescape()` function. It doesn't escape arguments properly
on Windows. Use `ale#Escape()` instead, which will avoid escaping where it
isn't needed, and generally escape arguments better on Windows.
* Don't use the `tempname()` function. It doesn't work when `$TMPDIR` isn't
set. Use `ale#util#Tempname()` instead, which temporarily sets `$TMPDIR`
appropriately where needed.
Apply the following guidelines when writing Vader test files.
@ -170,6 +174,9 @@ Look at existing tests in the codebase for examples of how to write tests.
Refer to the Vader documentation for general information on how to write Vader
tests: https://github.com/junegunn/vader.vim
See |ale-development-linter-tests| for more information on how to write linter
tests.
When you add new linters or fixers, make sure to add them into the table in
the README, and also into the |ale-support| list in the main help file. If you
forget to keep them both in sync, you should see an error like the following
@ -219,5 +226,82 @@ margin. For example, if you add a heading for an `aardvark` tool to
Make sure to make the table of contents match the headings, and to keep the
doc tags on the right margin.
===============================================================================
4.1 Writing Linter Tests *ale-development-linter-tests*
Tests for ALE linters take two forms.
1. Tests for handling the output of commands.
2. Tests for checking which commands are run, or connections are made.
Tests of the first form should go in the `test/handler` directory, and should
be written like so. >
Before:
" Load the file which defines the linter.
runtime ale_linters/filetype/linter_name_here.vim
After:
" Unload all linters again.
call ale#linter#Reset()
Execute(The output should be correct):
" Test that the right loclist items are parsed from the handler.
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': 'Something went wrong',
\ },
\ ],
\ ale_linters#filetype#linter_name#Handle(bufnr(''), [
\ '1:Something went wrong',
\ ]
<
Tests for what ALE runs should go in the `test/command_callback` directory,
and should be written like so. >
Before:
" Load the linter and set up a series of commands, reset linter variables,
" clear caches, etc.
"
" Vader's 'Save' command will be called here for linter variables.
call ale#assert#SetUpLinterTest('filetype', 'linter_name')
After:
" Reset linters, variables, etc.
"
" Vader's 'Restore' command will be called here.
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
" AssertLinter checks the executable and command.
" Pass expected_executable, expected_command
AssertLinter 'some-command', ale#Escape('some-command') . ' --foo'
Execute(Check chained commands):
" WithChainResults can be called with 1 or more list for passing output
" to chained commands. The output for each callback defaults to an empty
" list.
WithChainResults ['v2.1.2']
" Given a List of commands, check all of them.
" Given a String, only the last command in the chain will be checked.
AssertLinter 'some-command', [
\ ale#Escape('some-command') . ' --version',
\ ale#Escape('some-command') . ' --foo',
\]
<
The full list of commands that will be temporarily defined for linter tests
given the above setup are as follows.
`WithChainResults [...]` - Define output for command chain functions.
`AssertLinter executable, command` - Check the executable and command.
`AssertLinterNotExecuted` - Check that linters will not be executed.
`AssertLSPLanguage language` - Check the language given to an LSP server.
`AssertLSPOptions options_dict` - Check the options given to an LSP server.
`AssertLSPProject project_root` - Check the root given to an LSP server.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -87,4 +87,19 @@ g:ale_kotlin_ktlint_rulesets *g:ale_kotlin_ktlint_rulesets*
let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom-rulset.jar',
'com.ktlint.rulesets:mycustomrule:1.0.0']
===============================================================================
languageserver *ale-kotlin-languageserver*
g:ale_kotlin_languageserver_executable *g:ale_kotlin_languageserver_executable*
Type: |String|
Default: `''`
The kotlin-language-server executable.
Executables are located inside the bin/ folder of the language server
release.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -28,6 +28,33 @@ prettier *ale-markdown-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
remark-lint *ale-markdown-remark-lint*
g:ale_markdown_remark_lint_executable *g:ale_markdown_remark_lint_executable*
*b:ale_markdown_remark_lint_executable*
Type: |String|
Default: `'remark'`
See |ale-integrations-local-executables|
g:ale_markdown_remark_lint_options *g:ale_markdown_remark_lint_options*
*b:ale_markdown_remark_lint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to remark-lint.
g:ale_markdown_remark_lint_use_global *g:ale_markdown_remark_lint_use_global*
*b:ale_markdown_remark_lint_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
textlint *ale-markdown-textlint*

View File

@ -22,5 +22,16 @@ g:ale_puppet_puppetlint_options *g:ale_puppet_puppetlint_options*
puppet-lint invocation.
===============================================================================
puppet-languageserver *ale-puppet-languageserver*
g:ale_puppet_languageserver_executable *g:ale_puppet_languageserver_executable*
*b:ale_puppet_languageserver_executable*
type: |String|
Default: `'puppet-languageserver'`
This variable can be used to specify the executable used for
puppet-languageserver.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -22,6 +22,8 @@ ALE will look for configuration files with the following filenames. >
mypy.ini
pycodestyle.cfg
flake8.cfg
Pipfile
Pipfile.lock
<
The first directory containing any of the files named above will be used.
@ -145,6 +147,14 @@ g:ale_python_isort_executable *g:ale_python_isort_executable*
See |ale-integrations-local-executables|
g:ale_python_isort_options *g:ale_python_isort_options*
*b:ale_python_isort_options*
Type: |String|
Default: `''`
This variable can be set to pass extra options to isort.
g:ale_python_isort_use_global *g:ale_python_isort_use_global*
*b:ale_python_isort_use_global*
Type: |Number|

View File

@ -41,8 +41,8 @@ To disable `scalastyle` globally, use |g:ale_linters| like so: >
See |g:ale_linters| for more information on disabling linters.
g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc*
g:ale_scala_scalastyle_config *g:ale_scala_scalastyle_config*
*b:ale_scala_scalastyle_config*
Type: |String|
Default: `''`
@ -54,7 +54,7 @@ g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc*
g:ale_scala_scalastyle_options *g:ale_scala_scalastyle_options*
*b:ale_scala_scalastyle_options*
Type: |String|
Default: `''`

View File

@ -7,5 +7,25 @@ prettier *ale-vue-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
vls *ale-vue-vls*
g:ale_vue_vls_executable *g:ale_vue_vls_executable*
*b:ale_vue_vls_executable*
Type: |String|
Default: `'vls'`
See |ale-integrations-local-executables|
g:ale_vue_vls_use_global *g:ale_vue_vls_use_global*
*b:ale_vue_vls_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -131,6 +131,7 @@ CONTENTS *ale-contents*
kotlin................................|ale-kotlin-options|
kotlinc.............................|ale-kotlin-kotlinc|
ktlint..............................|ale-kotlin-ktlint|
languageserver......................|ale-kotlin-languageserver|
latex.................................|ale-latex-options|
write-good..........................|ale-latex-write-good|
less..................................|ale-less-options|
@ -145,6 +146,7 @@ CONTENTS *ale-contents*
markdown..............................|ale-markdown-options|
mdl.................................|ale-markdown-mdl|
prettier............................|ale-markdown-prettier|
remark-lint.........................|ale-markdown-remark-lint|
textlint............................|ale-markdown-textlint|
write-good..........................|ale-markdown-write-good|
mercury...............................|ale-mercury-options|
@ -186,6 +188,7 @@ CONTENTS *ale-contents*
puglint.............................|ale-pug-puglint|
puppet................................|ale-puppet-options|
puppetlint..........................|ale-puppet-puppetlint|
puppet-languageserver...............|ale-puppet-languageserver|
pyrex (cython)........................|ale-pyrex-options|
cython..............................|ale-pyrex-cython|
python................................|ale-python-options|
@ -273,6 +276,7 @@ CONTENTS *ale-contents*
write-good..........................|ale-vim-help-write-good|
vue...................................|ale-vue-options|
prettier............................|ale-vue-prettier|
vls.................................|ale-vue-vls|
xhtml.................................|ale-xhtml-options|
write-good..........................|ale-xhtml-write-good|
xml...................................|ale-xml-options|
@ -366,7 +370,7 @@ Notes:
* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo`
* JSON: `fixjson`, `jsonlint`, `jq`, `prettier`
* Kotlin: `kotlinc`, `ktlint`
* Kotlin: `kotlinc`!!, `ktlint`!!, `languageserver`
* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good`
* Less: `lessc`, `prettier`, `stylelint`
* LLVM: `llc`
@ -390,7 +394,7 @@ Notes:
* Pony: `ponyc`
* proto: `protoc-gen-lint`
* Pug: `pug-lint`
* Puppet: `puppet`, `puppet-lint`
* Puppet: `languageserver`, `puppet`, `puppet-lint`
* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `yapf`
* QML: `qmlfmt`, `qmllint`
* R: `lintr`
@ -418,7 +422,7 @@ Notes:
* Verilog: `iverilog`, `verilator`
* Vim: `vint`
* Vim help^: `alex`!!, `proselint`, `write-good`
* Vue: `prettier`
* Vue: `prettier`, `vls`
* XHTML: `alex`!!, `proselint`, `write-good`
* XML: `xmllint`
* YAML: `swaglint`, `yamllint`
@ -444,14 +448,20 @@ have even saved your changes. ALE will check your code in the following
circumstances, which can be configured with the associated options.
* When you modify a buffer. - |g:ale_lint_on_text_changed|
* On leaving insert mode. (off by default) - |g:ale_lint_on_insert_leave|
* When you open a new or modified buffer. - |g:ale_lint_on_enter|
* When you save a buffer. - |g:ale_lint_on_save|
* When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed|
* If ALE is used to check code manually. - |:ALELint|
In addition to the above options, ALE can also check buffers for errors when
you leave insert mode with |g:ale_lint_on_insert_leave|, which is off by
default. It is worth reading the documentation for every option.
*ale-lint-settings-on-startup*
It is worth reading the documentation for every option. You should configure
which events ALE will use before ALE is loaded, so it can optimize which
autocmd commands to run. You can force autocmd commands to be reloaded with
`:ALEDisable | ALEEnable`
This also applies to the autocmd commands used for |g:ale_echo_cursor|.
*ale-lint-file-linters*
@ -641,9 +651,6 @@ ALE supports the following LSP/tsserver features.
-------------------------------------------------------------------------------
5.1 Completion *ale-completion*
NOTE: At the moment, only `tsserver` for TypeScript code is supported for
completion.
ALE offers limited support for automatic completion of code while you type.
Completion is only supported while a least one LSP linter is enabled. ALE
will only suggest symbols provided by the LSP servers.
@ -842,6 +849,9 @@ g:ale_echo_cursor *g:ale_echo_cursor*
this behaviour.
The format of the message can be customizable in |g:ale_echo_msg_format|.
You should set this setting once before ALE is loaded, and restart Vim if
you want to change your preferences. See |ale-lint-settings-on-startup|.
g:ale_echo_delay *g:ale_echo_delay*
*b:ale_echo_delay*
@ -1042,19 +1052,16 @@ g:ale_lint_on_enter *g:ale_lint_on_enter*
Type: |Number|
Default: `1`
When this option is set to `1`, the |BufWinEnter| and |BufRead| events will
be used to apply linters when buffers are first opened. If this is not
desired, this variable can be set to `0` in your vimrc file to disable this
behaviour.
When this option is set to `1`, the |BufWinEnter| event will be used to
apply linters when buffers are first opened. If this is not desired, this
variable can be set to `0` in your vimrc file to disable this behavior.
The |FileChangedShellPost| and |BufEnter| events will be used to check if
files have been changed outside of Vim. If a file is changed outside of
Vim, it will be checked when it is next opened.
A |BufWinLeave| event will be used to look for the |E924|, |E925|, or |E926|
errors after moving from a loclist or quickfix window to a new buffer. If
prompts for these errors are opened after moving to new buffers, then ALE
will automatically send the `<CR>` key needed to close the prompt.
You should set this setting once before ALE is loaded, and restart Vim if
you want to change your preferences. See |ale-lint-settings-on-startup|.
g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed*
@ -1062,14 +1069,13 @@ g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed*
Type: |Number|
Default: `1`
This option will cause ALE to run whenever the filetype is changed. A short
delay will be used before linting will be done, so the filetype can be
changed quickly several times in a row, but resulting in only one lint
cycle.
This option will cause ALE to run when the filetype for a file is changed
after a buffer has first been loaded. A short delay will be used before
linting will be done, so the filetype can be changed quickly several times
in a row, but resulting in only one lint cycle.
If |g:ale_lint_on_enter| is set to `0`, then ALE will not lint a file when
the filetype is initially set. Otherwise ALE would still lint files when
buffers are opened, and the option for doing so is turned off.
You should set this setting once before ALE is loaded, and restart Vim if
you want to change your preferences. See |ale-lint-settings-on-startup|.
g:ale_lint_on_save *g:ale_lint_on_save*
@ -1087,17 +1093,22 @@ g:ale_lint_on_save *g:ale_lint_on_save*
g:ale_lint_on_text_changed *g:ale_lint_on_text_changed*
Type: |String|
Default: `always`
Default: `'always'`
By default, ALE will check files with the various supported programs when
text is changed by using the |TextChanged| event. If this behaviour is not
desired, then this option can be disabled by setting it to `never`. The
|g:ale_lint_delay| variable will be used to set a |timer_start()| on a
delay, and each change to a file will continue to call |timer_stop()| and
|timer_start()| repeatedly until the timer ticks by, and the linters will be
run. The checking of files will run in the background, so it should not
inhibit editing files. This option can also be set to `insert` or `normal`
to lint when text is changed only in insert or normal mode respectively.
This option controls how ALE will check your files as you make changes.
The following values can be used.
`'always'`, `'1'`, or `1` - Check buffers on |TextChanged| or |TextChangedI|.
`'normal'` - Check buffers only on |TextChanged|.
`'insert'` - Check buffers only on |TextChangedI|.
`'never'`, `'0'`, or `0` - Never check buffers on changes.
ALE will check buffers after a short delay, with a timer which resets on
each change. The delay can be configured by adjusting the |g:ale_lint_delay|
variable.
You should set this setting once before ALE is loaded, and restart Vim if
you want to change your preferences. See |ale-lint-settings-on-startup|.
g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave*
@ -1115,6 +1126,9 @@ g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave*
" Make using Ctrl+C do the same as Escape, to trigger autocmd commands
inoremap <C-c> <Esc>
<
You should set this setting once before ALE is loaded, and restart Vim if
you want to change your preferences. See |ale-lint-settings-on-startup|.
g:ale_linter_aliases *g:ale_linter_aliases*
*b:ale_linter_aliases*
@ -1360,7 +1374,7 @@ g:ale_open_list *g:ale_open_list*
g:ale_pattern_options *g:ale_pattern_options*
Type: |Dictionary|
Default: `{}`
Default: undefined
This option maps regular expression patterns to |Dictionary| values for
buffer variables. This option can be set to automatically configure
@ -1389,12 +1403,10 @@ g:ale_pattern_options *g:ale_pattern_options*
g:ale_pattern_options_enabled *g:ale_pattern_options_enabled*
Type: |Number|
Default: `!empty(g:ale_pattern_options)`
Default: undefined
This option can be used for turning the behaviour of setting
|g:ale_pattern_options| on or off. By default, setting a single key for
|g:ale_pattern_options| will turn this option on, as long as the setting is
configured before ALE is loaded.
This option can be used for disabling pattern options. If set to `0`, ALE
will not set buffer variables per |g:ale_pattern_options|.
g:ale_set_balloons *g:ale_set_balloons*
@ -1636,7 +1648,7 @@ g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
Type: |List|
Default: `['.env', 'env', 've-py3', 've', 'virtualenv', 'venv']`
Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']`
A list of directory names to be used when searching upwards from Python
files to discover virtulenv directories with.
@ -2075,6 +2087,29 @@ ALEStopAllLSPs *ALEStopAllLSPs*
===============================================================================
9. API *ale-api*
ALE offers a number of functions for running linters or fixers, or defining
them. The following functions are part of the publicly documented part of that
API, and should be expected to continue to work.
ale#Env(variable_name, value) *ale#Env()*
Given a variable name and a string value, produce a string for including in
a command for setting environment variables. This function can be used for
building a command like so. >
:echo string(ale#Env('VAR', 'some value') . 'command')
'VAR=''some value'' command' # On Linux or Mac OSX
'set VAR="some value" && command' # On Windows
ale#Pad(string) *ale#Pad()*
Given a string or any |empty()| value, return either the string prefixed
with a single space, or an empty string. This function can be used to build
parts of a command from variables.
ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()*
Run linters for the current buffer, based on the filetype of the buffer,
@ -2099,8 +2134,17 @@ ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()*
ale#engine#CreateDirectory(buffer) *ale#engine#CreateDirectory()*
Create a new temporary directory with a unique name, and manage that
directory with |ale#engine#ManageDirectory()|, so it will be removed as
soon as possible.
directory with |ale#engine#ManageDirectory()|, so it will be removed as soon
as possible.
It is advised to only call this function from a callback function for
returning a linter command to run.
ale#engine#CreateFile(buffer) *ale#engine#CreateFile()*
Create a new temporary file with a unique name, and manage that file with
|ale#engine#ManageFile()|, so it will be removed as soon as possible.
It is advised to only call this function from a callback function for
returning a linter command to run.
@ -2206,6 +2250,10 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
defined, as LSP linters handle diagnostics
automatically. See |ale-lsp-linters|.
If the function named does not exist, including if
the function is later deleted, ALE will behave as if
the callback returned an empty list.
The keys for each item in the List will be handled in
the following manner:
*ale-loclist-format*
@ -2383,9 +2431,12 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
with a callback returning an address to connect to.
ALE will not start a server automatically.
When this argument is not empty, only one of either
`language` or `language_callback` must be defined,
and `project_root_callback` must be defined.
When this argument is not empty
`project_root_callback` must be defined.
`language` or `language_callback` can be defined to
describe the language for a file. The filetype will
be used as the language by default.
LSP linters handle diagnostics automatically, so
the `callback` argument must not be defined.
@ -2418,8 +2469,9 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
being checked. This string will be sent to the LSP to
tell it what type of language is being checked.
This argument must only be set if the `lsp` argument
is also set to a non-empty string.
If this or `language_callback` isn't set, the
language will default to the value of the filetype
given to |ale#linter#Define|.
`language_callback` A |String| or |Funcref| for a callback function
accepting a buffer number. A |String| should be
@ -2489,15 +2541,23 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
For example: >
'command': 'ghc -fno-code -v0 %t',
<
Any substring `%e` will be replaced with the escaped executable supplied
with `executable` or `executable_callback`. This provides a convenient way
to define a command string which needs to include a dynamic executable name,
but which is otherwise static.
For example: >
'command': '%e --some-argument',
<
The character sequence `%%` can be used to emit a literal `%` into a
command, so literal character sequences `%s` and `%t` can be escaped by
using `%%s` and `%%t` instead, etc.
If a callback for a command generates part of a command string which might
possibly contain `%%`, `%s`, or `%t` where the special formatting behaviour
is not desired, the |ale#engine#EscapeCommandPart()| function can be used to
replace those characters to avoid formatting issues.
possibly contain `%%`, `%s`, `%t`, or `%e`, where the special formatting
behavior is not desired, the |ale#engine#EscapeCommandPart()| function can
be used to replace those characters to avoid formatting issues.
*ale-linter-loading-behavior*
*ale-linter-loading-behaviour*