mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
@@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Dávid Szabó ( complex857 AT gmail DOT com )
|
" Maintainer: Dávid Szabó ( complex857 AT gmail DOT com )
|
||||||
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||||
" URL: https://github.com/shawncplus/phpcomplete.vim
|
" URL: https://github.com/shawncplus/phpcomplete.vim
|
||||||
" Last Change: 2016 Oct 10
|
" Last Change: 2018 Oct 10
|
||||||
"
|
"
|
||||||
" OPTIONS:
|
" OPTIONS:
|
||||||
"
|
"
|
||||||
@@ -146,6 +146,8 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
|||||||
end
|
end
|
||||||
|
|
||||||
try
|
try
|
||||||
|
let eventignore = &eventignore
|
||||||
|
let &eventignore = 'all'
|
||||||
let winheight = winheight(0)
|
let winheight = winheight(0)
|
||||||
let winnr = winnr()
|
let winnr = winnr()
|
||||||
|
|
||||||
@@ -216,6 +218,7 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
|||||||
endif
|
endif
|
||||||
finally
|
finally
|
||||||
silent! exec winnr.'resize '.winheight
|
silent! exec winnr.'resize '.winheight
|
||||||
|
let &eventignore = eventignore
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
@@ -1393,23 +1396,28 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat
|
|||||||
for classstructure in classcontents
|
for classstructure in classcontents
|
||||||
let docblock_target_pattern = 'function\s\+&\?'.method.'\>\|\(public\|private\|protected\|var\).\+\$'.method.'\>\|@property.\+\$'.method.'\>'
|
let docblock_target_pattern = 'function\s\+&\?'.method.'\>\|\(public\|private\|protected\|var\).\+\$'.method.'\>\|@property.\+\$'.method.'\>'
|
||||||
let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern)
|
let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern)
|
||||||
if doc_str != ''
|
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(split(classstructure.content, '\n'), 'function\s\+&\?'.method.'\>')
|
||||||
|
if doc_str != '' || return_type_hint != ''
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if doc_str != ''
|
if doc_str != '' || return_type_hint != ''
|
||||||
let docblock = phpcomplete#ParseDocBlock(doc_str)
|
let docblock = phpcomplete#ParseDocBlock(doc_str)
|
||||||
if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0
|
if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0 || return_type_hint != ''
|
||||||
let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : ''
|
if return_type_hint == ''
|
||||||
|
let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : ''
|
||||||
|
|
||||||
if type == ''
|
if type == ''
|
||||||
for property in docblock.properties
|
for property in docblock.properties
|
||||||
if property.description =~? method
|
if property.description =~? method
|
||||||
let type = property.type
|
let type = property.type
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
let type = return_type_hint
|
||||||
|
end
|
||||||
|
|
||||||
" there's a namespace in the type, threat the type as FQCN
|
" there's a namespace in the type, threat the type as FQCN
|
||||||
if type =~ '\\'
|
if type =~ '\\'
|
||||||
@@ -1483,7 +1491,7 @@ function! phpcomplete#GetMethodStack(line) " {{{
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" if it's looks like a string
|
" if it looks like a string
|
||||||
if current_char == "'" || current_char == '"'
|
if current_char == "'" || current_char == '"'
|
||||||
" and it is not escaped
|
" and it is not escaped
|
||||||
if prev_char != '\' || (prev_char == '\' && prev_prev_char == '\')
|
if prev_char != '\' || (prev_char == '\' && prev_prev_char == '\')
|
||||||
@@ -1587,9 +1595,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
|
|||||||
elseif function_file != '' && filereadable(function_file)
|
elseif function_file != '' && filereadable(function_file)
|
||||||
let file_lines = readfile(function_file)
|
let file_lines = readfile(function_file)
|
||||||
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
|
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
|
||||||
|
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>')
|
||||||
let docblock = phpcomplete#ParseDocBlock(docblock_str)
|
let docblock = phpcomplete#ParseDocBlock(docblock_str)
|
||||||
if has_key(docblock.return, 'type')
|
let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint
|
||||||
let classname_candidate = docblock.return.type
|
if type != ''
|
||||||
|
let classname_candidate = type
|
||||||
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
||||||
" try to expand the classname of the returned type with the context got from the function's source file
|
" try to expand the classname of the returned type with the context got from the function's source file
|
||||||
|
|
||||||
@@ -1821,9 +1831,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
|
|||||||
elseif function_file != '' && filereadable(function_file)
|
elseif function_file != '' && filereadable(function_file)
|
||||||
let file_lines = readfile(function_file)
|
let file_lines = readfile(function_file)
|
||||||
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
|
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
|
||||||
|
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>')
|
||||||
let docblock = phpcomplete#ParseDocBlock(docblock_str)
|
let docblock = phpcomplete#ParseDocBlock(docblock_str)
|
||||||
if has_key(docblock.return, 'type')
|
let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint
|
||||||
let classname_candidate = docblock.return.type
|
if type != ''
|
||||||
|
let classname_candidate = type
|
||||||
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
|
||||||
" try to expand the classname of the returned type with the context got from the function's source file
|
" try to expand the classname of the returned type with the context got from the function's source file
|
||||||
let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports)
|
let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports)
|
||||||
@@ -2413,6 +2425,44 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{
|
|||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
function! phpcomplete#GetFunctionReturnTypeHint(sccontent, search)
|
||||||
|
let i = 0
|
||||||
|
let l = 0
|
||||||
|
let function_line_start = -1
|
||||||
|
let function_line_end = -1
|
||||||
|
let sccontent_len = len(a:sccontent)
|
||||||
|
let return_type = ''
|
||||||
|
|
||||||
|
while (i < sccontent_len)
|
||||||
|
let line = a:sccontent[i]
|
||||||
|
" search for a function declaration
|
||||||
|
if line =~? a:search
|
||||||
|
let l = i
|
||||||
|
let function_line_start = i
|
||||||
|
" now search for the first { where the function body starts
|
||||||
|
while l < sccontent_len
|
||||||
|
let line = a:sccontent[l]
|
||||||
|
if line =~? '\V{'
|
||||||
|
let function_line_end = l
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let l += 1
|
||||||
|
endwhile
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let i += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" now grab the lines that holds the function declaration line
|
||||||
|
if function_line_start != -1 && function_line_end != -1
|
||||||
|
let function_line = join(a:sccontent[function_line_start :function_line_end], " ")
|
||||||
|
let class_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*'
|
||||||
|
let return_type = matchstr(function_line, '\c\s*:\s*\zs'.class_name_pattern.'\ze\s*{')
|
||||||
|
endif
|
||||||
|
return return_type
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! phpcomplete#GetTypeFromDocBlockParam(docblock_type) " {{{
|
function! phpcomplete#GetTypeFromDocBlockParam(docblock_type) " {{{
|
||||||
if a:docblock_type !~ '|'
|
if a:docblock_type !~ '|'
|
||||||
return a:docblock_type
|
return a:docblock_type
|
||||||
@@ -2572,7 +2622,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{
|
|||||||
" find kind flags from tags or built in methods for the objects we extracted
|
" find kind flags from tags or built in methods for the objects we extracted
|
||||||
" they can be either classes, interfaces or namespaces, no other thing is importable in php
|
" they can be either classes, interfaces or namespaces, no other thing is importable in php
|
||||||
for [key, import] in items(imports)
|
for [key, import] in items(imports)
|
||||||
" if theres a \ in the name we have it's definetly not a built in thing, look for tags
|
" if theres a \ in the name we have it's definitely not a built in thing, look for tags
|
||||||
if import.name =~ '\\'
|
if import.name =~ '\\'
|
||||||
let patched_ctags_detected = 0
|
let patched_ctags_detected = 0
|
||||||
let [classname, namespace_for_classes] = phpcomplete#ExpandClassName(import.name, '\', {})
|
let [classname, namespace_for_classes] = phpcomplete#ExpandClassName(import.name, '\', {})
|
||||||
|
|||||||
@@ -287,6 +287,7 @@ Name triggered by ~
|
|||||||
|VimSuspend| before Nvim is suspended
|
|VimSuspend| before Nvim is suspended
|
||||||
|
|
||||||
Various
|
Various
|
||||||
|
|DiffUpdated| after diffs have been updated
|
||||||
|DirChanged| after the |current-directory| was changed
|
|DirChanged| after the |current-directory| was changed
|
||||||
|
|
||||||
|FileChangedShell| Vim notices that a file changed since editing started
|
|FileChangedShell| Vim notices that a file changed since editing started
|
||||||
|
|||||||
@@ -495,8 +495,46 @@ after a command causes the rest of the line to be ignored. This can be used
|
|||||||
to add comments. Example: >
|
to add comments. Example: >
|
||||||
:set ai "set 'autoindent' option
|
:set ai "set 'autoindent' option
|
||||||
It is not possible to add a comment to a shell command ":!cmd" or to the
|
It is not possible to add a comment to a shell command ":!cmd" or to the
|
||||||
":map" command and a few others, because they see the '"' as part of their
|
":map" command and a few others (mainly commands that expect expressions)
|
||||||
argument. This is mentioned where the command is explained.
|
that see the '"' as part of their argument:
|
||||||
|
|
||||||
|
:argdo
|
||||||
|
:autocmd
|
||||||
|
:bufdo
|
||||||
|
:cexpr (and the like)
|
||||||
|
:call
|
||||||
|
:cdo (and the like)
|
||||||
|
:command
|
||||||
|
:cscope (and the like)
|
||||||
|
:debug
|
||||||
|
:display
|
||||||
|
:echo (and the like)
|
||||||
|
:elseif
|
||||||
|
:execute
|
||||||
|
:folddoopen
|
||||||
|
:folddoclosed
|
||||||
|
:for
|
||||||
|
:grep (and the like)
|
||||||
|
:help (and the like)
|
||||||
|
:if
|
||||||
|
:let
|
||||||
|
:make
|
||||||
|
:map (and the like including :abbrev commands)
|
||||||
|
:menu (and the like)
|
||||||
|
:mkspell
|
||||||
|
:normal
|
||||||
|
:ownsyntax
|
||||||
|
:popup
|
||||||
|
:promptfind (and the like)
|
||||||
|
:registers
|
||||||
|
:return
|
||||||
|
:sort
|
||||||
|
:syntax
|
||||||
|
:tabdo
|
||||||
|
:tearoff
|
||||||
|
:vimgrep (and the like)
|
||||||
|
:while
|
||||||
|
:windo
|
||||||
|
|
||||||
*:bar* *:\bar*
|
*:bar* *:\bar*
|
||||||
'|' can be used to separate commands, so you can give multiple commands in one
|
'|' can be used to separate commands, so you can give multiple commands in one
|
||||||
|
|||||||
@@ -2495,7 +2495,7 @@ assert_exception({error} [, {msg}]) *assert_exception()*
|
|||||||
call assert_exception('E492:')
|
call assert_exception('E492:')
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
assert_fails({cmd} [, {error}]) *assert_fails()*
|
assert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()*
|
||||||
Run {cmd} and add an error message to |v:errors| if it does
|
Run {cmd} and add an error message to |v:errors| if it does
|
||||||
NOT produce an error.
|
NOT produce an error.
|
||||||
When {error} is given it must match in |v:errmsg|.
|
When {error} is given it must match in |v:errmsg|.
|
||||||
|
|||||||
@@ -182,4 +182,4 @@ will try to find help for it. Especially for options in single quotes, e.g.
|
|||||||
'hlsearch'.
|
'hlsearch'.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
|
vim:tw=78:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
|
||||||
|
|||||||
@@ -937,6 +937,11 @@ Indent after a nested paren: >
|
|||||||
Indent for a continuation line: >
|
Indent for a continuation line: >
|
||||||
let g:pyindent_continue = '&sw * 2'
|
let g:pyindent_continue = '&sw * 2'
|
||||||
|
|
||||||
|
The method uses searchpair() to look back for unclosed parenthesis. This can
|
||||||
|
sometimes be slow, thus it timeouts after 150 msec. If you notice the
|
||||||
|
indenting isn't correct, you can set a larger timeout in msec: >
|
||||||
|
let g:pyindent_searchpair_timeout = 500
|
||||||
|
|
||||||
|
|
||||||
R *ft-r-indent*
|
R *ft-r-indent*
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ function GetPythonIndent(lnum)
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" searchpair() can be slow sometimes, limit the time to 100 msec or what is
|
||||||
|
" put in g:pyindent_searchpair_timeout
|
||||||
|
let searchpair_stopline = 0
|
||||||
|
let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150)
|
||||||
|
|
||||||
" If the previous line is inside parenthesis, use the indent of the starting
|
" If the previous line is inside parenthesis, use the indent of the starting
|
||||||
" line.
|
" line.
|
||||||
" Trick: use the non-existing "dummy" variable to break out of the loop when
|
" Trick: use the non-existing "dummy" variable to break out of the loop when
|
||||||
@@ -61,7 +66,8 @@ function GetPythonIndent(lnum)
|
|||||||
let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
|
let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
|
||||||
\ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
|
\ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
|
||||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||||
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
|
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
|
||||||
|
\ searchpair_stopline, searchpair_timeout)
|
||||||
if parlnum > 0
|
if parlnum > 0
|
||||||
let plindent = indent(parlnum)
|
let plindent = indent(parlnum)
|
||||||
let plnumstart = parlnum
|
let plnumstart = parlnum
|
||||||
@@ -80,14 +86,16 @@ function GetPythonIndent(lnum)
|
|||||||
let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||||
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
|
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
|
||||||
|
\ searchpair_stopline, searchpair_timeout)
|
||||||
if p > 0
|
if p > 0
|
||||||
if p == plnum
|
if p == plnum
|
||||||
" When the start is inside parenthesis, only indent one 'shiftwidth'.
|
" When the start is inside parenthesis, only indent one 'shiftwidth'.
|
||||||
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
|
||||||
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
|
||||||
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
|
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
|
||||||
|
\ searchpair_stopline, searchpair_timeout)
|
||||||
if pp > 0
|
if pp > 0
|
||||||
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
|
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: BIND configuration file
|
" Language: BIND configuration file
|
||||||
" Maintainer: Nick Hibma <nick@van-laarhoven.org>
|
" Maintainer: Nick Hibma <nick@van-laarhoven.org>
|
||||||
" Last change: 2007-01-30
|
" Last Change: 2007-01-30
|
||||||
" Filenames: named.conf, rndc.conf
|
" Filenames: named.conf, rndc.conf
|
||||||
" Location: http://www.van-laarhoven.org/vim/syntax/named.vim
|
" Location: http://www.van-laarhoven.org/vim/syntax/named.vim
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
" Maintainer: Ken Takata
|
" Maintainer: Ken Takata
|
||||||
" URL: https://github.com/k-takata/vim-nsis
|
" URL: https://github.com/k-takata/vim-nsis
|
||||||
" Previous Maintainer: Alex Jakushev <Alex.Jakushev@kemek.lt>
|
" Previous Maintainer: Alex Jakushev <Alex.Jakushev@kemek.lt>
|
||||||
" Last Change: 2018-02-07
|
" Last Change: 2018-10-02
|
||||||
|
|
||||||
" quit when a syntax file was already loaded
|
" quit when a syntax file was already loaded
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
@@ -104,8 +104,8 @@ syn match nsisSysVar "$\$"
|
|||||||
syn match nsisSysVar "$\\["'`]"
|
syn match nsisSysVar "$\\["'`]"
|
||||||
|
|
||||||
"LABELS (4.3)
|
"LABELS (4.3)
|
||||||
syn match nsisLocalLabel contained "[^-+!$0-9;#. \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)"
|
syn match nsisLocalLabel contained "[^-+!$0-9;"'#. \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)"
|
||||||
syn match nsisGlobalLabel contained "\.[^-+!$0-9;# \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)"
|
syn match nsisGlobalLabel contained "\.[^-+!$0-9;"'# \t/*][^ \t:;#]*:\ze\%($\|[ \t;#]\|\/\*\)"
|
||||||
|
|
||||||
"CONSTANTS
|
"CONSTANTS
|
||||||
syn keyword nsisBoolean contained true false
|
syn keyword nsisBoolean contained true false
|
||||||
|
|||||||
Reference in New Issue
Block a user