2016-10-03 14:41:02 -04: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 14:51:29 -04: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 19:23:26 -04:00
|
|
|
|
2016-10-11 10:54:14 -04:00
|
|
|
" Sanity Checks
|
|
|
|
|
2017-02-14 04:18:54 -05:00
|
|
|
if exists('g:loaded_ale_dont_use_this_in_other_plugins_please')
|
2016-09-08 19:23:26 -04:00
|
|
|
finish
|
|
|
|
endif
|
2016-10-25 09:09:58 -04:00
|
|
|
|
2017-02-14 04:18:54 -05: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 19:23:26 -04:00
|
|
|
|
2016-10-10 08:16:32 -04:00
|
|
|
" A flag for detecting if the required features are set.
|
|
|
|
if has('nvim')
|
2016-11-04 06:17:49 -04:00
|
|
|
let s:has_features = has('timers')
|
2016-10-10 08:16:32 -04:00
|
|
|
else
|
2016-11-04 06:17:49 -04: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 08:16:32 -04:00
|
|
|
endif
|
|
|
|
|
2016-11-04 06:17:49 -04:00
|
|
|
if !s:has_features
|
2017-02-13 18:48:36 -05:00
|
|
|
" Only output a warning if editing some special files.
|
|
|
|
if index(['', 'gitcommit'], &filetype) == -1
|
2017-11-15 07:00:08 -05:00
|
|
|
execute 'echoerr ''ALE requires NeoVim >= 0.1.5 or Vim 8 with +timers +job +channel'''
|
|
|
|
execute 'echoerr ''Please update your editor appropriately.'''
|
2017-02-13 18:48:36 -05: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 14:51:29 -04:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2018-03-03 12:50:09 -05:00
|
|
|
if has('nvim') && !has('nvim-0.2.0') && !get(g:, 'ale_use_deprecated_neovim')
|
2018-03-03 13:13:57 -05:00
|
|
|
execute 'echom ''ALE support for NeoVim versions below 0.2.0 is deprecated.'''
|
|
|
|
execute 'echom ''Use `let g:ale_use_deprecated_neovim = 1` to silence this warning for now.'''
|
2018-03-03 12:50:09 -05:00
|
|
|
endif
|
|
|
|
|
2017-02-14 04:18:54 -05:00
|
|
|
" Set this flag so that other plugins can use it, like airline.
|
|
|
|
let g:loaded_ale = 1
|
|
|
|
|
2017-02-10 04:45:42 -05:00
|
|
|
" Set the TMPDIR environment variable if it is not set automatically.
|
|
|
|
" This can automatically fix some environments.
|
|
|
|
if has('unix') && empty($TMPDIR)
|
|
|
|
let $TMPDIR = '/tmp'
|
|
|
|
endif
|
|
|
|
|
2016-10-24 15:21:32 -04:00
|
|
|
" This global variable is used internally by ALE for tracking information for
|
|
|
|
" each buffer which linters are being run against.
|
2016-10-23 17:41:00 -04:00
|
|
|
let g:ale_buffer_info = {}
|
2016-10-11 10:54:14 -04:00
|
|
|
|
|
|
|
" User Configuration
|
|
|
|
|
2016-10-25 09:09:58 -04:00
|
|
|
" This option prevents ALE autocmd commands from being run for particular
|
|
|
|
" filetypes which can cause issues.
|
2017-07-15 20:15:07 -04:00
|
|
|
let g:ale_filetype_blacklist = [
|
|
|
|
\ 'dirvish',
|
|
|
|
\ 'nerdtree',
|
|
|
|
\ 'qf',
|
|
|
|
\ 'tags',
|
|
|
|
\ 'unite',
|
|
|
|
\]
|
2016-10-25 09:09:58 -04:00
|
|
|
|
2016-10-11 18:11:45 -04:00
|
|
|
" This Dictionary configures which linters are enabled for which languages.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_linters = get(g:, 'ale_linters', {})
|
2017-11-14 14:55:28 -05:00
|
|
|
" This option can be changed to only enable explicitly selected linters.
|
2018-05-28 12:57:58 -04: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 14:51:29 -04:00
|
|
|
|
2017-05-18 08:21:14 -04:00
|
|
|
" This Dictionary configures which functions will be used for fixing problems.
|
|
|
|
let g:ale_fixers = get(g:, 'ale_fixers', {})
|
|
|
|
|
2016-10-11 18:11:45 -04: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 19:23:26 -04: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 04:27:03 -04:00
|
|
|
let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200)
|
2016-09-08 19:23:26 -04:00
|
|
|
|
2017-03-30 18:21:37 -04:00
|
|
|
" This flag can be set to 'never' to disable linting when text is changed.
|
|
|
|
" This flag can also be set to 'insert' or 'normal' to lint when text is
|
|
|
|
" changed only in insert or normal mode respectively.
|
|
|
|
let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'always')
|
|
|
|
|
|
|
|
" This flag can be set to 1 to enable linting when leaving insert mode.
|
|
|
|
let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 0)
|
2016-10-11 10:54:14 -04:00
|
|
|
|
2016-09-08 19:23:26 -04:00
|
|
|
" This flag can be set to 0 to disable linting when the buffer is entered.
|
2016-10-04 16:28:54 -04:00
|
|
|
let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1)
|
2016-09-08 19:23:26 -04:00
|
|
|
|
2016-10-04 16:31:47 -04:00
|
|
|
" This flag can be set to 1 to enable linting when a buffer is written.
|
2017-03-27 15:36:35 -04:00
|
|
|
let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1)
|
2017-02-09 13:47:14 -05:00
|
|
|
|
2017-03-27 17:40:25 -04: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)
|
|
|
|
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0)
|
2017-05-30 16:32:51 -04:00
|
|
|
|
2017-02-09 13:47:14 -05: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 16:31:47 -04:00
|
|
|
|
2017-01-22 07:57:05 -05:00
|
|
|
" These flags dictates if ale uses the quickfix or the loclist (loclist is the
|
|
|
|
" default, quickfix overrides loclist).
|
2016-10-04 16:28:54 -04:00
|
|
|
let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1)
|
2017-01-22 07:57:05 -05:00
|
|
|
let g:ale_set_quickfix = get(g:, 'ale_set_quickfix', 0)
|
|
|
|
|
2017-01-22 09:54:57 -05:00
|
|
|
" This flag dictates if ale open the configured loclist
|
2017-01-22 07:57:05 -05:00
|
|
|
let g:ale_open_list = get(g:, 'ale_open_list', 0)
|
|
|
|
|
|
|
|
" This flag dictates if ale keeps open loclist even if there is no error in loclist
|
|
|
|
let g:ale_keep_list_window_open = get(g:, 'ale_keep_list_window_open', 0)
|
2016-09-08 19:23:26 -04:00
|
|
|
|
2018-03-02 15:22:29 -05:00
|
|
|
" This flag dictates that quickfix windows should be opened vertically
|
|
|
|
let g:ale_list_vertical = get(g:, 'ale_list_vertical', 0)
|
|
|
|
|
2017-06-01 05:39:21 -04:00
|
|
|
" The window size to set for the quickfix and loclist windows
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_list_window_size = get(g:, 'ale_list_window_size', 10)
|
2017-06-01 05:39:21 -04:00
|
|
|
|
2016-09-08 19:23:26 -04:00
|
|
|
" This flag can be set to 0 to disable setting signs.
|
2016-10-04 16:28:54 -04: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-10-12 18:04:46 -04:00
|
|
|
" This flag can be set to some integer to control the maximum number of signs
|
|
|
|
" that ALE will set.
|
|
|
|
let g:ale_max_signs = get(g:, 'ale_max_signs', -1)
|
2016-09-08 19:23:26 -04:00
|
|
|
|
2017-05-21 17:42:27 -04:00
|
|
|
" This flag can be set to 1 to enable changing the sign column colors when
|
|
|
|
" there are errors.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_change_sign_column_color = get(g:, 'ale_change_sign_column_color', 0)
|
2017-05-21 17:42:27 -04:00
|
|
|
|
2017-02-12 19:18:51 -05: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'))
|
|
|
|
|
2017-05-20 18:32:41 -04:00
|
|
|
" These variables dictate what sign is used to indicate errors and warnings.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_sign_error = get(g:, 'ale_sign_error', '>>')
|
|
|
|
let g:ale_sign_style_error = get(g:, 'ale_sign_style_error', g:ale_sign_error)
|
|
|
|
let g:ale_sign_warning = get(g:, 'ale_sign_warning', '--')
|
|
|
|
let g:ale_sign_style_warning = get(g:, 'ale_sign_style_warning', g:ale_sign_warning)
|
|
|
|
let g:ale_sign_info = get(g:, 'ale_sign_info', g:ale_sign_warning)
|
2016-09-15 08:08:21 -04:00
|
|
|
|
2016-10-11 10:54:14 -04:00
|
|
|
" This variable sets an offset which can be set for sign IDs.
|
|
|
|
" This ID can be changed depending on what IDs are set for other plugins.
|
|
|
|
" The dummy sign will use the ID exactly equal to the offset.
|
|
|
|
let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000)
|
2016-09-26 11:02:21 -04:00
|
|
|
|
|
|
|
" This flag can be set to 1 to keep sign gutter always open
|
2016-10-04 16:28:54 -04:00
|
|
|
let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0)
|
2016-10-07 01:49:30 -04:00
|
|
|
|
2017-11-12 19:47:34 -05:00
|
|
|
" A string format for the echoed message
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
|
2017-11-14 05:28:36 -05:00
|
|
|
" The same for the loclist.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_loclist_msg_format = get(g:, 'ale_loclist_msg_format', g:ale_echo_msg_format)
|
2016-10-10 07:53:54 -04:00
|
|
|
|
|
|
|
" Strings used for severity in the echoed message
|
|
|
|
let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
|
2017-11-12 18:19:26 -05:00
|
|
|
let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
|
2016-10-10 07:53:54 -04:00
|
|
|
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
|
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 14:51:29 -04:00
|
|
|
|
2016-10-11 10:54:14 -04: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 17:51:01 -04:00
|
|
|
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
|
2017-10-12 18:25:41 -04:00
|
|
|
" Controls the milliseconds delay before echoing a message.
|
|
|
|
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
|
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 14:51:29 -04:00
|
|
|
|
2017-05-31 17:04:33 -04:00
|
|
|
" This flag can be set to 0 to disable balloon support.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_set_balloons = get(g:, 'ale_set_balloons',
|
2018-05-09 10:08:39 -04:00
|
|
|
\ has('balloon_eval') && has('gui_running') ||
|
|
|
|
\ has('balloon_eval_term') && !has('gui_running')
|
|
|
|
\)
|
2017-05-31 17:04:33 -04:00
|
|
|
|
2017-05-24 05:23:13 -04:00
|
|
|
" A deprecated setting for ale#statusline#Status()
|
|
|
|
" See :help ale#statusline#Count() for getting status reports.
|
2016-10-11 10:54:14 -04:00
|
|
|
let g:ale_statusline_format = get(g:, 'ale_statusline_format',
|
|
|
|
\ ['%d error(s)', '%d warning(s)', 'OK']
|
|
|
|
\)
|
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 14:51:29 -04:00
|
|
|
|
2016-10-11 10:54:14 -04:00
|
|
|
" This flag can be set to 0 to disable warnings for trailing whitespace
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1)
|
2017-11-28 05:08:34 -05:00
|
|
|
" This flag can be set to 0 to disable warnings for trailing blank lines
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_warn_about_trailing_blank_lines = get(g:, 'ale_warn_about_trailing_blank_lines', 1)
|
2016-10-11 10:54:14 -04:00
|
|
|
|
2017-02-14 18:44:37 -05:00
|
|
|
" A flag for controlling the maximum size of the command history to store.
|
|
|
|
let g:ale_max_buffer_history_size = get(g:, 'ale_max_buffer_history_size', 20)
|
|
|
|
|
2017-02-16 16:33:44 -05:00
|
|
|
" A flag for enabling or disabling the command history.
|
|
|
|
let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1)
|
|
|
|
|
2017-02-16 18:18:57 -05:00
|
|
|
" A flag for storing the full output of commands in the history.
|
2017-07-03 19:16:53 -04:00
|
|
|
let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1)
|
2017-02-16 18:18:57 -05:00
|
|
|
|
2017-11-30 05:34:51 -05:00
|
|
|
" A flag for caching failed executable checks.
|
|
|
|
" This is off by default, because it will cause problems.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_cache_executable_check_failures = get(g:, 'ale_cache_executable_check_failures', 0)
|
2017-11-30 05:34:51 -05:00
|
|
|
|
2017-05-26 10:59:43 -04:00
|
|
|
" A dictionary mapping regular expression patterns to arbitrary buffer
|
|
|
|
" variables to be set. Useful for configuration ALE based on filename
|
|
|
|
" patterns.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_pattern_options = get(g:, 'ale_pattern_options', {})
|
|
|
|
let g:ale_pattern_options_enabled = get(g:, 'ale_pattern_options_enabled', !empty(g:ale_pattern_options))
|
2017-05-26 10:59:43 -04:00
|
|
|
|
2017-05-26 16:21:15 -04:00
|
|
|
" A maximum file size for checking for errors.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_maximum_file_size = get(g:, 'ale_maximum_file_size', 0)
|
2017-05-26 16:21:15 -04:00
|
|
|
|
2017-06-14 12:59:13 -04:00
|
|
|
" Remapping of linter problems.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_type_map = get(g:, 'ale_type_map', {})
|
2017-06-14 12:59:13 -04:00
|
|
|
|
2017-07-01 19:28:00 -04:00
|
|
|
" Enable automatic completion with LSP servers and tsserver
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0)
|
|
|
|
let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
|
|
|
|
let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50)
|
2017-07-01 19:28:00 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
" A setting for wrapping commands.
|
2018-05-28 12:57:58 -04:00
|
|
|
let g:ale_command_wrapper = get(g:, 'ale_command_wrapper', '')
|
2017-12-20 07:20:38 -05:00
|
|
|
|
2017-05-31 17:04:33 -04:00
|
|
|
if g:ale_set_balloons
|
|
|
|
call ale#balloon#Enable()
|
|
|
|
endif
|
|
|
|
|
2017-07-01 19:28:00 -04:00
|
|
|
if g:ale_completion_enabled
|
|
|
|
call ale#completion#Enable()
|
|
|
|
endif
|
|
|
|
|
2016-10-24 17:09:41 -04:00
|
|
|
" Define commands for moving through warnings and errors.
|
2017-03-28 13:27:07 -04:00
|
|
|
command! -bar ALEPrevious :call ale#loclist_jumping#Jump('before', 0)
|
|
|
|
command! -bar ALEPreviousWrap :call ale#loclist_jumping#Jump('before', 1)
|
|
|
|
command! -bar ALENext :call ale#loclist_jumping#Jump('after', 0)
|
|
|
|
command! -bar ALENextWrap :call ale#loclist_jumping#Jump('after', 1)
|
2017-06-03 07:45:52 -04:00
|
|
|
command! -bar ALEFirst :call ale#loclist_jumping#JumpToIndex(0)
|
|
|
|
command! -bar ALELast :call ale#loclist_jumping#JumpToIndex(-1)
|
2016-10-24 17:09:41 -04:00
|
|
|
|
2017-03-02 02:14:30 -05:00
|
|
|
" A command for showing error details.
|
2017-03-28 13:27:07 -04:00
|
|
|
command! -bar ALEDetail :call ale#cursor#ShowCursorDetail()
|
2017-03-02 02:14:30 -05:00
|
|
|
|
2017-03-28 18:04:58 -04:00
|
|
|
" Define commands for turning ALE on or off.
|
2017-10-28 10:41:14 -04: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 13:03:29 -04:00
|
|
|
command! -bar ALEReset :call ale#toggle#Reset()
|
2017-10-28 14:36:16 -04: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 13:03:29 -04:00
|
|
|
command! -bar ALEResetBuffer :call ale#toggle#ResetBuffer(bufnr(''))
|
2018-03-06 05:23:49 -05:00
|
|
|
" A command to stop all LSP-like clients, including tsserver.
|
|
|
|
command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs()
|
2017-03-28 18:04:58 -04:00
|
|
|
|
2017-02-28 04:10:58 -05:00
|
|
|
" A command for linting manually.
|
2017-03-28 13:27:07 -04:00
|
|
|
command! -bar ALELint :call ale#Queue(0, 'lint_file')
|
2017-02-09 13:47:14 -05:00
|
|
|
|
2017-02-28 04:10:58 -05:00
|
|
|
" Define a command to get information about current filetype.
|
2017-03-28 13:27:07 -04:00
|
|
|
command! -bar ALEInfo :call ale#debugging#Info()
|
2017-02-14 18:45:22 -05:00
|
|
|
" The same, but copy output to your clipboard.
|
2017-03-28 13:27:07 -04:00
|
|
|
command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard()
|
2018-04-08 14:04:07 -04:00
|
|
|
" Copy ALE information to a file.
|
|
|
|
command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile(<f-args>)
|
2017-01-24 10:50:49 -05:00
|
|
|
|
2017-05-18 08:21:14 -04:00
|
|
|
" Fix problems in files.
|
2018-04-11 20:23:58 -04:00
|
|
|
command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', <f-args>)
|
2017-05-20 13:56:44 -04:00
|
|
|
" Suggest registered functions to use for fixing problems.
|
|
|
|
command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
|
2017-05-18 08:21:14 -04:00
|
|
|
|
2017-11-20 19:21:45 -05:00
|
|
|
" Go to definition for tsserver and LSP
|
|
|
|
command! -bar ALEGoToDefinition :call ale#definition#GoTo({})
|
|
|
|
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1})
|
|
|
|
|
2018-04-22 14:49:24 -04:00
|
|
|
" Find references for tsserver and LSP
|
|
|
|
command! -bar ALEFindReferences :call ale#references#Find()
|
|
|
|
|
2018-04-22 17:00:25 -04:00
|
|
|
" Get information for the cursor.
|
TUI / GUI tooltip with content from ALEHover (#1556)
* Guard the ballooneval settings
* Mark main objectives to do to get nice Hover
* Make tweaks to make the tooltip work - See " XXX: comments
* Guard balloon_show call
* Use return instead of finish for functions
* ale#hover#show : Add optional arguments to specify arbtirary position
This change is requested to be able to call the function with mouse
position to enable hover information in vim's balloon
* ale#ballon#Disable : Remove feature guards
* ale#balloon : Show 'ALEHover' output on balloon if no diagnostic found
* ale#hover#HandleLSPResponse : remove the check for cursor position
This check prevented the 'ALEHover in balloon' feature, since mouse
position is almost never cursor position.
* ale#balloon#MessageForPos : Change the return of balloonexpr
balloonexpr evaluation now works even without balloon_show for basic
diagnostics, leaving the balloon_show call to ale#hover#Show, which can
then feature guard the call to avoid errors
* ale#hover#Response : Feature guard balloon_show calls
* ale#hover : always display 'Hover' information in messages
Also add a small comment to warn readers the different outputs the
ale#hover#Show will write to
* {LSP,TS}Response : use only variables from the Response
It is clearer that we only rely on l:options to get the relevant data to
build the LSP Response string
* hover#ShowDetails : fix an issue where not having focus broke balloons
The issue was caused by not using a buffer-specific version of getline()
to cap the value of the column sent in the message to LSP. Therefore a
cursor on column 10 in an inactive window could send a message with
column=0, if the active window had a buffer with too few lines
* {LSP,TS}Response : Remove redundant checks for balloon_show call
With the upcoming change in ale_set_balloons default value (see Pull
Request w0rp/ale#1565), this check will be useless
* balloonexpr? : Add a flag to separate hover#Show() calls
The goal of this flag is to make `:ALEHover` calls not pop a balloon
under the cursor, since the user has probably no interest in their
cursor while typing the command
The flag is a default argument which is overridden only in ballonexpr
call of ale#hover#Show, and stays set in the hover_map until the
callback for the LSP handles it.
There are no automated tests for this feature right now, and the nature
of the addition (one optional argument in the API) should make it
transparent to existing tests.
Since the differentiation is now possible, the check for moved cursor
has been put back in ale#hover#HandleLSPResponse
* ale#hover#hover_map : Protect accesses to hover_map
Using get() is safer than trying to access directly with ., as the tests
show.
* Raise timeout to try to get Appveyor happy
* Review : Fix comments
* Review : pass the optional argument 'called_from_balloonexpr' in a Dict
This optional dictionary has documentation just before the function
using it, ale#hover#Show, and allows easier extension in the future.
2018-05-16 16:23:48 -04:00
|
|
|
command! -bar ALEHover :call ale#hover#Show(bufnr(''), getcurpos()[1],
|
|
|
|
\ getcurpos()[2], {})
|
2018-04-22 17:00:25 -04:00
|
|
|
|
2016-10-24 17:09:41 -04:00
|
|
|
" <Plug> mappings for commands
|
|
|
|
nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_previous_wrap) :ALEPreviousWrap<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next) :ALENext<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_next_wrap) :ALENextWrap<Return>
|
2017-06-03 07:45:52 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_first) :ALEFirst<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_last) :ALELast<Return>
|
2017-02-09 13:47:14 -05:00
|
|
|
nnoremap <silent> <Plug>(ale_toggle) :ALEToggle<Return>
|
2017-10-29 06:55:02 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_enable) :ALEEnable<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_disable) :ALEDisable<Return>
|
2017-10-29 13:03:29 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_reset) :ALEReset<Return>
|
2017-10-29 06:55:02 -04: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 13:03:29 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_reset_buffer) :ALEResetBuffer<Return>
|
2017-02-28 04:10:58 -05:00
|
|
|
nnoremap <silent> <Plug>(ale_lint) :ALELint<Return>
|
2017-03-02 02:14:30 -05:00
|
|
|
nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
|
2017-05-18 08:21:14 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
|
2017-11-20 19:21:45 -05:00
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
|
|
|
|
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
|
2018-04-22 14:49:24 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
|
2018-04-22 17:00:25 -04:00
|
|
|
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
|
2016-10-24 17:09:41 -04:00
|
|
|
|
2017-10-28 10:41:14 -04:00
|
|
|
" Set up autocmd groups now.
|
2018-04-23 05:16:48 -04:00
|
|
|
call ale#autocmd#InitAuGroups()
|
2017-10-28 10:41:14 -04:00
|
|
|
|
2016-10-11 10:54:14 -04: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 14:51:29 -04: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 17:51:01 -04: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 14:51:29 -04:00
|
|
|
autocmd!
|
2016-10-11 10:54:14 -04:00
|
|
|
" Clean up buffers automatically when they are unloaded.
|
2017-12-19 10:35:57 -05:00
|
|
|
autocmd BufDelete * call ale#engine#Cleanup(str2nr(expand('<abuf>')))
|
2017-10-14 18:22:13 -04:00
|
|
|
autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand('<abuf>')))
|
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 14:51:29 -04:00
|
|
|
augroup END
|
|
|
|
|
2016-10-11 10:54:14 -04:00
|
|
|
" Backwards Compatibility
|
2016-10-10 14:56:05 -04:00
|
|
|
|
2017-01-22 09:54:57 -05:00
|
|
|
function! ALELint(delay) abort
|
2018-03-03 12:50:09 -05:00
|
|
|
if !get(g:, 'ale_deprecation_ale_lint', 0)
|
2018-03-03 13:13:57 -05:00
|
|
|
execute 'echom ''ALELint() is deprecated, use ale#Queue() instead.'''
|
2018-03-03 12:50:09 -05:00
|
|
|
let g:ale_deprecation_ale_lint = 1
|
|
|
|
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 14:51:29 -04:00
|
|
|
call ale#Queue(a:delay)
|
|
|
|
endfunction
|
2016-10-11 10:54:14 -04:00
|
|
|
|
2017-01-22 09:54:57 -05:00
|
|
|
function! ALEGetStatusLine() abort
|
2018-03-03 12:50:09 -05:00
|
|
|
if !get(g:, 'ale_deprecation_ale_get_status_line', 0)
|
2018-03-03 13:13:57 -05:00
|
|
|
execute 'echom ''ALEGetStatusLine() is deprecated.'''
|
2018-03-03 12:50:09 -05:00
|
|
|
let g:ale_deprecation_ale_get_status_line = 1
|
|
|
|
endif
|
|
|
|
|
2016-10-11 15:24:43 -04:00
|
|
|
return ale#statusline#Status()
|
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 14:51:29 -04:00
|
|
|
endfunction
|