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
This commit is contained in:
Bjorn Neergaard
2016-10-10 13:51:29 -05:00
committed by w0rp
parent 0680f875fe
commit 7f0ce89d2b
44 changed files with 337 additions and 336 deletions

View File

@@ -289,11 +289,30 @@ g:ale_statusline_format *g:ale_statusline_format*
Type: |List|
Default: `['%d error(s)', '%d warning(s)', 'OK']`
This variable defines the format of |`ALEGetStatusLine()`| output.
This variable defines the format of |`ale#statusline#status()`| output.
- The 1st element is for errors
- The 2nd element is for warnings
- The 3rd element is for when no errors are detected
g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled*
Type: |Number|
Default: `1`
Enables or disables the |airline|'s native extension for ale, which displays
warnings and errors in the status line, prefixed by
|airline#extensions#ale#error_symbol| and
|airline#extensions#ale#warning_symbol|.
g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled*
Type: |Number|
Default: `1`
Enables or disables the |airline|'s native extension for ale, which displays
warnings and errors in the status line, prefixed by
|airline#extensions#ale#error_symbol| and
|airline#extensions#ale#warning_symbol|.
===============================================================================
4. Linter Specific Options *ale-linter-options*
@@ -413,14 +432,14 @@ g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable*
===============================================================================
5. API *ale-api*
ALELint(delay) *ALELint()*
ale#Queue(delay) *ale#Queue()*
Run linters for the current buffer, based on the filetype of the buffer,
with a given `delay`. A `delay` of `0` will run the linters immediately.
The linters will always be run in the background. Calling this function
again from the same buffer
ALEAddLinter(filetype, linter) *ALEAddLinter()*
ale#linter#Define(filetype, linter) *ale#linter#Define()*
Given a |String| for a filetype and a |Dictionary| Describing a linter
configuration, add a linter for the given filetype. The dictionaries each
offer the following options:
@@ -492,21 +511,21 @@ ALEAddLinter(filetype, linter) *ALEAddLinter()*
'command': g:ale#util#stdin_wrapper . ' .hs ghc -fno-code -v0',
<
ALEGetLinters(filetype) *ALEGetLinters()*
ale#linter#Get(filetype) *ale#linter#Get()*
Return all of linters configured for a given filetype as a |List| of
|Dictionary| values in the format specified by |ALEAddLinter()|.
|Dictionary| values in the format specified by |ale#linter#Define()|.
ALEGetStatusLine() *ALEGetStatusLine()*
ale#statusline#Status() *ale#statusline#Status()*
Return a formatted string that can be added to the statusline.
The output's format is defined in |`g:ale_statusline_format`|.
To enable it, the following should be present in your |statusline| settings: >
%{ALEGetStatusLine()}
%{ale#statusline#status()}
g:ale#util#stdin_wrapper *g:ale#util#stdin_wrapper*
This variable names a wrapper script for sending stdin input to programs
which cannot accept input via stdin. See |ALEAddLinter| for more.
which cannot accept input via stdin. See |ale#linter#Define()| for more.
===============================================================================