I'm trying to set the environment.phpVersion config for the intelephense (PHP) server dynamically. Unfortunately intelephense does not do this automatically.
In neovim, I did this using the on_init function provided by nvim-lspconfig. Is there something similar I can use here, or can I use some kind of vimscript to do this?
Conditionally adding the server if vim is opened in a directory where there is a composer.json file does work, but it would be nice to be able to set the version so I can move around to different projects within vim.
Here is what I have right now. (github doesn't support vim9script yet I don't think? this is all in vim9script).
What I would like to see is something like this (I think this is valid vim9script...but not sure. you get the idea though):
" ...
var lspServers = []
var intelephense = {
" intelephense...
}
" onInit (optional): each time the server is started, execute an inline function that has the settings as a param and changes the settings
intelephense.onInit = (intelephense) => {
intelephense.workspaceConfig = {
intelephense: { environment: { phpVersion: GetPHPVersion() } }
}
}
lspServers->add(intelephense)
Hi there, thank you for this plugin!
I'm trying to set the
environment.phpVersion
config for the intelephense (PHP) server dynamically. Unfortunately intelephense does not do this automatically.In neovim, I did this using the
on_init
function provided by nvim-lspconfig. Is there something similar I can use here, or can I use some kind of vimscript to do this?Conditionally adding the server if vim is opened in a directory where there is a
composer.json
file does work, but it would be nice to be able to set the version so I can move around to different projects within vim.Here is what I have right now. (github doesn't support vim9script yet I don't think? this is all in vim9script).
What I would like to see is something like this (I think this is valid vim9script...but not sure. you get the idea though):