Skip to content

Commit 93d7fe4

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 4be190e + 0fd6be7 commit 93d7fe4

61 files changed

Lines changed: 1176 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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/delmenu.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
" Last Change: 2001 May 27
66

77
aunmenu *
8+
tlunmenu *
89

910
silent! unlet did_install_default_menus
1011
silent! unlet did_install_syntax_menu

runtime/doc/autocmd.txt

Lines changed: 4 additions & 2 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
@@ -834,13 +835,14 @@ MenuPopup Just before showing the popup menu (under the
834835
right mouse button). Useful for adjusting the
835836
menu for what is under the cursor or mouse
836837
pointer.
837-
The pattern is matched against a single
838-
character representing the mode:
838+
The pattern is matched against one or two
839+
characters representing the mode:
839840
n Normal
840841
v Visual
841842
o Operator-pending
842843
i Insert
843844
c Command line
845+
tl Terminal
844846
*OptionSet*
845847
OptionSet After setting an option. The pattern is
846848
matched against the long option name.

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.txt

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,16 @@ floating menus that do not appear on the main menu bar.
547547

548548
5.2 Creating New Menus *creating-menus*
549549

550-
*:me* *:menu* *:noreme* *:noremenu*
551-
*:am* *:amenu* *:an* *:anoremenu*
552-
*:nme* *:nmenu* *:nnoreme* *:nnoremenu*
553-
*:ome* *:omenu* *:onoreme* *:onoremenu*
554-
*:vme* *:vmenu* *:vnoreme* *:vnoremenu*
555-
*:xme* *:xmenu* *:xnoreme* *:xnoremenu*
556-
*:sme* *:smenu* *:snoreme* *:snoremenu*
557-
*:ime* *:imenu* *:inoreme* *:inoremenu*
558-
*:cme* *:cmenu* *:cnoreme* *:cnoremenu*
550+
*:me* *:menu* *:noreme* *:noremenu*
551+
*:am* *:amenu* *:an* *:anoremenu*
552+
*:nme* *:nmenu* *:nnoreme* *:nnoremenu*
553+
*:ome* *:omenu* *:onoreme* *:onoremenu*
554+
*:vme* *:vmenu* *:vnoreme* *:vnoremenu*
555+
*:xme* *:xmenu* *:xnoreme* *:xnoremenu*
556+
*:sme* *:smenu* *:snoreme* *:snoremenu*
557+
*:ime* *:imenu* *:inoreme* *:inoremenu*
558+
*:cme* *:cmenu* *:cnoreme* *:cnoremenu*
559+
*:tlm* *:tlmenu* *:tln* *:tlnoremenu*
559560
*E330* *E327* *E331* *E336* *E333*
560561
*E328* *E329* *E337* *E792*
561562
To create a new menu item, use the ":menu" commands. They are mostly like
@@ -571,6 +572,10 @@ the mouse button down on this will pop up a menu containing the item
571572
"Big Changes", which is a sub-menu containing the item "Delete All Spaces",
572573
which when selected, performs the operation.
573574

575+
To create a menu for terminal mode, use |:tlmenu| instead of |:tmenu| unlike
576+
key mapping (|:tmap|). This is because |:tmenu| is already used for defining
577+
tooltips for menus. See |terminal-typing|.
578+
574579
Special characters in a menu name:
575580

576581
& The next character is the shortcut key. Make sure each
@@ -589,9 +594,9 @@ With the shortcut "F" (while keeping the <Alt> key pressed), and then "O",
589594
this menu can be used. The second part is shown as "Open :e". The ":e"
590595
is right aligned, and the "O" is underlined, to indicate it is the shortcut.
591596

592-
The ":amenu" command can be used to define menu entries for all modes at once.
593-
To make the command work correctly, a character is automatically inserted for
594-
some modes:
597+
The ":amenu" command can be used to define menu entries for all modes at once,
598+
except for Terminal mode. To make the command work correctly, a character is
599+
automatically inserted for some modes:
595600
mode inserted appended ~
596601
Normal nothing nothing
597602
Visual <C-C> <C-\><C-G>
@@ -866,6 +871,16 @@ be used to complete the name of the menu item.
866871
insert-mode menu Eg: >
867872
:emenu File.Exit
868873
874+
:[range]em[enu] {mode} {menu} Like above, but execute the menu for {mode}:
875+
'n': |:nmenu| Normal mode
876+
'v': |:vmenu| Visual mode
877+
's': |:smenu| Select mode
878+
'o': |:omenu| Operator-pending mode
879+
't': |:tlmenu| Terminal mode
880+
'i': |:imenu| Insert mode
881+
'c': |:cmenu| Cmdline mode
882+
883+
869884
If the console-mode vim has been compiled with WANT_MENU defined, you can
870885
use :emenu to access useful menu items you may have got used to from GUI
871886
mode. See 'wildmenu' for an option that works well with this. See
@@ -886,6 +901,7 @@ using the last visual selection.
886901
*:sunme* *:sunmenu*
887902
*:iunme* *:iunmenu*
888903
*:cunme* *:cunmenu*
904+
*:tlu* *:tlunmenu*
889905
To delete a menu item or a whole submenu, use the unmenu commands, which are
890906
analogous to the unmap commands. Eg: >
891907
:unmenu! Edit.Paste
@@ -952,6 +968,8 @@ See section |42.4| in the user manual.
952968
:tu[nmenu] {menupath} Remove a tip for a menu or tool.
953969
{only in X11 and Win32 GUI}
954970

971+
Note: To create menus for terminal mode, use |:tlmenu| instead.
972+
955973
When a tip is defined for a menu item, it appears in the command-line area
956974
when the mouse is over that item, much like a standard Windows menu hint in
957975
the status bar. (Except when Vim is in Command-line mode, when of course

runtime/doc/gui_x11.txt

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

507507

508-
Example 3. border color
508+
Example 3. border color ~
509509

510510
To eliminate borders when maximized: >
511511

runtime/doc/help.txt

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

228228
------------------------------------------------------------------------------
229-
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
229+
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

0 commit comments

Comments
 (0)