Skip to content
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

Can't use plugins where binaries are used from PATH #32

Open
VarLad opened this issue Oct 13, 2022 · 4 comments
Open

Can't use plugins where binaries are used from PATH #32

VarLad opened this issue Oct 13, 2022 · 4 comments

Comments

@VarLad
Copy link

VarLad commented Oct 13, 2022

There are some plugins which use the binary from system PATH.
Any idea how I can use those plugins with the Flatpak?
Works with the released binaries

@sebastian-de
Copy link
Collaborator

I guess this is a sandbox issue again.
Can you be a bit more specific on which plugin you want to use and where the needed binaries are?

You can try something like flatpak override --user dev.lapce.lapce --env=PATH=/app/bin:/usr/bin:/home/user/.cargo/bin But I guess this won't work if the binaries are in /usr/bin since the sandbox has its own /usr/bin directory.

@nalsai
Copy link

nalsai commented Jan 19, 2023

I'm having the same issue: I want to use the C# (omnisharp) plugin. It needs dotnet and omnisharp installed. I just downloaded omnisharp, put it in my home folder and specified its path in the plugin settings. For dotnet there is an extension (https://github.com/flathub/org.freedesktop.Sdk.Extension.dotnet7).
To be able to use it . /usr/lib/sdk/dotnet7/enable.sh would have to be run before Lapce starts.

The VS Code Flatpak uses a startup script to enable sdk extensions (https://github.com/flathub/com.visualstudio.code/blob/master/code.sh). Maybe Lapce could add something similar?

The html lsp extension needs vscode-langservers-extracted, which I can install on my system using npm and access from the flatpak at /run/host/usr/local/lib/node_modules/vscode-langservers-extracted/, but it needs nodejs to run. nodejs could be installed as a flatpak extension too, like dotnet.

@nalsai
Copy link

nalsai commented Jan 20, 2023

I managed to get vscode-html-language-server and therefore the html lsp extension to work:
Note: I'm using Fedora 37, on your system the paths may be different.

Install node and vscode-langservers-extracted on host.

sudo dnf install npm
sudo npm i -g vscode-langservers-extracted

In the lapce settings for the html plugin set the path to html-language-server to /run/host/usr/local/lib/node_modules/vscode-langservers-extracted/bin/vscode-html-language-server.

flatpak override --user dev.lapce.lapce --env=PATH=/app/bin:/usr/bin:/run/host/usr/bin:/run/host/usr/local/bin
Allows access to the following:
/run/host/usr/bin -> /usr/bin (contains node)
/run/host/usr/local/bin -> /usr/local/bin (contains node modules)

It shouldn't cause any major problems, as flatpak native binaries are preferred, because they are first in path.

flatpak override --user dev.lapce.lapce --env=LD_LIBRARY_PATH=/run/host/usr/local/lib:/home/nalsai/Apps/lib
Allows access to the following:
/run/host/usr/local/lib -> /usr/local/lib (contains node module libs)
/home/nalsai/Apps/lib
libnode and libuv are required to run node, so I copied them to a separate folder:

mkdir -p /home/nalsai/Apps/lib
cp /usr/lib64/libnode.so.108 /home/nalsai/Apps/lib/
cp -r /usr/lib64/libuv* /home/nalsai/Apps/lib/

Using LD_LIBRARY_PATH=...:/run/host/usr/lib64 does not work, as it contains a lot of different libs (basically everything) from the host system, which breaks the whole flatpak if you try to add it.

I wouldn't recommend this, as it's pretty hacky and could easily break stuff. But at least it shouldn't break anything permanently and is easy to revert by just removing the environment variable overrides from the flatpak again.

Ideally, lapce extensions should include or automatically download all required files and things like dotnet or node could be installed as flatpak extensions, like I described above.

@ell1e
Copy link

ell1e commented Nov 5, 2023

Maybe at least the PATH change could be done inside the flatpak permanently? Because then any LSPs that are self-contained (and don't rely on external libraries) would already work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants