-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to reuse open window when go to definition #893
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,48 +9,41 @@ let g:phpactorInitialCwd = getcwd() | |
let g:phpactorCompleteLabelTruncateLength=50 | ||
let g:_phpactorCompletionMeta = {} | ||
|
||
if !exists('g:phpactorPhpBin') | ||
"" | ||
" Path to the PHP binary used by Phpactor | ||
let g:phpactorPhpBin = 'php' | ||
endif | ||
|
||
if !exists('g:phpactorBranch') | ||
"" | ||
" The Phpactor branch to use when calling @command(PhpactorUpdate) | ||
let g:phpactorBranch = 'master' | ||
endif | ||
|
||
if !exists('g:phpactorOmniAutoClassImport') | ||
"" | ||
" Automatically import classes when using VIM native omni-completion | ||
let g:phpactorOmniAutoClassImport = v:true | ||
endif | ||
|
||
if !exists('g:phpactorCompletionIgnoreCase') | ||
"" | ||
" Ignore case when suggestion completion results | ||
let g:phpactorCompletionIgnoreCase = 1 | ||
endif | ||
|
||
if !exists('g:phpactorQuickfixStrategy') | ||
"" | ||
" Function to use when populating a list of code references. The default | ||
" is to use the VIM quick-fix list. | ||
let g:phpactorQuickfixStrategy = 'phpactor#quickfix#vim' | ||
endif | ||
|
||
if !exists('g:phpactorInputListStrategy') | ||
"" | ||
" Function to use when presenting a user with a choice of options. The default | ||
" is to use the VIM inputlist. | ||
let g:phpactorInputListStrategy = 'phpactor#input#list#inputlist' | ||
endif | ||
"" | ||
" Path to the PHP binary used by Phpactor | ||
let g:phpactorPhpBin = get(g:, 'phpactorPhpBin', 'php') | ||
|
||
"" | ||
" The Phpactor branch to use when calling @command(PhpactorUpdate) | ||
let g:phpactorBranch = get(g:, 'phpactorBranch', 'master') | ||
|
||
"" | ||
" Automatically import classes when using VIM native omni-completion | ||
let g:phpactorOmniAutoClassImport = get(g:, 'phpactorOmniAutoClassImport', v:true) | ||
|
||
"" | ||
" Ignore case when suggestion completion results | ||
let g:phpactorCompletionIgnoreCase = get(g:, 'phpactorCompletionIgnoreCase', 1) | ||
|
||
"" | ||
" Function to use when populating a list of code references. The default | ||
" is to use the VIM quick-fix list. | ||
let g:phpactorQuickfixStrategy = get(g:, 'phpactorQuickfixStrategy', 'phpactor#quickfix#vim') | ||
|
||
"" | ||
" Function to use when presenting a user with a choice of options. The default | ||
" is to use the VIM inputlist. | ||
let g:phpactorInputListStrategy = get(g:, 'phpactorInputListStrategy', 'phpactor#input#list#inputlist') | ||
|
||
"" | ||
" When jump to the line of a file displayed in any existing window | ||
" reuse this window to avoid have more than one view of the same file. | ||
" The default is false. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When jumping to a file location: if the target file open in a window, switch to that window instead of switching buffers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot judge what version is more proper. Feel free to choose the better in your opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, if what I said above is technically correct, then it could be better 👍 |
||
let g:phpactorUseOpenWindows = get(g:, 'phpactorUseOpenWindows', v:false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This syntax looks potentially better, but can we use the same as the above for consistency in this PR? We are using vimdoc to generate the docuemntation. Can you add a description of this option as with the other options? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (bonus if you can install There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vimdoc seems to be unavailable from pip repo but I have installed it manually without any problem. I don't know why vimdoc make this removal -NOTE: This help is auto-generated from the VimScript using
-https://github.com/google/vimdoc. See
-https://phpactor.github.io/phpactor/developing.html#vim-help
- and I have to restore it manually. Please review all these changes for English - also function and variable names ;) Rector for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think I added it manually instead of adding it to the |
||
|
||
if g:phpactorOmniAutoClassImport == v:true | ||
autocmd CompleteDone *.php call phpactor#_completeImportClass(v:completed_item) | ||
endif | ||
|
||
|
||
" vim: et ts=4 sw=4 fdm=marker | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is
<SID
> ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you use a function that is defined as local to the script (
function s:foo()
), then using at the call as the prefix allows to avoid ambiguities especially when there exist a local function with the same name and both are run (non directly) from any external (as usually when using autoloaded functions) script. See:help SID
.From the technical point of view local functions are not fully protected from running from outside the script. If you run
:function
to see the list of defined functions then you may notice that local functions are also listed there. For example, at the moment I see a line<SNR>120_string_encode(str) abort
(probably from vim-unimpaired)and I can use it by
echo <SNR>120_string_encode('zxc')
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand correctly, we use the
s:
scope to make this a "private" function. I don't understand why we can't calls:isOpenCurrentWindow
instead of<SID>isOpenCurrentWindow
though?This doesn't sound like it's the case here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we may consider them "private" function (local to the script) remembering that we can still call it prefixed with a script number as above.
I made basic test both on vim and neovim that suggested that using is unnecessary when a function is not called from a mapping. Indeed, the help text stands only about mapping, but it could sound more clear like there.
Thanks for the question.