-
Notifications
You must be signed in to change notification settings - Fork 3
[RFC] updates cwd
with the g:phpactorInitialCwd
#2
base: master
Are you sure you want to change the base?
Conversation
As PHPActor now handles a `--working-dir` option, we have to specify the initial working directory instead of Neovim CWD
If this PR get merged, the user change directory to another project with nvim's |
Hum, the " Update PHPActor cwd each time a new buffer is accessed
function! UpdatePHPActorPath()
" Change working dir to the current file
cd %:p:h
" Set 'gitdir' to be the folder containing .git
let gitdir = system("git rev-parse --show-toplevel")
" See if the command output starts with 'fatal' (if it does, not in a git repo)
if empty(matchstr(gitdir, '^fatal:.*'))
let g:phpactorInitialCwd = gitdir
endif
endfunction
autocmd BufEnter *.php call UpdatePHPActorPath() The |
The If I would rather automatically use the directory of current file for invoking phpactor. |
This function is not used by the plugin. This is what I do in order to work on multiple projects into a single Vim instance. By default, without this function, the |
OK My point is, it doesn't look like a good idea to accept Perhaps @dantleech could give some advice // phpactor/phpactor@65b9793#diff-b96c23eeb9efb3d1ce52e97eaf5019b6R11 |
|
Yeah. But current PR adds overhead to new users, because they may need to add vimrc to change It is quite straightforward to simply use the value of |
I think it should be fine to pass the Although since the introduction of RPC, we could equally delegate the call to the Phpactor VIM plugin:
This would also have the additional benefit of any errors being echoed to the status line instead of silently failing. |
The whole point of the existance of this plugin is for async completion support, which prevents blocking the ui when running phpactor (vimscript is single-threaded). Though performance is not an issue for phpactor. |
It can be in some cases (as parsing / reflection is done in real time, with huge classes it's can be a slight issue)
Hmm, only if this plugin is registered before the phpactor plugin? But maybe that's non-obvious. |
I think it's important that the |
I understand. But I still don't like current behavior of I think current behavior is better than that. I'll keep this open, wait for more comments and see how it goes |
cwd
with the g:phpactorInitialCwd
cwd
with the g:phpactorInitialCwd
As PHPActor now handles a
--working-dir
option, we have to specify the initial working directory instead of Neovim CWD