From a745dbb9a7c5b01ff8f60d1c193f2acea407aae6 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Tue, 19 Dec 2023 11:36:50 -0500 Subject: [PATCH 1/3] Rename TokenTypeCapsule to TokenTypeComplex This renames the existing token type TokenTypeCapsule to TokenTypeComplex to aid readability and reflect existing naming conventions. This token represents `list` in `type = list(string)` and similar, i.e. the name of the complex type. The term "capsule" has slightly different meaning in cty and HCL and we should not use it in this context. --- internal/lsp/token_encoder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/lsp/token_encoder.go b/internal/lsp/token_encoder.go index ac1d8c463..343d932e8 100644 --- a/internal/lsp/token_encoder.go +++ b/internal/lsp/token_encoder.go @@ -142,9 +142,9 @@ func (te *TokenEncoder) resolveTokenType(token lang.SemanticToken) (semtok.Token case lang.TokenTraversalStep: return te.firstSupportedTokenType( semtok.TokenType(lang.TokenTraversalStep), semtok.TokenTypeVariable) - case lang.TokenTypeCapsule: + case lang.TokenTypeComplex: return te.firstSupportedTokenType( - semtok.TokenType(lang.TokenTypeCapsule), semtok.TokenTypeFunction) + semtok.TokenType(lang.TokenTypeComplex), semtok.TokenTypeFunction) case lang.TokenTypePrimitive: return te.firstSupportedTokenType( semtok.TokenType(lang.TokenTypePrimitive), semtok.TokenTypeKeyword) From 700fa748051d8833894fd896bc88f1fbec7c4162 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Wed, 20 Dec 2023 10:32:06 -0500 Subject: [PATCH 2/3] Update to hcl-lang@latest --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4e10c17c5..8cd679267 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/hc-install v0.6.2 - github.com/hashicorp/hcl-lang v0.0.0-20231130100155-255545969c6e + github.com/hashicorp/hcl-lang v0.0.0-20231220152752-07605a991838 github.com/hashicorp/hcl/v2 v2.19.1 github.com/hashicorp/terraform-exec v0.19.0 github.com/hashicorp/terraform-json v0.18.0 diff --git a/go.sum b/go.sum index e8dcae489..47c92dbb5 100644 --- a/go.sum +++ b/go.sum @@ -220,6 +220,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl-lang v0.0.0-20231130100155-255545969c6e h1:Hiqu/XjMVBc8Etbjr10p6koz5BuF9YVhyQcNQ5w1WU4= github.com/hashicorp/hcl-lang v0.0.0-20231130100155-255545969c6e/go.mod h1:hwP+cyrOdujv2bNXUgm+OrVsvOfAltMmbQx+WFu9PWM= +github.com/hashicorp/hcl-lang v0.0.0-20231220152752-07605a991838 h1:/a/tFMThsyO++bJPd+9/kTV5xojfTrVPLh5mSlQd9wU= +github.com/hashicorp/hcl-lang v0.0.0-20231220152752-07605a991838/go.mod h1:yZkskHa0HSpPecxmoiLTuyXmxI9knxQOA+DGMgyOurM= github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= From 5829c14342fa4208d8940fbf2b61d7d739ff93df Mon Sep 17 00:00:00 2001 From: James Pogran Date: Wed, 20 Dec 2023 10:32:57 -0500 Subject: [PATCH 3/3] Update docs --- docs/syntax-highlighting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/syntax-highlighting.md b/docs/syntax-highlighting.md index d3be29ad5..c249ff472 100644 --- a/docs/syntax-highlighting.md +++ b/docs/syntax-highlighting.md @@ -54,7 +54,7 @@ Fallback types are chosen based on meaningful semantic mapping and default theme | `hcl-mapKey` | `parameter` | | `hcl-keyword` | `variable` | | `hcl-traversalStep` | `variable` | -| `hcl-typeCapsule` | `function` | +| `hcl-typeComplex` | `function` | | `hcl-typePrimitive` | `keyword` | | `hcl-functionName` | `function` |