marlonfan / coc-phpls

🐭 php language server for coc.nvim
MIT License
211 stars 17 forks source link

Configurable cache path #62

Closed mikehaertl closed 4 years ago

mikehaertl commented 4 years ago

I want to have system wide neovim plugins.

Setup

The global config belongs to root.

In /etc/xdg/nvim/init.vim I have

call plug#begin('/etc/xdg/nvim/plugged')    " Use a shared folder
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()           " required

" Config directory for CoC plugin
let g:coc_config_home = '/etc/xdg/nvim/coc'
let g:coc_data_home = '/etc/xdg/nvim/coc'

This makes the extension end up in /etc/xdg/nvim/coc/extensions/node_modules/coc-phpls/.

Problem

Only root can now work with coc, because it creates cache files in /etc/xdg/nvim/coc/extensions/coc-phpls-data/. Normal users don't have (and should not have) write permissions there.

# ls -l /etc/xdg/nvim/coc/extensions/coc-phpls-data/597539a9/
insgesamt 1828
-rw-r--r-- 1 root root      82 Mai 14 15:10 intelephense_data_1
-rw-r--r-- 1 root root   13482 Mai 14 15:10 intelephense_data_2
-rw-r--r-- 1 root root 1128647 Mai 14 15:10 intelephense_data_3
-rw-r--r-- 1 root root  710458 Mai 14 15:10 intelephense_data_4
-rw-r--r-- 1 root root    1635 Mai 14 15:10 intelephense_data_5
-rw-r--r-- 1 root root    2400 Mai 14 15:10 intelephense_data_6
-rw-r--r-- 1 root root       0 Mai 14 15:10 intelephense_data_7

Is there a configuration option to make this path configurable?

If not, can such an option be added? In best case this should default somewhere in the users's home directory.

mikehaertl commented 4 years ago

I found that this is probably rather an option that should be available from coc itself. I think the path is set here for extensions:

https://github.com/neoclide/coc.nvim/blob/21103417359d216a9e059eb271dbe433a6901c77/src/extensions.ts#L751

Unfortunately there's no way to configure it in coc either. Any idea still welcome.

mikehaertl commented 4 years ago

@marlonfan Do you agree that this is an issue for Coc? Or could this be fixed here?

marlonfan commented 4 years ago

Hi, thanks feedback. You're going to use the storepath set by the coc.nvim: g:coc_data_home, I think if your coc-config.json are for all users, they should be in the path that all users have access to. or, Alternatively, each user has a .vimrc file. @mikehaertl

mikehaertl commented 4 years ago

Ok, I will probably only have a global init.vim and leave the plugin install and config files local to each user. Anything else will not work reliably I found.

Thanks for your help.