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

VHDL highlights.scm improvement #10845

Merged
merged 3 commits into from
Jun 29, 2024

Conversation

Chris44442
Copy link
Contributor

@Chris44442 Chris44442 commented May 28, 2024

Hi, the highlighting for the VHDL language is very basic and is missing a lot of features. My changes fixes that. I'd like to think these are sane defaults and also minimalist.

@teburd

@teburd
Copy link
Contributor

teburd commented May 29, 2024

Ultimately good vhdl highlighting needs more context than what I think a tree sitter grammar can provide. Frankly its a language that could do well with an lsp highlighter imo after looking at this as it requires a deeper understanding of the context than simply grammatical rules around whats valid/invalid. I found no one in the helix matrix chat could help me improve the queries/highlights :( If you manage to do better, by all means do so!

Many things in vhdl are modules but are effectively so common as to be builtins. Treating them as builtins though is wrong.

I compared your changes to helix master, to emacs vhdl major mode. Emacs major mode is still significantly better at highlighting but I think this PR does make things look a bit nicer.

Missing from helix that I can see in comparison to emacs vhdl major mode...

  • bit value highlights ('0', '1', 'Z', etc)
  • builtin function highlights
  • function highlights
  • differentiable process and entity name highlights

Emacs vhdl major mode left side, helix with your changes right side show neorv32_fifo.vhd (stnolting's sweet open source riscv core)

Screenshot from 2024-05-29 08-15-06

@Chris44442
Copy link
Contributor Author

Chris44442 commented May 29, 2024

My guess is that we will not have an LSP based VHDL highlighting in the near future. For now we will have to use tree-sitter-vhdl.

There are of course a few problems. The main one being that the maintainer has disappeared years ago. Second the "function_call" problem, which partly the VHDL language is to blame, and what you said. The words I filed under function.builtin are a workaround, because I can't fix the root problem in the parser. Thirdly there is the error highlighting, which should not be done by a tree-sitter parser as most agree. And lastly there are some problems in the code and also with the "offical" highlighting.scm file. This is why nvim-treesitter has rejected tree-sitter-vhdl so far (a parser rewrite is being discussed right now). Either way: Helix uses it.

In your screenshot you are using the default theme with no customization. Tbh I am not sure why so many constructs highlighting are missing from the themes by default. Anyway you need to set operator, keyword.operator, number, character, string and maybe one or two more in the theme settings. Like so:

character = { fg = "light-green" }
number = { fg = "red" }
operator = { fg = "green" }

I tried to mimic the Verilog highlights.scm from the official tree-sitter repo. Due to the issues that I mentioned above there was only so much I could do. Not all of the functions are highlighted, with no way of fixing it in the .scm file sadly. This is obviously subjective but imho the highlighting looks a lot better with the PR than without it. With my theme settings this is the comparison between the current highlights.scm (top) and my PR (bottom). Imho there is not too much difference from my PR to the Emacs screenshot.

Screenshot_20240529_202026

Screenshot_20240529_201924

@teburd
Copy link
Contributor

teburd commented May 29, 2024

Looks nice, now why is the default theme so meh then, send another PR :)

@Chris44442
Copy link
Contributor Author

Chris44442 commented May 29, 2024

Looks nice, now why is the default theme so meh then, send another PR :)

Mh yeah I am a bit hesitant because it literally concerns all themes. At first I thought it was a deliberate choice.

@the-mikedavis the-mikedavis added the A-language-support Area: Support for programming/text languages label Jun 3, 2024
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/vhdl/highlights.scm Outdated Show resolved Hide resolved
@Chris44442 Chris44442 force-pushed the vhdl_queries_improvements branch from 6319b29 to d1e3f0e Compare June 7, 2024 20:42
@Chris44442 Chris44442 requested a review from archseer June 7, 2024 21:11
@Chris44442 Chris44442 requested a review from the-mikedavis June 12, 2024 21:15
@Chris44442
Copy link
Contributor Author

@archseer

I have addressed all the requested changes. Can we merge?

@archseer archseer merged commit c6dbb9c into helix-editor:master Jun 29, 2024
6 checks passed
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
mxxntype pushed a commit to mxxntype/helix that referenced this pull request Aug 14, 2024
kyruzic pushed a commit to kyruzic/helix that referenced this pull request Sep 27, 2024
salman-farooq-sh pushed a commit to salman-farooq-sh/helix that referenced this pull request Dec 21, 2024
* Add new color theme 'iroaseta'

* Update runtime/themes/iroaseta.toml

Co-authored-by: postsolar <[email protected]>

* Update iroaseta.toml

Add virtual jump label theme setting

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update iroaseta.toml

update storage. keyword.storage. according to suggestion, and update color.

* Update iroaseta.toml

remove unused palette

* Update iroaseta.toml

add missing setting for bufferline

* Update iroaseta.toml

update diagnostic fg color

* Update iroaseta.toml

I made the config more comprehensive and took all available themes settings from the manual. Some are commented out though.

* Update iroaseta.toml

add missing colors

* Update iroaseta.toml

Made some final adjustments to the color theme to improve visibility and reduce eye strain.

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update runtime/themes/iroaseta.toml

Co-authored-by: Michael Davis <[email protected]>

* Update iroaseta.toml

remove redundant settings

* Update iroaseta.toml

update color name

---------

Co-authored-by: postsolar <[email protected]>
Co-authored-by: Michael Davis <[email protected]>

Large Gruvbox refactoring (helix-editor#10773)

* gruvbox refactoring

* removed unnecessary lines

* set purple1 for operators

* changed diagnostics colors

* removed some unnecessary lines

* set diff.delta color to yellow

* removed some tag colors

Delay auto-save until exiting insert mode (helix-editor#11047)

Saving while in insert mode causes issues with the modification
indicator and this is very easy to reproduce with the current state of
the auto-save hook. We can tweak the hook slightly to await the mode
switch out of insert mode to perform the save.

The debounce is preserved: if you save and then immediately exit insert
mode the debounce will be respected. If the debounce lapses while you
are in insert mode, the save occurs as you switch out of insert mode
immediately.

VHDL highlights.scm improvement (helix-editor#10845)

Fix homebrew formula link (helix-editor#11058)

Co-authored-by: Mark Murphy <[email protected]>

build(deps): bump the rust-dependencies group with 3 updates (helix-editor#11072)

Bumps the rust-dependencies group with 3 updates: [log](https://github.com/rust-lang/log), [serde_json](https://github.com/serde-rs/json) and [cc](https://github.com/rust-lang/cc-rs).

Updates `log` from 0.4.21 to 0.4.22
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](rust-lang/log@0.4.21...0.4.22)

Updates `serde_json` from 1.0.117 to 1.0.120
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.117...v1.0.120)

Updates `cc` from 1.0.100 to 1.0.104
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](rust-lang/cc-rs@cc-v1.0.100...cc-v1.0.104)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: update cairo tree sitter + queries (helix-editor#11067)

Bump time from broken version (0.3.23) (helix-editor#11065)

Tell language servers that Helix can request formatting (helix-editor#11064)

Without providing the formatting capability, the language server might not advertise its ability to format in return, causing the :format command to be broken.

Override far too dark cursorline (helix-editor#11071)

Add hsc filetype to haskell (helix-editor#11074)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants