Merge branch 'Amix' into Linux
This commit is contained in:
commit
b6757a655b
8 changed files with 185 additions and 46 deletions
|
@ -26,6 +26,41 @@ endif
|
||||||
let s:MAX_POS_VALUES = 8
|
let s:MAX_POS_VALUES = 8
|
||||||
let s:MAX_COL_SIZE = 1073741824 " pow(2, 30)
|
let s:MAX_COL_SIZE = 1073741824 " pow(2, 30)
|
||||||
|
|
||||||
|
" Check if we have neovim's buffer highlight API
|
||||||
|
"
|
||||||
|
" Below we define some functions' implementation conditionally if this API
|
||||||
|
" exists or not.
|
||||||
|
"
|
||||||
|
" The API itself is more ergonomic and neovim performs highlights positions
|
||||||
|
" rebases during edits so we see less stalled highlights.
|
||||||
|
let s:nvim_api = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace')
|
||||||
|
|
||||||
|
function! ale#highlight#HasNeovimApi() abort
|
||||||
|
return s:nvim_api
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#highlight#nvim_buf_clear_namespace(...) abort
|
||||||
|
return call('nvim_buf_clear_namespace', a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#highlight#nvim_buf_add_highlight(...) abort
|
||||||
|
return call('nvim_buf_add_highlight', a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:ale_nvim_highlight_id(bufnr) abort
|
||||||
|
let l:id = getbufvar(a:bufnr, 'ale_nvim_highlight_id', -1)
|
||||||
|
|
||||||
|
if l:id is -1
|
||||||
|
" NOTE: This will highlight nothing but will allocate new id
|
||||||
|
let l:id = ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, 0, '', 0, 0, -1
|
||||||
|
\)
|
||||||
|
call setbufvar(a:bufnr, 'ale_nvim_highlight_id', l:id)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:id
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort
|
function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort
|
||||||
if a:line >= a:end_line
|
if a:line >= a:end_line
|
||||||
" For single lines, just return the one position.
|
" For single lines, just return the one position.
|
||||||
|
@ -51,11 +86,88 @@ endfunction
|
||||||
" except these which have matching loclist item entries.
|
" except these which have matching loclist item entries.
|
||||||
|
|
||||||
function! ale#highlight#RemoveHighlights() abort
|
function! ale#highlight#RemoveHighlights() abort
|
||||||
for l:match in getmatches()
|
if ale#highlight#HasNeovimApi()
|
||||||
if l:match.group =~# '^ALE'
|
if get(b:, 'ale_nvim_highlight_id', 0)
|
||||||
call matchdelete(l:match.id)
|
let l:bufnr = bufnr('%')
|
||||||
|
" NOTE: 0, -1 means from 0 line till the end of buffer
|
||||||
|
call ale#highlight#nvim_buf_clear_namespace(
|
||||||
|
\ l:bufnr,
|
||||||
|
\ b:ale_nvim_highlight_id,
|
||||||
|
\ 0, -1
|
||||||
|
\)
|
||||||
endif
|
endif
|
||||||
endfor
|
else
|
||||||
|
for l:match in getmatches()
|
||||||
|
if l:match.group =~# '^ALE'
|
||||||
|
call matchdelete(l:match.id)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:highlight_line(bufnr, lnum, group) abort
|
||||||
|
if ale#highlight#HasNeovimApi()
|
||||||
|
let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr)
|
||||||
|
call ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, l:highlight_id, a:group,
|
||||||
|
\ a:lnum - 1, 0, -1
|
||||||
|
\)
|
||||||
|
else
|
||||||
|
call matchaddpos(a:group, [a:lnum])
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:highlight_range(bufnr, range, group) abort
|
||||||
|
if ale#highlight#HasNeovimApi()
|
||||||
|
let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr)
|
||||||
|
" NOTE: lines and columns indicies are 0-based in nvim_buf_* API.
|
||||||
|
let l:lnum = a:range.lnum - 1
|
||||||
|
let l:end_lnum = a:range.end_lnum - 1
|
||||||
|
let l:col = a:range.col - 1
|
||||||
|
let l:end_col = a:range.end_col
|
||||||
|
|
||||||
|
if l:lnum >= l:end_lnum
|
||||||
|
" For single lines, just return the one position.
|
||||||
|
call ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, l:highlight_id, a:group,
|
||||||
|
\ l:lnum, l:col, l:end_col
|
||||||
|
\)
|
||||||
|
else
|
||||||
|
" highlight first line from start till the line end
|
||||||
|
call ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, l:highlight_id, a:group,
|
||||||
|
\ l:lnum, l:col, -1
|
||||||
|
\)
|
||||||
|
|
||||||
|
" highlight all lines between the first and last entirely
|
||||||
|
let l:cur = l:lnum + 1
|
||||||
|
|
||||||
|
while l:cur < l:end_lnum
|
||||||
|
call ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, l:highlight_id, a:group,
|
||||||
|
\ l:cur, 0, -1
|
||||||
|
\ )
|
||||||
|
let l:cur += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
call ale#highlight#nvim_buf_add_highlight(
|
||||||
|
\ a:bufnr, l:highlight_id, a:group,
|
||||||
|
\ l:end_lnum, 0, l:end_col
|
||||||
|
\)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Set all of the positions, which are chunked into Lists which
|
||||||
|
" are as large as will be accepted by matchaddpos.
|
||||||
|
call map(
|
||||||
|
\ ale#highlight#CreatePositions(
|
||||||
|
\ a:range.lnum,
|
||||||
|
\ a:range.col,
|
||||||
|
\ a:range.end_lnum,
|
||||||
|
\ a:range.end_col
|
||||||
|
\ ),
|
||||||
|
\ 'matchaddpos(a:group, v:val)'
|
||||||
|
\)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:highlight_line(bufnr, lnum, group) abort
|
function! s:highlight_line(bufnr, lnum, group) abort
|
||||||
|
|
|
@ -53,25 +53,5 @@ g:ale_tex_latexindent_options *g:ale_tex_latexindent_options*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
texlab *ale-tex-texlab*
|
|
||||||
|
|
||||||
g:ale_tex_texlab_executable *g:ale_tex_texlab_executable*
|
|
||||||
*b:ale_tex_texlab_executable*
|
|
||||||
Type: |String|
|
|
||||||
Default: `'texlab'`
|
|
||||||
|
|
||||||
This variable can be changed to change the path to texlab.
|
|
||||||
|
|
||||||
|
|
||||||
g:ale_tex_texlab_options *g:ale_tex_texlab_options*
|
|
||||||
*b:ale_tex_texlab_options*
|
|
||||||
Type: |String|
|
|
||||||
Default: `''`
|
|
||||||
|
|
||||||
This variable can be changed to modify flags given to texlab.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|
|
@ -334,7 +334,14 @@ ALE offers support for automatic completion of code while you type.
|
||||||
Completion is only supported while at least one LSP linter is enabled. ALE
|
Completion is only supported while at least one LSP linter is enabled. ALE
|
||||||
will only suggest symbols provided by the LSP servers.
|
will only suggest symbols provided by the LSP servers.
|
||||||
|
|
||||||
ALE offers its own completion implementation, which does not require any
|
*ale-deoplete-integration*
|
||||||
|
|
||||||
|
ALE integrates with Deoplete for offering automatic completion data. ALE's
|
||||||
|
completion source for Deoplete is named `'ale'`, and should enabled
|
||||||
|
automatically if Deoplete is enabled and configured correctly. Deoplete
|
||||||
|
integration should not be combined with ALE's own implementation.
|
||||||
|
|
||||||
|
ALE also offers its own completion implementation, which does not require any
|
||||||
other plugins. Suggestions will be made while you type after completion is
|
other plugins. Suggestions will be made while you type after completion is
|
||||||
enabled. ALE's own completion implementation can be enabled by setting
|
enabled. ALE's own completion implementation can be enabled by setting
|
||||||
|g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE
|
|g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE
|
||||||
|
@ -349,7 +356,8 @@ If you don't like some of the suggestions you see, you can filter them out
|
||||||
with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|.
|
with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|.
|
||||||
|
|
||||||
The |ALEComplete| command can be used to show completion suggestions manually,
|
The |ALEComplete| command can be used to show completion suggestions manually,
|
||||||
even when |g:ale_completion_enabled| is set to `0`.
|
even when |g:ale_completion_enabled| is set to `0`. For manually requesting
|
||||||
|
completion information with Deoplete, consult Deoplete's documentation.
|
||||||
|
|
||||||
*ale-completion-completeopt-bug*
|
*ale-completion-completeopt-bug*
|
||||||
|
|
||||||
|
@ -2237,7 +2245,6 @@ documented in additional help files.
|
||||||
chktex................................|ale-tex-chktex|
|
chktex................................|ale-tex-chktex|
|
||||||
lacheck...............................|ale-tex-lacheck|
|
lacheck...............................|ale-tex-lacheck|
|
||||||
latexindent...........................|ale-tex-latexindent|
|
latexindent...........................|ale-tex-latexindent|
|
||||||
texlab................................|ale-tex-texlab|
|
|
||||||
texinfo.................................|ale-texinfo-options|
|
texinfo.................................|ale-texinfo-options|
|
||||||
write-good............................|ale-texinfo-write-good|
|
write-good............................|ale-texinfo-write-good|
|
||||||
text....................................|ale-text-options|
|
text....................................|ale-text-options|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
"""
|
||||||
|
A Deoplete source for ALE completion via tsserver and LSP.
|
||||||
|
"""
|
||||||
|
__author__ = 'Joao Paulo, w0rp'
|
||||||
|
|
||||||
|
try:
|
||||||
|
from deoplete.source.base import Base
|
||||||
|
except ImportError:
|
||||||
|
# Mock the Base class if deoplete isn't available, as mock isn't available
|
||||||
|
# in the Docker image.
|
||||||
|
class Base(object):
|
||||||
|
def __init__(self, vim):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Make sure this code is valid in Python 2, used for running unit tests.
|
||||||
|
class Source(Base):
|
||||||
|
|
||||||
|
def __init__(self, vim):
|
||||||
|
super(Source, self).__init__(vim)
|
||||||
|
|
||||||
|
self.name = 'ale'
|
||||||
|
self.mark = '[L]'
|
||||||
|
self.rank = 100
|
||||||
|
self.is_bytepos = True
|
||||||
|
self.min_pattern_length = 1
|
||||||
|
|
||||||
|
# Returns an integer for the start position, as with omnifunc.
|
||||||
|
def get_completion_position(self):
|
||||||
|
return self.vim.call('ale#completion#GetCompletionPosition')
|
||||||
|
|
||||||
|
def gather_candidates(self, context):
|
||||||
|
# Stop early if ALE can't provide completion data for this buffer.
|
||||||
|
if not self.vim.call('ale#completion#CanProvideCompletions'):
|
||||||
|
return None
|
||||||
|
|
||||||
|
if context.get('is_refresh'):
|
||||||
|
context['is_async'] = False
|
||||||
|
|
||||||
|
if context['is_async']:
|
||||||
|
# Result is the same as for omnifunc, or None.
|
||||||
|
result = self.vim.call('ale#completion#GetCompletionResult')
|
||||||
|
|
||||||
|
if result is not None:
|
||||||
|
context['is_async'] = False
|
||||||
|
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
context['is_async'] = True
|
||||||
|
|
||||||
|
# Request some completion results.
|
||||||
|
self.vim.call('ale#completion#GetCompletions', 'deoplete')
|
||||||
|
|
||||||
|
return []
|
|
@ -8,11 +8,6 @@ IMPROVEMENTS:
|
||||||
[[GH-2261]](https://github.com/fatih/vim-go/pull/2261)
|
[[GH-2261]](https://github.com/fatih/vim-go/pull/2261)
|
||||||
* Allow debugging of packages outside of GOPATH without a go.mod file.
|
* Allow debugging of packages outside of GOPATH without a go.mod file.
|
||||||
[[GH-2269]](https://github.com/fatih/vim-go/pull/2269)
|
[[GH-2269]](https://github.com/fatih/vim-go/pull/2269)
|
||||||
* Show which example failed when Example tests fail
|
|
||||||
[[GH-2277]](https://github.com/fatih/vim-go/pull/2277)
|
|
||||||
* Show function signature and return types in preview window when autocompleting functions and methods.
|
|
||||||
[[GH-2289]](https://github.com/fatih/vim-go/pull/2289)
|
|
||||||
|
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
* display info about function and function types whose parameters are
|
* display info about function and function types whose parameters are
|
||||||
|
@ -31,10 +26,6 @@ BUG FIXES:
|
||||||
[[GH-2268]](https://github.com/fatih/vim-go/pull/2268)
|
[[GH-2268]](https://github.com/fatih/vim-go/pull/2268)
|
||||||
* Set the anchor for method documentation correctly.
|
* Set the anchor for method documentation correctly.
|
||||||
[[GH-2276]](https://github.com/fatih/vim-go/pull/2276)
|
[[GH-2276]](https://github.com/fatih/vim-go/pull/2276)
|
||||||
* Respect the LSP information for determining where candidate matches start.
|
|
||||||
[[GH-2291]](https://github.com/fatih/vim-go/pull/2291)
|
|
||||||
* Restore environment variables with backslashes correctly.
|
|
||||||
[[GH-2292]](https://github.com/fatih/vim-go/pull/2292)
|
|
||||||
|
|
||||||
## 1.20 - (April 22, 2019)
|
## 1.20 - (April 22, 2019)
|
||||||
|
|
||||||
|
|
|
@ -462,9 +462,6 @@ function! s:completionHandler(next, msg) abort dict
|
||||||
let l:match = {'abbr': l:item.label, 'word': l:item.textEdit.newText, 'info': '', 'kind': go#lsp#completionitemkind#Vim(l:item.kind)}
|
let l:match = {'abbr': l:item.label, 'word': l:item.textEdit.newText, 'info': '', 'kind': go#lsp#completionitemkind#Vim(l:item.kind)}
|
||||||
if has_key(l:item, 'detail')
|
if has_key(l:item, 'detail')
|
||||||
let l:match.info = l:item.detail
|
let l:match.info = l:item.detail
|
||||||
if go#lsp#completionitemkind#IsFunction(l:item.kind) || go#lsp#completionitemkind#IsMethod(l:item.kind)
|
|
||||||
let l:match.info = printf('func %s %s', l:item.label, l:item.detail)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has_key(l:item, 'documentation')
|
if has_key(l:item, 'documentation')
|
||||||
|
|
|
@ -66,9 +66,9 @@ endfunc
|
||||||
func! Test_GoTestShowName() abort
|
func! Test_GoTestShowName() abort
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld'},
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld'},
|
||||||
\ {'lnum': 6, 'bufnr': 8, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'},
|
\ {'lnum': 6, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'},
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld/sub'},
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld/sub'},
|
||||||
\ {'lnum': 9, 'bufnr': 8, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'},
|
\ {'lnum': 9, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'},
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
let g:go_test_show_name=1
|
let g:go_test_show_name=1
|
||||||
|
@ -78,14 +78,14 @@ endfunc
|
||||||
|
|
||||||
func! Test_GoTestVet() abort
|
func! Test_GoTestVet() abort
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 6, 'bufnr': 11, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'},
|
\ {'lnum': 6, 'bufnr': 10, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'},
|
||||||
\ ]
|
\ ]
|
||||||
call s:test('veterror/veterror.go', expected)
|
call s:test('veterror/veterror.go', expected)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_GoTestTestCompilerError() abort
|
func! Test_GoTestTestCompilerError() abort
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 10, 'bufnr': 9, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'},
|
\ {'lnum': 10, 'bufnr': 8, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'},
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'struct {} does not implement io.Reader (missing Read method)'}
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'struct {} does not implement io.Reader (missing Read method)'}
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
|
|
@ -557,9 +557,7 @@ function! go#util#SetEnv(name, value) abort
|
||||||
let l:remove = 1
|
let l:remove = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" wrap the value in single quotes so that it will work on windows when there
|
call execute('let $' . a:name . ' = "' . a:value . '"')
|
||||||
" are backslashes present in the value (e.g. $PATH).
|
|
||||||
call execute('let $' . a:name . " = '" . a:value . "'")
|
|
||||||
|
|
||||||
if l:remove
|
if l:remove
|
||||||
function! s:remove(name) abort
|
function! s:remove(name) abort
|
||||||
|
|
Loading…
Reference in a new issue