Skip to content

Commit 2c64ca1

Browse files
committed
Update runtime files
1 parent 04c86d2 commit 2c64ca1

16 files changed

Lines changed: 199 additions & 97 deletions

File tree

runtime/autoload/phpcomplete.vim

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Dávid Szabó ( complex857 AT gmail DOT com )
44
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
55
" URL: https://github.com/shawncplus/phpcomplete.vim
6-
" Last Change: 2016 Oct 10
6+
" Last Change: 2018 Oct 10
77
"
88
" OPTIONS:
99
"
@@ -146,6 +146,8 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
146146
end
147147

148148
try
149+
let eventignore = &eventignore
150+
let &eventignore = 'all'
149151
let winheight = winheight(0)
150152
let winnr = winnr()
151153

@@ -216,6 +218,7 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
216218
endif
217219
finally
218220
silent! exec winnr.'resize '.winheight
221+
let &eventignore = eventignore
219222
endtry
220223
endfunction
221224
" }}}
@@ -1393,23 +1396,28 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat
13931396
for classstructure in classcontents
13941397
let docblock_target_pattern = 'function\s\+&\?'.method.'\>\|\(public\|private\|protected\|var\).\+\$'.method.'\>\|@property.\+\$'.method.'\>'
13951398
let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern)
1396-
if doc_str != ''
1399+
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(split(classstructure.content, '\n'), 'function\s\+&\?'.method.'\>')
1400+
if doc_str != '' || return_type_hint != ''
13971401
break
13981402
endif
13991403
endfor
1400-
if doc_str != ''
1404+
if doc_str != '' || return_type_hint != ''
14011405
let docblock = phpcomplete#ParseDocBlock(doc_str)
1402-
if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0
1403-
let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : ''
1404-
1405-
if type == ''
1406-
for property in docblock.properties
1407-
if property.description =~? method
1408-
let type = property.type
1409-
break
1410-
endif
1411-
endfor
1412-
endif
1406+
if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0 || return_type_hint != ''
1407+
if return_type_hint == ''
1408+
let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : ''
1409+
1410+
if type == ''
1411+
for property in docblock.properties
1412+
if property.description =~? method
1413+
let type = property.type
1414+
break
1415+
endif
1416+
endfor
1417+
endif
1418+
else
1419+
let type = return_type_hint
1420+
end
14131421

14141422
" there's a namespace in the type, threat the type as FQCN
14151423
if type =~ '\\'
@@ -1483,7 +1491,7 @@ function! phpcomplete#GetMethodStack(line) " {{{
14831491
continue
14841492
endif
14851493

1486-
" if it's looks like a string
1494+
" if it looks like a string
14871495
if current_char == "'" || current_char == '"'
14881496
" and it is not escaped
14891497
if prev_char != '\' || (prev_char == '\' && prev_prev_char == '\')
@@ -1587,9 +1595,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
15871595
elseif function_file != '' && filereadable(function_file)
15881596
let file_lines = readfile(function_file)
15891597
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
1598+
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>')
15901599
let docblock = phpcomplete#ParseDocBlock(docblock_str)
1591-
if has_key(docblock.return, 'type')
1592-
let classname_candidate = docblock.return.type
1600+
let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint
1601+
if type != ''
1602+
let classname_candidate = type
15931603
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
15941604
" try to expand the classname of the returned type with the context got from the function's source file
15951605

