Skip to content

Commit

Permalink
lsp: Recognise new token type for function name
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Apr 4, 2023
1 parent 141e87d commit 66dd272
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/syntax-highlighting.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Fallback types are chosen based on meaningful semantic mapping and default theme
| `hcl-traversalStep` | `variable` |
| `hcl-typeCapsule` | `function` |
| `hcl-typePrimitive` | `keyword` |
| `hcl-functionName` | `function` |

#### Token Modifiers

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.1
github.com/hashicorp/hcl-lang v0.0.0-20230315123252-3faa6c8fba28
github.com/hashicorp/hcl-lang v0.0.0-20230404085747-c09841f5b5b2
github.com/hashicorp/hcl/v2 v2.16.2
github.com/hashicorp/terraform-exec v0.18.1
github.com/hashicorp/terraform-json v0.16.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ github.com/hashicorp/hc-install v0.5.1 h1:eCqToNCob7m2R8kM8Gr7XcVmcRSz9ppCFSVZbM
github.com/hashicorp/hc-install v0.5.1/go.mod h1:iDPCnzKo+SzToOh25R8OWpLdhhy7yBfJX3PmVWiYhrM=
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-20230315123252-3faa6c8fba28 h1:7RUI5eMB9ULXn6+V9mNyGyM5o33FBzv8pad/W+aEx04=
github.com/hashicorp/hcl-lang v0.0.0-20230315123252-3faa6c8fba28/go.mod h1:m+ZB0CmTRHSo14j2INkDA+QZdzGBJRYTrOzf+4Xuj1k=
github.com/hashicorp/hcl-lang v0.0.0-20230404085747-c09841f5b5b2 h1:xQdxAK5Q/zuSMT8Wz6L+qERZk42uYjxk+h9AqVdTZUU=
github.com/hashicorp/hcl-lang v0.0.0-20230404085747-c09841f5b5b2/go.mod h1:SalMwbKCDSR7kF34FdPAikCsQjPVgYvwyiROrMWbyEw=
github.com/hashicorp/hcl/v2 v2.16.2 h1:mpkHZh/Tv+xet3sy3F9Ld4FyI2tUpWe9x3XtPx9f1a0=
github.com/hashicorp/hcl/v2 v2.16.2/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX5H8XZxHlH4=
Expand Down
3 changes: 3 additions & 0 deletions internal/lsp/token_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func (te *TokenEncoder) resolveTokenType(token lang.SemanticToken) (semtok.Token
case lang.TokenTypePrimitive:
return te.firstSupportedTokenType(
semtok.TokenType(lang.TokenTypePrimitive), semtok.TokenTypeKeyword)
case lang.TokenFunctionName:
return te.firstSupportedTokenType(
semtok.TokenType(lang.TokenFunctionName), semtok.TokenTypeFunction)
}

return "", false
Expand Down

0 comments on commit 66dd272

Please sign in to comment.