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

Grammars fetched and built but not in use #3407

Closed
JaimeArboleda opened this issue Aug 13, 2022 · 7 comments
Closed

Grammars fetched and built but not in use #3407

JaimeArboleda opened this issue Aug 13, 2022 · 7 comments
Labels
C-bug Category: This is a bug

Comments

@JaimeArboleda
Copy link

Summary

I have installed helix on Ubuntu. The version is 22.05.

I already run hx --grammar fetch and hx --grammar build. If I run it again, the output says that I have everything:

...
Grammar 'edoc' is already built.
Grammar 'ungrammar' is already built.
Grammar 'dot' is already built.
Grammar 'cue' is already built.
Grammar 'elvish' is already built.
Grammar 'fortran' is already built.
...

And in my runtime configuration folder I see the grammars objects there. However, I don't have it available. For example if I run hx --health python I see the following output:

Configured language server: pylsp
Binary for language server: /home/jaime/.local/bin/pylsp
Configured debug adapter: None
Highlight queries: ✘
Textobject queries: ✘
Indent queries: ✘

So I dont see syntax highlighting.

Reproduction Steps

I tried this:

  1. hx

I expected this to happen:

Instead, this happened:

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Ubuntu

Terminal Emulator

I dont know

Helix Version

22.05

@JaimeArboleda JaimeArboleda added the C-bug Category: This is a bug label Aug 13, 2022
@the-mikedavis
Copy link
Member

Did you link the runtime directory?

@JaimeArboleda
Copy link
Author

Yes, I did that. This is what I see when running --help:

$ hx --health
Config file: /home/jaime/.config/helix/config.toml
Language file: default
Log file: /home/jaime/.cache/helix/helix.log
Runtime directory: /home/jaime/.config/helix/runtime
Clipboard provider: xclip

Language     LSP          DAP          Highlight    Textobject   Indent       
bash         ✘ bash-la…   None         ✘            ✘            ✘            
beancount    None         None         ✘            ✘            ✘            
...

Btw, probably unrelated, but if I run hx --tutor or :tutor inside helix, I open an empty file. I don't know if I am missing some components after the installation... I installed it compiling the source files, because in ubuntu there is no other option.

Thanks for quick response, and specially thanks for wonderful work. Even with this huge drawback of not having syntax highlighting, I am so in love with this editor!!! You can call it love at first sight :)

@the-mikedavis
Copy link
Member

Btw, probably unrelated, but if I run hx --tutor or :tutor inside helix, I open an empty file

This is most likely the same problem: the tutor file comes from the runtime directory as well as syntax highlighting queries. But that doesn't seem to be set up based on all of the ✘s in the --health output. In particular you should have a ~/.config/helix/runtime/tutor.txt file for the tutor and for python for example, you should have at least a ~/.config/helix/runtime/queries/highlights.scm file for syntax highlights.

An alternative to linking/copying the runtime is that you can point a HELIX_RUNTIME environment variable to the runtime directory in the cloned helix repository.

# say you cloned to `~/src/helix`
git clone [email protected]:helix-editor/helix.git /home/me/src/helix
export HELIX_RUNTIME=/home/me/src/helix

Then helix will look for the tutor in $HELIX_RUNTIME/tutor.txt and highlights in $HELIX_RUNTIME/queries/python/highlights.scm

@JaimeArboleda
Copy link
Author

Hello! Thanks a lot!!!

I was a little bit confused with the folder structure. I did export HELIX_RUNTIME=/home/helix/runtime and it works, at least I see tutor and I have syntax highlighting. I think the problem is that I did not create the symlink correctly. Now I fixed that as well.

However, I don't have correct indentation of new lines in Python.

This is what the hx --health python now outputs:

Configured language server: pylsp
Binary for language server: /home/jaime/.local/bin/pylsp
Configured debug adapter: None
Highlight queries: ✔
Textobject queries: ✔
Indent queries: ✘

What do I need to add it? I see this part of the documentation, but I am not sure who to proceed.

@JaimeArboleda
Copy link
Author

JaimeArboleda commented Aug 13, 2022

I see that in the queries folder, there is a python folder and it contains, among others, those files:

highlights.scm
indents.scm_
injections.scm
...

So the indents filename contains an extra underscore. Maybe on purpose, cause it's not working properly? I removed the underscore and now I see that I have a green light in the python indent queries, but however it does not work as expected (new lines are not indented as they should).

@the-mikedavis
Copy link
Member

Python indents.scm were disabled a while ago because the default indentation mechanism currently works better than the indents in that file. There's an issue for python indents here: #763 and a recent PR working on improving the highlights: #3382

@JaimeArboleda
Copy link
Author

Thanks a lot!! Yes, I will stay tuned to see if the PR finally solves the issue. It's very annoying to program in Python without auto indention...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants