Closed Akselmo closed 1 year ago
This flatpak doesn't ship the tree sitter grammars, instead relying on helix's --grammar fetch
and --grammar build
options to fetch and build grammar in flatpak's user data folder (~/.var/app/com.helix_editor.Helix/config/helix/runtime/grammars/sources
)
I'll check that next time i am using debian, thanks.
Works well, thanks for letting me know of this feature. Mentioned it in the Helix repo as well for those who have same issue: https://github.com/helix-editor/helix/discussions/7161#discussioncomment-6097521
Why not ship with the grammars, and how come this vital information on --grammar fetch
and --grammar build
is not in the helix_first_run.txt? Even better, add it and publish the info from helix_first_run.txt
in the main info area at https://flathub.org/apps/com.helix_editor.Helix, it is very difficult to find for the average user.
Just my thoughts on the matter, cheers :)
I agree that it should probably be mentioned in first run file.
The reason why it is complicated to ship grammars is that we can't access the internet during build time. So to download sources of grammars we would need to parse the languages.toml and make flatpak-builder source definition to download them. Which I tried to do, but one of the grammars repo has a broken submodule and because of that flatpak-builder can't clone it (I made an issue https://github.com/ikatyang/tree-sitter-yaml/issues/42).
Also, if that will get resolved (or we just descide to ignore tree-sitter-yaml), are we suppose to ship the grammars? All the compiled grammars weight 120 MB, not everyone might need them.
Although I guess when --grammar fetch
you are downloading all the sources for the grammars, which wastes a lot more space then 120 MB. And the official way of packaging helix, the nix flake, as far as I understand, ships grammars with this grammars.nix script. So shipping them is probably the right way of packaging helix.
@blt-r Thanks for the quick reply. I think shipping the grammars without tree-sitter-yaml is the way to go, if they ever sort out your issue you can add it back again. 120 MB is nothing for a flatpak, and all the others distros ship them as far as I can tell.
I made a PR (https://github.com/ikatyang/tree-sitter-yaml/pull/48) to tree-sitter-yaml which updates the submodule. If they don't merge it I guess I will just hardcode it to use my fork.
But then I also stumbled on this issue https://github.com/helix-editor/helix/issues/7260
I had a quick go at refactoring your first_run.txt
into a markdown README with the help of ChatGPT for the main flathub repo. It has removed a bit of info ( the "see what's available" section) that you would probably want to put back, but it is much easier to understand:
If you are running the Flatpak version of Helix, you may encounter some limitations due to the fact that it runs inside a container and cannot access tools on your host system. However, there are some workarounds that you can use to execute commands on the host system and get support for additional languages.
If you encounter any issues related to the Flatpak version of Helix, you can open them at https://github.com/flathub/@FLATPAK_ID@/issues.
To execute commands on the host system, you can use the following command:
$ flatpak-spawn --host <COMMAND>
This will allow you to execute commands on the host system from within the Flatpak container.
If you want to use a language server installed on your host system, you will need to add an entry to your languages.toml
file. For example:
[[language]]
name = "rust"
language-server = { command = "flatpak-spawn", args = ["--host", "rust-analyzer"] }
This will allow you to use the Rust language server installed on your host system from within the Flatpak container.
By default, the Flatpak version of Helix provides access to standard development environments such as GCC and Python. However, if you need support for additional languages (including language servers), you will need to install SDK extensions.
To install SDK extensions, use the following commands:
$ flatpak install flathub org.freedesktop.Sdk.Extension.rust-stable
$ flatpak install flathub org.freedesktop.Sdk.Extension.llvm15
This will install the Rust and LLVM SDK extensions.
After installing SDK extensions, you will need to enable them. To do this, set the FLATPAK_ENABLE_SDK_EXT
environment variable to a comma-separated list of extension names. For example:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@
This will add compilers, language servers, and other tools to your $PATH.
To check which language servers have been detected, run Helix with the --health option:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@ --health
You can also get information about a specific language:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@ --health rust
To make changes to the environment variables persistent, use the flatpak override command:
$ flatpak override --user @FLATPAK_ID@ --env=FLATPAK_ENABLE_SDK_EXT="rust-stable,llvm15"
To find other SDK extensions, use the following command:
$ flatpak search <TEXT>
# Running Helix Flatpak Version
If you are running the Flatpak version of Helix, you may encounter some limitations due to the fact that it runs inside a container and cannot access tools on your host system. However, there are some workarounds that you can use to execute commands on the host system and get support for additional languages.
## Opening Issues
If you encounter any issues related to the Flatpak version of Helix, you can open them at https://github.com/flathub/@FLATPAK_ID@/issues.
## Executing Commands on the Host System
To execute commands on the host system, you can use the following command:
```sh
$ flatpak-spawn --host <COMMAND>
This will allow you to execute commands on the host system from within the Flatpak container.
If you want to use a language server installed on your host system, you will need to add an entry to your languages.toml
file. For example:
[[language]]
name = "rust"
language-server = { command = "flatpak-spawn", args = ["--host", "rust-analyzer"] }
This will allow you to use the Rust language server installed on your host system from within the Flatpak container.
By default, the Flatpak version of Helix provides access to standard development environments such as GCC and Python. However, if you need support for additional languages (including language servers), you will need to install SDK extensions.
To install SDK extensions, use the following commands:
$ flatpak install flathub org.freedesktop.Sdk.Extension.rust-stable
$ flatpak install flathub org.freedesktop.Sdk.Extension.llvm15
This will install the Rust and LLVM SDK extensions.
After installing SDK extensions, you will need to enable them. To do this, set the FLATPAK_ENABLE_SDK_EXT
environment variable to a comma-separated list of extension names. For example:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@
This will add compilers, language servers, and other tools to your $PATH.
To check which language servers have been detected, run Helix with the --health option:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@ --health
You can also get information about a specific language:
$ FLATPAK_ENABLE_SDK_EXT=rust-stable,llvm15 flatpak run @FLATPAK_ID@ --health rust
To make changes to the environment variables persistent, use the flatpak override command:
$ flatpak override --user @FLATPAK_ID@ --env=FLATPAK_ENABLE_SDK_EXT="rust-stable,llvm15"
To find other SDK extensions, use the following command:
$ flatpak search <TEXT>
Thanks, this will be useful. We could just use a markdown file as a first run file. Considering that there will be syntax highlighting in it, I think it would be more readable than just plain text.
Seems grammar .so files are missing:
Can't find the grammars folder:
/var/lib/flatpak/app/com.helix_editor.Helix/current/active/files/share/helix/runtime
This is on Debian 11 Stable.