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

Highlight discards as comments #79

Merged
merged 1 commit into from
May 20, 2024
Merged

Highlight discards as comments #79

merged 1 commit into from
May 20, 2024

Conversation

smercer10
Copy link
Contributor

@smercer10 smercer10 commented May 16, 2024

Resolves #24

As #30 seems to be stale, I thought it would be worth raising a small PR focused solely on closing #24, as it's a feature I'd quite like as I learn Gleam.

The PR adds a #discards pattern to the syntax that matches any word starting with an underscore, or isolated underscore(s). From brief investigation, comment.unused.gleam seems to be the most idiomatic/consistent scope for this pattern. As mentioned in gleam-lang/gleam.vim#6, Elixir highlights discards as comments, and vscode-elixir-ls uses a similar comment.unused.elixir scope. This tends to work pretty well with any theme that doesn't use outlandish comment colouring.

Below is an example of the changes with as many edge cases as I could think of (with limited knowledge of the language) - the non-decimal number highlighting will be fixed with my other PR (#78). I noticed that gleam-lang/gleam.vim#7 was having some trouble with generic arguments, so I've included an example of that working. Perhaps someone could try translating my regex for use with the Vim plugin if the functionality is still desired.

image

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@lpil lpil merged commit 14170ef into gleam-lang:main May 20, 2024
@smercer10 smercer10 deleted the dim-discards branch May 20, 2024 14:31
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

Successfully merging this pull request may close these issues.

discarded args not greyed out
2 participants