flatpak
We should look at making a flatpak as an extension to the freedesktop Sdk, which should get VLS to work with Flatpaks for VSCode and other IDEs.
Maybe it'd be easier to just have users install vala-language-server via their distro and then have something like this where the VSCode flatpak has access:
#!/bin/sh
flatpak-spawn --host vala-language-server
I have this stored in $HOME/.bin/vscode/vala-language-server and then set the VSCode Vala Plugin to start vls from that executable and that works just as expected, but is able to access the host's VAPIs.
@Cogitri did you mean to say, "but is not able to access the host's VAPIs?"
No, it's running on the host, so it uses the host's VAPIs, available packages etc. IMHO this is favourable over having vls use the Flatpak environment though, since it's pretty hard to install additonal packages in a flatpak compared to installing them via the user's distro package manager.
Fedora Silverblue user here. Tried to create a Flatpak extension for VS Code specifically time ago, but failed building libgee. Then I created a standalone Flatpak package with the org.gnome.Sdk and it worked (with a few modifications on the VS Code extension), but it can't be expanded with more libraries and VLS currently lacks support for meson subprojects, so not really useful
I think I good idea may be to have VLS installed via Toolbox, and provide to the VS Code extension a way to run flatpak-spawn --host toolbox run vala-language-server if on Flatpak or just toolbox run vala-language-server if on regular VS Code
Maybe it'd be easier to just have users install vala-language-server via their distro and then have something like this where the VSCode flatpak has access:
#!/bin/sh flatpak-spawn --host vala-language-serverI have this stored in
$HOME/.bin/vscode/vala-language-serverand then set the VSCode Vala Plugin to start vls from that executable and that works just as expected, but is able to access the host's VAPIs.
@Cogitri can you elaborate how exactly you managed to successfully auto-start Vala Language Server from a VSCode Flatpak? In my case, I'm always getting a "Starting client failed Launching server using command $HOME/.bin/vala-language-server.sh failed" error. I did set things up as documented here: https://linux.marco.betschart.name/Desktop/Visual-Studio-Code-Vala-Autocompletion.html#setup-vala-autocompletion
I have set this up as following:
- Created a
vala-language-serverscript in$HOME/.bin/vscode/vala-language-server(any location will do though) with the following contents:
#!/bin/sh
flatpak-spawn --host vala-language-server "$@"
- chmod +x vala-language-server
- Added
"vls.languageServerPath": "/home/rasmus/.bin/vscode/vala-language-server"to VSCode'ssettings.json. I think VSCode doesn't lookup the$HOMEvariable so that might be why it fails to startup VLS.
@Cogitri thank you so much!! the hint regarding replacing the environment var with its actual value did the trick.
For users of the flatpaked version of VS Code (and immutable systems), I found this article yesterday: https://jurf.github.io/2020/03/24/vscode-toolbox
After configuring everything as the article indicates, you simply install VLS in the Toolbox and the Vala extension should be able to detect it.
An issue related to this could be microsoft/vscode-remote-release#3345
There is now a flatpak Sdk extension. This can be closed.
Right. Thanks.