-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LiteralValue completion, hover and semantic tokens
- Loading branch information
Showing
8 changed files
with
4,009 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
package decoder | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/hashicorp/hcl-lang/lang" | ||
"github.com/hashicorp/hcl-lang/schema" | ||
"github.com/hashicorp/hcl/v2" | ||
"github.com/zclconf/go-cty/cty" | ||
) | ||
|
||
type LiteralValue struct { | ||
expr hcl.Expression | ||
cons schema.LiteralValue | ||
expr hcl.Expression | ||
cons schema.LiteralValue | ||
pathCtx *PathContext | ||
} | ||
|
||
func (lv LiteralValue) HoverAtPos(ctx context.Context, pos hcl.Pos) *lang.HoverData { | ||
// TODO | ||
return nil | ||
} | ||
func formatNumberVal(val cty.Value) string { | ||
bf := val.AsBigFloat() | ||
|
||
if bf.IsInt() { | ||
intNum, _ := bf.Int64() | ||
return fmt.Sprintf("%d", intNum) | ||
} | ||
|
||
fNum, _ := bf.Float64() | ||
return strconv.FormatFloat(fNum, 'f', -1, 64) | ||
|
||
func (lv LiteralValue) SemanticTokens(ctx context.Context) []lang.SemanticToken { | ||
// TODO | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.