2016-10-03 18:41:02 +00:00
|
|
|
" Author: w0rp <devw0rp@gmail.com>
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
" Description: Main entry point for the plugin: sets up prefs and autocommands
|
|
|
|
" Preferences can be set in vimrc files and so on to configure ale
|
2016-09-08 23:23:26 +00:00
|
|
|
|
2016-10-11 14:54:14 +00:00
|
|
|
" Sanity Checks
|
|
|
|
|
2017-02-14 09:18:54 +00:00
|
|
|
if exists('g:loaded_ale_dont_use_this_in_other_plugins_please')
|
2016-09-08 23:23:26 +00:00
|
|
|
finish
|
|
|
|
endif
|
2016-10-25 13:09:58 +00:00
|
|
|
|
2017-02-14 09:18:54 +00:00
|
|
|
" Set a special flag used only by this plugin for preventing doubly
|
|
|
|
" loading the script.
|
|
|
|
let g:loaded_ale_dont_use_this_in_other_plugins_please = 1
|
2016-09-08 23:23:26 +00:00
|
|
|
|
2016-10-10 12:16:32 +00:00
|
|
|
" A flag for detecting if the required features are set.
|
|
|
|
if has('nvim')
|
2023-09-07 18:59:05 +00:00
|
|
|
" We check for NeoVim 0.2.0+, but we only officially support NeoVim 0.6.0
|
2018-08-04 06:52:22 +00:00
|
|
|
let s:has_features = has('timers') && has('nvim-0.2.0')
|
2016-10-10 12:16:32 +00:00
|
|
|
else
|
2016-11-04 10:17:49 +00:00
|
|
|
" Check if Job and Channel functions are available, instead of the
|
|
|
|
" features. This works better on old MacVim versions.
|
|
|
|
let s:has_features = has('timers') && exists('*job_start') && exists('*ch_close_in')
|
2016-10-10 12:16:32 +00:00
|
|
|
endif
|
|
|
|
|
2016-11-04 10:17:49 +00:00
|
|
|
if !s:has_features
|
2017-02-13 23:48:36 +00:00
|
|
|
" Only output a warning if editing some special files.
|
|
|
|
if index(['', 'gitcommit'], &filetype) == -1
|
2022-04-01 13:35:07 +00:00
|
|
|
" no-custom-checks
|
2023-09-07 18:59:05 +00:00
|
|
|
echoerr 'ALE requires NeoVim >= 0.6.0 or Vim 8 with +timers +job +channel'
|
2022-04-01 13:35:07 +00:00
|
|
|
" no-custom-checks
|
|
|
|
echoerr 'Please update your editor appropriately.'
|
2017-02-13 23:48:36 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
" Stop here, as it won't work.
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2017-02-14 09:18:54 +00:00
|
|
|
" Set this flag so that other plugins can use it, like airline.
|
|
|
|
let g:loaded_ale = 1
|
|
|
|
|
2016-10-24 19:21:32 +00:00
|
|
|
" This global variable is used internally by ALE for tracking information for
|
|
|
|
" each buffer which linters are being run against.
|
2016-10-23 21:41:00 +00:00
|
|
|
let g:ale_buffer_info = {}
|
2018-07-04 22:54:14 +00:00
|
|
|
" This global Dictionary tracks data for fixing code. Don't mess with it.
|
|
|
|
let g:ale_fix_buffer_data = {}
|
2016-10-11 14:54:14 +00:00
|
|
|
|
|
|
|
" User Configuration
|
|
|
|
|
2016-10-25 13:09:58 +00:00
|
|
|
" This option prevents ALE autocmd commands from being run for particular
|
|
|
|
" filetypes which can cause issues.
|
2017-07-16 00:15:07 +00:00
|
|
|
let g:ale_filetype_blacklist = [
|
|
|
|
\ 'dirvish',
|
|
|
|
\ 'nerdtree',
|
|
|
|
\ 'qf',
|
|
|
|
\ 'tags',
|
|
|
|
\ 'unite',
|
|
|
|
\]
|
2016-10-25 13:09:58 +00:00
|
|
|
|
2016-10-11 22:11:45 +00:00
|
|
|
" This Dictionary configures which linters are enabled for which languages.
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_linters = get(g:, 'ale_linters', {})
|
2017-11-14 19:55:28 +00:00
|
|
|
" This option can be changed to only enable explicitly selected linters.
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_linters_explicit = get(g:, 'ale_linters_explicit', 0)
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
|
2017-05-18 12:21:14 +00:00
|
|
|
" This Dictionary configures which functions will be used for fixing problems.
|
|
|
|
let g:ale_fixers = get(g:, 'ale_fixers', {})
|
|
|
|
|
2016-10-11 22:11:45 +00:00
|
|
|
" This Dictionary allows users to set up filetype aliases for new filetypes.
|
|
|
|
let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {})
|
|
|
|
|
2016-09-08 23:23:26 +00:00
|
|
|
" This flag can be set with a number of milliseconds for delaying the
|
|
|
|
" execution of a linter when text is changed. The timeout will be set and
|
|
|
|
" cleared each time text is changed, so repeated edits won't trigger the
|
|
|
|
" jobs for linting until enough time has passed after editing is done.
|
2016-10-05 08:27:03 +00:00
|
|
|
let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200)
|
2016-09-08 23:23:26 +00:00
|
|
|
|
2017-03-30 22:21:37 +00:00
|
|
|
" This flag can be set to 'never' to disable linting when text is changed.
|
2019-06-10 19:54:38 +00:00
|
|
|
" This flag can also be set to 'always' or 'insert' to lint when text is
|
|
|
|
" changed in both normal and insert mode, or only in insert mode respectively.
|
|
|
|
let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'normal')
|
2017-03-30 22:21:37 +00:00
|
|
|
|
|
|
|
" This flag can be set to 1 to enable linting when leaving insert mode.
|
2019-06-10 19:54:38 +00:00
|
|
|
let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 1)
|
2016-10-11 14:54:14 +00:00
|
|
|
|
2016-09-08 23:23:26 +00:00
|
|
|
" This flag can be set to 0 to disable linting when the buffer is entered.
|
2016-10-04 20:28:54 +00:00
|
|
|
let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1)
|
2016-09-08 23:23:26 +00:00
|
|
|
|
2016-10-04 20:31:47 +00:00
|
|
|
" This flag can be set to 1 to enable linting when a buffer is written.
|
2017-03-27 19:36:35 +00:00
|
|
|
let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1)
|
2017-02-09 18:47:14 +00:00
|
|
|
|
2017-03-27 21:40:25 +00:00
|
|
|
" This flag can be set to 1 to enable linting when the filetype is changed.
|
|
|
|
let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1)
|
|
|
|
|
2021-02-06 18:49:42 +00:00
|
|
|
" If set to 1, hints and suggestion from LSP servers and tsserver will be shown.
|
|
|
|
let g:ale_lsp_suggestions = get(g:, 'ale_lsp_suggestions', 0)
|
|
|
|
|
2018-05-28 18:19:20 +00:00
|
|
|
" This flag can be set to 1 to enable automatically fixing files on save.
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0)
|
2017-05-30 20:32:51 +00:00
|
|
|
|
2017-02-09 18:47:14 +00:00
|
|
|
" This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle
|
|
|
|
" should be used instead.
|
|
|
|
let g:ale_enabled = get(g:, 'ale_enabled', 1)
|
2016-10-04 20:31:47 +00:00
|
|
|
|
2020-08-23 18:55:42 +00:00
|
|
|
" A Dictionary mapping linter or fixer names to Arrays of two-item Arrays
|
|
|
|
" mapping filename paths from one system to another.
|
|
|
|
let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {})
|
|
|
|
|
2021-03-01 20:51:29 +00:00
|
|
|
" This Dictionary configures the default project roots for various linters.
|
|
|
|
let g:ale_root = get(g:, 'ale_root', {})
|
|
|
|
|
2017-01-22 12:57:05 +00:00
|
|
|
" These flags dictates if ale uses the quickfix or the loclist (loclist is the
|
|
|
|
" default, quickfix overrides loclist).
|
2016-10-04 20:28:54 +00:00
|
|
|
let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1)
|
2017-01-22 12:57:05 +00:00
|
|
|
let g:ale_set_quickfix = get(g:, 'ale_set_quickfix', 0)
|
|
|
|
|
2016-09-08 23:23:26 +00:00
|
|
|
" This flag can be set to 0 to disable setting signs.
|
2016-10-04 20:28:54 +00:00
|
|
|
" This is enabled by default only if the 'signs' feature exists.
|
|
|
|
let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs'))
|
2017-05-21 21:42:27 +00:00
|
|
|
|
2017-02-13 00:18:51 +00:00
|
|
|
" This flag can be set to 0 to disable setting error highlights.
|
|
|
|
let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax'))
|
|
|
|
|
2020-03-11 16:52:41 +00:00
|
|
|
" This List can be configured to exclude particular highlights.
|
|
|
|
let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', [])
|
|
|
|
|
2016-10-11 14:54:14 +00:00
|
|
|
" This flag can be set to 0 to disable echoing when the cursor moves.
|
Implement a more efficient statusbar
The statusbar now keeps its state in a separate variable, in order to
avoid excess iterations. The engine now updates said variable on run,
and a new function is made available for external statusbars to call (to
avoid dependencies on internal implementation details of ale).
To keep things light, the status bar code is not loaded unless invoked
by the user or an external plugin. On the first load it will update
itself from the global loclist, after that, the engine will handle all
updates.
The external integration function, `ale#statusline#Count()`, will return
a tuple in the format [E, W] (where E is errors, W is warnings), unless
no data exists (ie, the plugin doesn't have a linter for a file or has
not run yet), in which case it returns 0/false.
2016-10-11 21:51:01 +00:00
|
|
|
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
|
2018-09-14 11:42:26 +00:00
|
|
|
" This flag can be set to 1 to automatically show errors in the preview window.
|
|
|
|
let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0)
|
|
|
|
|
2022-12-25 19:29:16 +00:00
|
|
|
" This flag can be changed to disable/enable virtual text.
|
2022-12-25 19:43:29 +00:00
|
|
|
let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', (has('nvim-0.3.2') || has('patch-9.0.0297') && has('textprop') && has('popupwin')) ? 'all' : 'disabled')
|
2018-11-07 06:31:35 +00:00
|
|
|
|
2020-08-04 19:07:46 +00:00
|
|
|
" This flag can be set to 1 to enable LSP hover messages at the cursor.
|
|
|
|
let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1)
|
|
|
|
|
2018-09-14 11:42:26 +00:00
|
|
|
" This flag can be set to 1 to automatically close the preview window upon
|
|
|
|
" entering Insert Mode.
|
|
|
|
let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0)
|
|
|
|
|
2017-05-31 21:04:33 +00:00
|
|
|
" This flag can be set to 0 to disable balloon support.
|
2018-07-20 15:10:25 +00:00
|
|
|
let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running'))
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
|
2019-10-12 09:45:12 +00:00
|
|
|
" Use preview window for hover messages.
|
|
|
|
let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0)
|
|
|
|
|
2021-01-14 18:06:20 +00:00
|
|
|
" Float preview windows in Neovim
|
|
|
|
let g:ale_floating_preview = get(g:, 'ale_floating_preview', 0)
|
|
|
|
|
|
|
|
" Hovers use floating windows in Neovim
|
|
|
|
let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0)
|
|
|
|
|
|
|
|
" Detail uses floating windows in Neovim
|
|
|
|
let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 0)
|
|
|
|
|
2022-05-27 04:41:06 +00:00
|
|
|
" Border setting for floating preview windows
|
|
|
|
" The elements in the list set the characters for the left, top, top-left,
|
|
|
|
" top-right, bottom-right, bottom-left, right, and bottom of the border
|
|
|
|
" respectively
|
|
|
|
let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+', '|', '-'])
|
2021-03-01 21:36:05 +00:00
|
|
|
|
2016-10-11 14:54:14 +00:00
|
|
|
" This flag can be set to 0 to disable warnings for trailing whitespace
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1)
|
2017-11-28 10:08:34 +00:00
|
|
|
" This flag can be set to 0 to disable warnings for trailing blank lines
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_warn_about_trailing_blank_lines = get(g:, 'ale_warn_about_trailing_blank_lines', 1)
|
2016-10-11 14:54:14 +00:00
|
|
|
|
2017-02-16 21:33:44 +00:00
|
|
|
" A flag for enabling or disabling the command history.
|
|
|
|
let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1)
|
|
|
|
|
2017-02-16 23:18:57 +00:00
|
|
|
" A flag for storing the full output of commands in the history.
|
2017-07-03 23:16:53 +00:00
|
|
|
let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1)
|
2017-02-16 23:18:57 +00:00
|
|
|
|
2017-07-01 23:28:00 +00:00
|
|
|
" Enable automatic completion with LSP servers and tsserver
|
2018-05-28 16:57:58 +00:00
|
|
|
let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0)
|
2017-12-20 12:20:38 +00:00
|
|
|
|
2018-09-20 07:28:51 +00:00
|
|
|
" Enable automatic detection of pipenv for Python linters.
|
|
|
|
let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0)
|
|
|
|
|
2021-07-25 04:39:05 +00:00
|
|
|
" Enable automatic detection of poetry for Python linters.
|
|
|
|
let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0)
|
|
|
|
|
2023-02-08 09:11:31 +00:00
|
|
|
" Enable automatic adjustment of environment variables for Python linters.
|
|
|
|
" The variables are set based on ALE's virtualenv detection.
|
|
|
|
let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0)
|
|
|
|
|
2019-08-02 08:09:10 +00:00
|
|
|
" This variable can be overridden to set the GO111MODULE environment variable.
|
|
|
|
let g:ale_go_go111module = get(g:, 'ale_go_go111module', '')
|
|
|
|
|
2021-07-25 04:39:56 +00:00
|
|
|
" Default executable for deno, needed set before plugin start
|
|
|
|
let g:ale_deno_executable = get(g:, 'ale_deno_executable', 'deno')
|
|
|
|
|
2020-11-21 01:18:27 +00:00
|
|
|
" If 1, enable a popup menu for commands.
|
2020-11-21 20:16:32 +00:00
|
|
|
let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running'))
|
2020-11-21 01:18:27 +00:00
|
|
|
|
2023-09-05 23:17:27 +00:00
|
|
|
" If 0, save hidden files when code actions are applied.
|
|
|
|
let g:ale_save_hidden = get(g:, 'ale_save_hidden', 0)
|
|
|
|
|
2023-01-29 17:25:09 +00:00
|
|
|
" If 1, disables ALE's built in error display. Instead, all errors are piped
|
|
|
|
" to the diagnostics API.
|
2023-09-09 15:33:23 +00:00
|
|
|
let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', has('nvim-0.6'))
|
2023-01-29 17:25:09 +00:00
|
|
|
|
|
|
|
if g:ale_use_neovim_diagnostics_api && !has('nvim-0.6')
|
|
|
|
" no-custom-checks
|
|
|
|
echoerr('Setting g:ale_use_neovim_diagnostics_api to 1 requires Neovim 0.6+.')
|
|
|
|
endif
|
|
|
|
|
2020-11-21 20:12:09 +00:00
|
|
|
if g:ale_set_balloons is 1 || g:ale_set_balloons is# 'hover'
|
2017-05-31 21:04:33 +00:00
|
|
|
call ale#balloon#Enable()
|
|
|
|
endif
|
|
|
|
|
2017-07-01 23:28:00 +00:00
|
|
|
if g:ale_completion_enabled
|
|
|
|
call ale#completion#Enable()
|
|
|
|
endif
|
|
|
|
|
2020-11-21 01:18:27 +00:00
|
|
|
if g:ale_popup_menu_enabled
|
|
|
|
call ale#code_action#EnablePopUpMenu()
|
|
|
|
endif
|
|
|
|
|
2016-10-24 21:09:41 +00:00
|
|
|
" Define commands for moving through warnings and errors.
|
2019-02-10 11:11:29 +00:00
|
|
|
command! -bar -nargs=* ALEPrevious
|
|
|
|
\ :call ale#loclist_jumping#WrapJump('before', <q-args>)
|
|
|
|
command! -bar -nargs=* ALENext
|
|
|
|
\ :call ale#loclist_jumping#WrapJump('after', <q-args>)
|
|
|
|
|
2017-03-28 17:27:07 +00:00
|
|
|
command! -bar ALEPreviousWrap :call ale#loclist_jumping#Jump('before', 1)
|
|
|
|
command! -bar ALENextWrap :call ale#loclist_jumping#Jump('after', 1)
|
2017-06-03 11:45:52 +00:00
|
|
|
command! -bar ALEFirst :call ale#loclist_jumping#JumpToIndex(0)
|
|
|
|
command! -bar ALELast :call ale#loclist_jumping#JumpToIndex(-1)
|
2016-10-24 21:09:41 +00:00
|
|
|
|
2017-03-02 07:14:30 +00:00
|
|
|
" A command for showing error details.
|
2017-03-28 17:27:07 +00:00
|
|
|
command! -bar ALEDetail :call ale#cursor#ShowCursorDetail()
|
2017-03-02 07:14:30 +00:00
|
|
|
|
2017-03-28 22:04:58 +00:00
|
|
|
" Define commands for turning ALE on or off.
|
2017-10-28 14:41:14 +00:00
|
|
|
command! -bar ALEToggle :call ale#toggle#Toggle()
|
|
|
|
command! -bar ALEEnable :call ale#toggle#Enable()
|
|
|
|
command! -bar ALEDisable :call ale#toggle#Disable()
|
2017-10-29 17:03:29 +00:00
|
|
|
command! -bar ALEReset :call ale#toggle#Reset()
|
2017-10-28 18:36:16 +00:00
|
|
|
" Commands for turning ALE on or off for a buffer.
|
|
|
|
command! -bar ALEToggleBuffer :call ale#toggle#ToggleBuffer(bufnr(''))
|
|
|
|
command! -bar ALEEnableBuffer :call ale#toggle#EnableBuffer(bufnr(''))
|
|
|
|
command! -bar ALEDisableBuffer :call ale#toggle#DisableBuffer(bufnr(''))
|
2017-10-29 17:03:29 +00:00
|
|
|
command! -bar ALEResetBuffer :call ale#toggle#ResetBuffer(bufnr(''))
|
2018-03-06 10:23:49 +00:00
|
|
|
" A command to stop all LSP-like clients, including tsserver.
|
|
|
|
command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs()
|
2017-03-28 22:04:58 +00:00
|
|
|
|
2017-02-28 09:10:58 +00:00
|
|
|
" A command for linting manually.
|
2017-03-28 17:27:07 +00:00
|
|
|
command! -bar ALELint :call ale#Queue(0, 'lint_file')
|
2020-09-08 20:40:10 +00:00
|
|
|
" Stop current jobs when linting.
|
|
|
|
command! -bar ALELintStop :call ale#engine#Stop(bufnr(''))
|
2017-02-09 18:47:14 +00:00
|
|
|
|
2022-02-04 17:42:26 +00:00
|
|
|
" Commands to manually populate the quickfixes.
|
|
|
|
command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1)
|
|
|
|
command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0)
|
|
|
|
|
2017-02-28 09:10:58 +00:00
|
|
|
" Define a command to get information about current filetype.
|
2023-09-05 23:21:58 +00:00
|
|
|
command! -bar -nargs=* ALEInfo :call ale#debugging#InfoCommand(<f-args>)
|
|
|
|
" Deprecated and scheduled for removal in 4.0.0.
|
|
|
|
command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboardDeprecatedCommand()
|
2018-04-08 18:04:07 +00:00
|
|
|
" Copy ALE information to a file.
|
|
|
|
command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile(<f-args>)
|
2017-01-24 15:50:49 +00:00
|
|
|
|
2017-05-18 12:21:14 +00:00
|
|
|
" Fix problems in files.
|
2020-09-08 20:40:10 +00:00
|
|
|
command! -bar -bang -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '<bang>', <f-args>)
|
2017-05-20 17:56:44 +00:00
|
|
|
" Suggest registered functions to use for fixing problems.
|
|
|
|
command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
|
2017-05-18 12:21:14 +00:00
|
|
|
|
2017-11-21 00:21:45 +00:00
|
|
|
" Go to definition for tsserver and LSP
|
2020-04-15 15:50:13 +00:00
|
|
|
command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', <f-args>)
|
|
|
|
|
2019-01-21 23:06:28 +00:00
|
|
|
" Go to type definition for tsserver and LSP
|
2020-04-15 15:50:13 +00:00
|
|
|
command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', <f-args>)
|
|
|
|
|
2022-04-30 03:28:26 +00:00
|
|
|
" Go to implementation for tsserver and LSP
|
|
|
|
command! -bar -nargs=* ALEGoToImplementation :call ale#definition#GoToCommandHandler('implementation', <f-args>)
|
|
|
|
|
2020-04-15 15:50:13 +00:00
|
|
|
" Repeat a previous selection in the preview window
|
|
|
|
command! -bar ALERepeatSelection :call ale#preview#RepeatSelection()
|
2019-01-21 23:06:28 +00:00
|
|
|
|
2018-04-22 18:49:24 +00:00
|
|
|
" Find references for tsserver and LSP
|
2019-01-27 10:18:20 +00:00
|
|
|
command! -bar -nargs=* ALEFindReferences :call ale#references#Find(<f-args>)
|
2018-04-22 18:49:24 +00:00
|
|
|
|
2018-12-10 20:08:28 +00:00
|
|
|
" Show summary information for the cursor.
|
|
|
|
command! -bar ALEHover :call ale#hover#ShowAtCursor()
|
|
|
|
|
|
|
|
" Show documentation for the cursor.
|
|
|
|
command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor()
|
2018-04-22 21:00:25 +00:00
|
|
|
|
2018-10-31 16:13:22 +00:00
|
|
|
" Search for appearances of a symbol, such as a type name or function name.
|
|
|
|
command! -nargs=1 ALESymbolSearch :call ale#symbol#Search(<q-args>)
|
|
|
|
|
2020-09-06 21:37:37 +00:00
|
|
|
" Complete text with tsserver and LSP
|
2019-04-23 20:26:16 +00:00
|
|
|
command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual')
|
2019-01-07 17:55:55 +00:00
|
|
|
|
2020-09-06 21:37:37 +00:00
|
|
|
" Try to find completions for the current symbol that add additional text.
|
|
|
|
command! -bar ALEImport :call ale#completion#Import()
|
|
|
|
|
2019-09-12 20:53:23 +00:00
|
|
|
" Rename symbols using tsserver and LSP
|
2020-11-21 19:00:53 +00:00
|
|
|
command! -bar -bang ALERename :call ale#rename#Execute()
|
2019-09-12 20:53:23 +00:00
|
|
|
|
2021-12-16 23:09:26 +00:00
|
|
|
" Rename file using tsserver
|
|
|
|
command! -bar -bang ALEFileRename :call ale#filerename#Execute()
|
|
|
|
|
2020-11-14 10:41:51 +00:00
|
|
|
" Apply code actions to a range.
|
2020-11-14 10:15:17 +00:00
|
|
|
command! -bar -range ALECodeAction :call ale#codefix#Execute(<range>)
|
|
|
|
|
2019-09-12 20:53:23 +00:00
|
|
|
" Organize import statements using tsserver
|
|
|
|
command! -bar ALEOrganizeImports :call ale#organize_imports#Execute()
|
|
|
|
|
2016-10-24 21:09:41 +00:00
|
|
|
" <Plug> mappings for commands
|
|
|
|
nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_previous_wrap) :ALEPreviousWrap<Return>
|
2019-02-10 11:11:29 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_previous_error) :ALEPrevious -error<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_previous_wrap_error) :ALEPrevious -wrap -error<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_previous_warning) :ALEPrevious -warning<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_previous_wrap_warning) :ALEPrevious -wrap -warning<Return>
|
2016-10-24 21:09:41 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_next) :ALENext<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next_wrap) :ALENextWrap<Return>
|
2019-02-10 11:11:29 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_next_error) :ALENext -error<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next_wrap_error) :ALENext -wrap -error<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next_warning) :ALENext -warning<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next_wrap_warning) :ALENext -wrap -warning<Return>
|
2017-06-03 11:45:52 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_first) :ALEFirst<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_last) :ALELast<Return>
|
2017-02-09 18:47:14 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_toggle) :ALEToggle<Return>
|
2017-10-29 10:55:02 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_enable) :ALEEnable<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_disable) :ALEDisable<Return>
|
2017-10-29 17:03:29 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_reset) :ALEReset<Return>
|
2017-10-29 10:55:02 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_toggle_buffer) :ALEToggleBuffer<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_enable_buffer) :ALEEnableBuffer<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_disable_buffer) :ALEDisableBuffer<Return>
|
2017-10-29 17:03:29 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_reset_buffer) :ALEResetBuffer<Return>
|
2017-02-28 09:10:58 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_lint) :ALELint<Return>
|
2017-03-02 07:14:30 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
|
2017-05-18 12:21:14 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
|
2017-11-21 00:21:45 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
|
2020-08-18 22:03:43 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinition -tab<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinition -split<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinition -vsplit<Return>
|
2019-01-21 23:06:28 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_type_definition) :ALEGoToTypeDefinition<Return>
|
2020-08-18 22:03:43 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split<Return>
|
2022-09-08 07:53:42 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinition -vsplit<Return>
|
2022-11-25 13:14:12 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_implementation) :ALEGoToImplementation<Return>
|
2022-04-30 03:28:26 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_implementation_in_tab) :ALEGoToImplementation -tab<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_implementation_in_split) :ALEGoToImplementation -split<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_implementation_in_vsplit) :ALEGoToImplementation -vsplit<Return>
|
2018-04-22 18:49:24 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
|
2018-04-22 21:00:25 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
|
2018-12-10 20:08:28 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>
|
2019-01-07 17:55:55 +00:00
|
|
|
inoremap <silent> <Plug>(ale_complete) <C-\><C-O>:ALEComplete<Return>
|
2020-09-06 21:37:37 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_import) :ALEImport<Return>
|
2019-09-12 20:53:23 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_rename) :ALERename<Return>
|
2021-12-16 23:09:26 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_filerename) :ALEFileRename<Return>
|
2020-11-14 10:15:17 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_code_action) :ALECodeAction<Return>
|
2020-04-15 15:50:13 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_repeat_selection) :ALERepeatSelection<Return>
|
2023-09-05 23:21:58 +00:00
|
|
|
nnoremap <silent> <Plug>(ale_info) :ALEInfo<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_info_echo) :ALEInfo -echo<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_info_clipboard) :ALEInfo -clipboard<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_info_preview) :ALEInfo -preview<Return>
|
2020-04-15 15:50:13 +00:00
|
|
|
|
2017-10-28 14:41:14 +00:00
|
|
|
" Set up autocmd groups now.
|
2018-06-19 19:31:58 +00:00
|
|
|
call ale#events#Init()
|
2017-10-28 14:41:14 +00:00
|
|
|
|
2016-10-11 14:54:14 +00:00
|
|
|
" Housekeeping
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
|
Implement a more efficient statusbar
The statusbar now keeps its state in a separate variable, in order to
avoid excess iterations. The engine now updates said variable on run,
and a new function is made available for external statusbars to call (to
avoid dependencies on internal implementation details of ale).
To keep things light, the status bar code is not loaded unless invoked
by the user or an external plugin. On the first load it will update
itself from the global loclist, after that, the engine will handle all
updates.
The external integration function, `ale#statusline#Count()`, will return
a tuple in the format [E, W] (where E is errors, W is warnings), unless
no data exists (ie, the plugin doesn't have a linter for a file or has
not run yet), in which case it returns 0/false.
2016-10-11 21:51:01 +00:00
|
|
|
augroup ALECleanupGroup
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
autocmd!
|
2016-10-11 14:54:14 +00:00
|
|
|
" Clean up buffers automatically when they are unloaded.
|
2018-06-19 19:12:33 +00:00
|
|
|
autocmd BufDelete * if exists('*ale#engine#Cleanup') | call ale#engine#Cleanup(str2nr(expand('<abuf>'))) | endif
|
2017-10-14 22:22:13 +00:00
|
|
|
autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand('<abuf>')))
|
2018-09-16 14:57:13 +00:00
|
|
|
|
2018-09-17 14:50:04 +00:00
|
|
|
if exists('##VimSuspend')
|
2019-02-06 18:05:13 +00:00
|
|
|
autocmd VimSuspend * if exists('*ale#engine#CleanupEveryBuffer') | call ale#engine#CleanupEveryBuffer() | endif
|
2018-09-17 14:50:04 +00:00
|
|
|
endif
|
First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload
First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.
With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.
I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.
The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.
Please let me know what you think!
Closes #59
* Address Travis/Vint errors
For some reason, ale isn't running vint for me...
* Incorporate feedback, make fixes
Lazy-loading logic is much improved.
* Add header comments; remove incorrect workaround
* Remove unneeded plugin guards
* Fix lazy-loading linter logic
Set the wrong variable....
* Fix capitialization
2016-10-10 18:51:29 +00:00
|
|
|
augroup END
|