@@ -1821,9 +1831,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
18211831
elseif function_file != '' && filereadable(function_file)
18221832
let file_lines = readfile(function_file)
18231833
let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>')
1834+
let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>')
18241835
let docblock = phpcomplete#ParseDocBlock(docblock_str)
1825-
if has_key(docblock.return, 'type')
1826-
let classname_candidate = docblock.return.type
1836+
let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint
1837+
if type != ''
1838+
let classname_candidate = type
18271839
let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines)
18281840
" try to expand the classname of the returned type with the context got from the function's source file
18291841
let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports)
@@ -2413,6 +2425,44 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{
24132425
endfunction
24142426
" }}}
24152427

2428+
function! phpcomplete#GetFunctionReturnTypeHint(sccontent, search)
2429+
let i = 0
2430+
let l = 0
2431+
let function_line_start = -1
2432+
let function_line_end = -1
2433+
let sccontent_len = len(a:sccontent)
2434+
let return_type = ''
2435+
2436+
while (i < sccontent_len)
2437+
let line = a:sccontent[i]
2438+
" search for a function declaration
2439+
if line =~? a:search
2440+
let l = i
2441+
let function_line_start = i
2442+
" now search for the first { where the function body starts
2443+
while l < sccontent_len
2444+
let line = a:sccontent[l]
2445+
if line =~? '\V{'
2446+
let function_line_end = l
2447+
break
2448+
endif
2449+
let l += 1
2450+
endwhile
2451+
break
2452+
endif
2453+
let i += 1
2454+
endwhile
2455+
2456+
" now grab the lines that holds the function declaration line
2457+
if function_line_start != -1 && function_line_end != -1
2458+
let function_line = join(a:sccontent[function_line_start :function_line_end], " ")
2459+
let class_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*'
2460+
let return_type = matchstr(function_line, '\c\s*:\s*\zs'.class_name_pattern.'\ze\s*{')
2461+
endif
2462+
return return_type
2463+
2464+
endfunction
2465+
24162466
function! phpcomplete#GetTypeFromDocBlockParam(docblock_type) " {{{
24172467
if a:docblock_type !~ '|'
24182468
return a:docblock_type
@@ -2572,7 +2622,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{
25722622
" find kind flags from tags or built in methods for the objects we extracted
25732623
" they can be either classes, interfaces or namespaces, no other thing is importable in php
25742624
for [key, import] in items(imports)
2575-
" if theres a \ in the name we have it's definetly not a built in thing, look for tags
2625+
" if theres a \ in the name we have it's definitely not a built in thing, look for tags
25762626
if import.name =~ '\\'
25772627
let patched_ctags_detected = 0
25782628
let [classname, namespace_for_classes] = phpcomplete#ExpandClassName(import.name, '\', {})

runtime/doc/autocmd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ Name triggered by ~
301301
|FileChangedShellPost| After handling a file changed since editing started
302302
|FileChangedRO| before making the first change to a read-only file
303303

304+
|DiffUpdated| after diffs have been updated
304305
|DirChanged| after the working directory has changed
305306

306307
|ShellCmdPost| after executing a shell command

runtime/doc/cmdline.txt

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,46 @@ after a command causes the rest of the line to be ignored. This can be used
534534
to add comments. Example: >
535535
:set ai "set 'autoindent' option
536536
It is not possible to add a comment to a shell command ":!cmd" or to the
537-
":map" command and a few others, because they see the '"' as part of their
538-
argument. This is mentioned where the command is explained.
537+
":map" command and a few others (mainly commands that expect expressions)
538+
that see the '"' as part of their argument:
539+
540+
:argdo
541+
:autocmd
542+
:bufdo
543+
:cexpr (and the like)
544+
:call
545+
:cdo (and the like)
546+
:command
547+
:cscope (and the like)
548+
:debug
549+
:display
550+
:echo (and the like)
551+
:elseif
552+
:execute
553+
:folddoopen
554+
:folddoclosed
555+
:for
556+
:grep (and the like)
557+
:help (and the like)
558+
:if
559+
:let
560+
:make
561+
:map (and the like including :abbrev commands)
562+
:menu (and the like)
563+
:mkspell
564+
:normal
565+
:ownsyntax
566+
:popup
567+
:promptfind (and the like)
568+
:registers
569+
:return
570+
:sort
571+
:syntax
572+
:tabdo
573+
:tearoff
574+
:vimgrep (and the like)
575+
:while
576+
:windo
539577

540578
*:bar* *:\bar*
541579
'|' can be used to separate commands, so you can give multiple commands in one

runtime/doc/eval.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,8 @@ assert_equalfile({fname-one}, {fname-two})
20382038
Number assert file contents is equal
20392039
assert_exception({error} [, {msg}])
20402040
Number assert {error} is in v:exception
2041-
assert_fails({cmd} [, {error}]) Number assert {cmd} fails
2041+
assert_fails({cmd} [, {error} [, {msg}]])
2042+
Number assert {cmd} fails
20422043
assert_false({actual} [, {msg}])
20432044
Number assert {actual} is false
20442045
assert_inrange({lower}, {upper}, {actual} [, {msg}])
@@ -2461,7 +2462,7 @@ term_setkill({buf}, {how}) none set signal to stop job in terminal
24612462
term_setrestore({buf}, {command}) none set command to restore terminal
24622463
term_setsize({buf}, {rows}, {cols})
24632464
none set the size of a terminal
2464-
term_start({cmd}, {options}) Job open a terminal window and run a job
2465+
term_start({cmd}, {options}) Number open a terminal window and run a job
24652466
term_wait({buf} [, {time}]) Number wait for screen to be updated
24662467
test_alloc_fail({id}, {countdown}, {repeat})
24672468
none make memory allocation fail
@@ -2475,8 +2476,8 @@ test_null_job() Job null value for testing
24752476
test_null_list() List null value for testing
24762477
test_null_partial() Funcref null value for testing
24772478
test_null_string() String null value for testing
2478-
test_option_not_set({name}) none reset flag indicating option was set
2479-
test_override({expr}, {val}) none test with Vim internal overrides
2479+
test_option_not_set({name}) none reset flag indicating option was set
2480+
test_override({expr}, {val}) none test with Vim internal overrides
24802481
test_scrollbar({which}, {value}, {dragging})
24812482
none scroll in the GUI for testing
24822483
test_settime({expr}) none set current time for testing
@@ -2671,7 +2672,7 @@ assert_exception({error} [, {msg}]) *assert_exception()*
26712672
call assert_exception('E492:')
26722673
endtry
26732674
2674-
assert_fails({cmd} [, {error}]) *assert_fails()*
2675+
assert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()*
26752676
Run {cmd} and add an error message to |v:errors| if it does
26762677
NOT produce an error. Also see |assert-return|.
26772678
When {error} is given it must match in |v:errmsg|.

runtime/doc/gui_x11.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ unexpectedly less attractive or even deteriorates their usability. Keep this
496496
in mind always when you try improving a theme.
497497

498498

499-
Example 3. border color
499+
Example 3. border color ~
500500

501501
To eliminate borders when maximized: >
502502

runtime/doc/help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,4 @@ will try to find help for it. Especially for options in single quotes, e.g.
225225
'compatible'.
226226

227227
------------------------------------------------------------------------------
228-
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
228+
vim:tw=78:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:

runtime/doc/indent.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,11 @@ Indent after a nested paren: >
941941
Indent for a continuation line: >
942942
let g:pyindent_continue = '&sw * 2'
943943
944+
The method uses searchpair() to look back for unclosed parenthesis. This can
945+
sometimes be slow, thus it timeouts after 150 msec. If you notice the
946+
indenting isn't correct, you can set a larger timeout in msec: >
947+
let g:pyindent_searchpair_timeout = 500
948+
944949
945950
R *ft-r-indent*
946951

runtime/doc/options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,8 +3895,8 @@ A jump table for the options with a short description can be found at |Q_op|.
38953895
screen.
38963896

38973897
*'guioptions'* *'go'*
3898-
'guioptions' 'go' string (default "egmrLtT" (MS-Windows, "t" is
3899-
removed in |defaults.vim|),
3898+
'guioptions' 'go' string (default "egmrLtT" (MS-Windows,
3899+
"t" is removed in |defaults.vim|),
39003900
"aegimrLtT" (GTK, Motif and Athena),
39013901
)
39023902
global

runtime/doc/os_390.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ There is no solution for this yet.
8383
ctags out there, that does it right, but we can't be sure. So this seems to
8484
be a permanent restriction.
8585

86-
- The cscope interface (|cscope|) doesn't work for the version of cscope
87-
that we use on our mainframe. We have a copy of version 15.0b12, and it
88-
causes Vim to hang when using the "cscope add" command. I'm guessing that
89-
the binary format of the cscope database isn't quite what Vim is expecting.
86+
- The cscope interface (|cscope|) doesn't work for the version of cscope that
87+
we use on our mainframe. We have a copy of version 15.0b12, and it causes
88+
Vim to hang when using the "cscope add" command. I'm guessing that the
89+
binary format of the cscope database isn't quite what Vim is expecting.
9090
I've tried to port the current version of cscope (15.3) to z/OS, without
9191
much success. If anyone is interested in trying, drop me a line if you
9292
make any progress.
@@ -131,4 +131,4 @@ Also look at:
131131

132132

133133
------------------------------------------------------------------------------
134-
vim:tw=78:fo=tcq2:ts=8:noet:ft=help:norl:
134+
vim:tw=78:ts=8:noet:ft=help:norl:

runtime/doc/os_win32.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,4 @@ A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of
303303
'runtimepath'. For example ~/vimfiles/bitmaps/vim.ico.
304304

305305

306-
vim:tw=78:fo=tcq2:ts=8:noet:ft=help:norl:
306+
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)