fix classes keyword

This commit is contained in:
Alexander Wang 2025-01-01 21:00:45 -07:00
parent 670500d692
commit 32e7f4ab19
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
2 changed files with 24 additions and 0 deletions

View file

@ -145,6 +145,9 @@ func getKeywordContext(text string, m *d2ast.Map, line, column int) string {
if _, isBoard := d2ast.BoardKeywords[firstPart]; isBoard {
firstPart = ""
}
if firstPart == "classes" {
firstPart = ""
}
_, isHolder := d2ast.ReservedKeywordHolders[firstPart]
if !isHolder {

View file

@ -30,6 +30,18 @@ func TestGetCompletionItems(t *testing.T) {
column: 8,
want: getStyleCompletions(),
},
{
name: "classes shapes",
text: `classes: {
goal: {
shape:
}
}
`,
line: 2,
column: 10,
want: getShapeCompletions(),
},
{
name: "nested style map suggestions",
text: `a: {
@ -291,6 +303,15 @@ layers: {
column: 16,
want: getShapeCompletions(),
},
{
name: "shape 2 suggestions",
text: `a: {
shape:
}`,
line: 1,
column: 8,
want: getShapeCompletions(),
},
}
for _, tt := range tests {