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

Provide token modifiers for attributes #835

Open
radeksimko opened this issue Mar 17, 2022 · 0 comments
Open

Provide token modifiers for attributes #835

radeksimko opened this issue Mar 17, 2022 · 0 comments
Labels
enhancement New feature or request textDocument/semanticTokens Semantic syntax highlighting workspace/semanticTokens

Comments

@radeksimko
Copy link
Member

This is in follow-up to #833

Background

In the above PR we introduce custom semantic token types and modifiers, to enable themes to address configuration parts more accurately and using more familiar names.

Idea no 1: Core vs Provider Attributes

One idea which came up during the implementation - but wasn't implemented - was whether we assign any particular modifiers to attributes. One potential use case would be distinguishing terraform-core from terraform-provider-dependent attributes.

That is e.g. to allow highlighting the following attributes differently

resource "aws_instance" "example" {
  count = 3 # core
  instance_type = "t3.micro" # provider-dependent
}

Idea no 2: Attributes inherit block modifier

We already let nested blocks inherit the parent block modifiers, for example

terraform { # modifier = terraform-terraform
  required_providers { # modifier = terraform-terraform + terraform-requiredProviders
    aws = {
      source = "hashicorp/aws"
    }
  }
}

we could take it further and do the same for attributes

terraform { # modifier = terraform-terraform
  required_providers { # modifier = terraform-terraform + terraform-requiredProviders
    aws = { # modifier = terraform-terraform + terraform-requiredProviders
      source = "hashicorp/aws"
    }
  }
}

The question is where does it become "too granular"? So far we generally avoided assigning provider-specific modifiers, such as provider-aws.

Proposal

TODO - depends on which idea (if any) we go for ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request textDocument/semanticTokens Semantic syntax highlighting workspace/semanticTokens
Projects
None yet
Development

No branches or pull requests

1 participant