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

fix: avoid semantic token modifier inheritance for dependent bodies #109

Merged
merged 1 commit into from
Mar 22, 2022

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Mar 21, 2022

Fixes #108

UX

Nested dependent blocks no longer inherit the top level modifiers.

Before

Screenshot 2022-03-21 at 16 46 33

After

Screenshot 2022-03-21 at 16 44 22

The examples used a custom VS Code theme:

{
  "name": "Example Theme",
  "semanticHighlighting": true,
  "semanticTokenColors": {
    "hcl-blockType.terraform-resource": {"fontStyle": "bold", "foreground": "#fff"},
    "hcl-blockType.terraform-data": {"fontStyle": "bold", "foreground": "#fff"},
    "hcl-blockType.terraform-module": {"fontStyle": "bold", "foreground": "#3d5aff"},
    "hcl-blockLabel.terraform-module.terraform-name": {"foreground": "#bac4ff"},
    "hcl-blockLabel.terraform-type": {"foreground": "#844FBA", "fontStyle": "bold"},
    "hcl-blockLabel.terraform-resource.terraform-name": {"foreground": "#a589b3"}
  }
}

@radeksimko radeksimko requested a review from a team March 21, 2022 16:47
@radeksimko radeksimko added the bug Something isn't working label Mar 21, 2022
@radeksimko radeksimko self-assigned this Mar 21, 2022
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

LGTM for dependent blocks (os_disk)!

How to we want to highlight "normal" nested blocks inside a body? For example, lifecycle:

CleanShot 2022-03-22 at 12 25 24@2x

@radeksimko
Copy link
Member Author

How to we want to highlight "normal" nested blocks inside a body?

Frankly I don't know yet. My plan was to land it like this and then solicit feedback from theme authors. One direction would be the one described already in hashicorp/terraform-ls#835 - i.e. Core vs Provider blocks

#110 should give us some more flexibility downstream in terraform-schema and react to various needs.

@radeksimko radeksimko merged commit 71f927e into main Mar 22, 2022
@radeksimko radeksimko deleted the f-semtok-avoid-dep-inheritance branch March 22, 2022 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit block type semantic token modifier inheritance to BodySchema
2 participants