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

Improve Go syntax highlighting #25327

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Improve Go syntax highlighting #25327

merged 3 commits into from
Feb 21, 2025

Conversation

chbk
Copy link
Contributor

@chbk chbk commented Feb 21, 2025

Release Notes:

  • Improved Go syntax highlighting.
Zed 0.174.6 With this PR
Image Image
  • package_identifier: namespace, language-agnostic scope for modules, packages, namespaces
  • method_elem: function.method
  • ; ,. ,, ,:: punctuation.delimiter
package my_package
import (
  pkg "fmt"
)
type A interface {
  method_elem(foo int, bar float64) int
}
func main() {
  identifier := true
  const constant int = 3
  for i := 0; i <= 3; i++ {
    pkg.Println(identifier)
  }
}

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 21, 2025
@chbk chbk marked this pull request as ready for review February 21, 2025 13:32
iamnbutler pushed a commit that referenced this pull request Feb 21, 2025
Release Notes:

  - Added syntax scopes to themes

Supports:

- [Improve CSS syntax
highlighting](#25326)
- [Improve Go syntax
highlighting](#25327)
- [Improve Markdown syntax
highlighting](#25330)

Changes:

- Adds highlighting rules for the following new scopes, using theme
colors:
    - `heading`
    - `namespace`
    - `selector`
    - `strikethrough`
    - `unit`

- Renames scopes that are no longer used in `zed/crates/languages/src`
or `zed/extensions` to their new names:
    - `punctuation.list_marker` -> `punctuation.markup`
    - `link_text` -> `link`
- `link_uri` -> `link.url`, as defined in the [gitcommit
grammar](https://github.com/zed-industries/zed/blob/dff47a843695d03160680502e6d94634e376698e/crates/languages/src/gitcommit/highlights.scm#L5)
    - `text.literal` -> `raw`
@maxdeviant maxdeviant self-assigned this Feb 21, 2025
Copy link
Member

@maxdeviant maxdeviant 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!

I removed the @constant.variable change until I can understand the case for it better.

@maxdeviant maxdeviant merged commit 7deceb6 into zed-industries:main Feb 21, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants