fix classes keyword
This commit is contained in:
parent
670500d692
commit
32e7f4ab19
2 changed files with 24 additions and 0 deletions
|
|
@ -145,6 +145,9 @@ func getKeywordContext(text string, m *d2ast.Map, line, column int) string {
|
||||||
if _, isBoard := d2ast.BoardKeywords[firstPart]; isBoard {
|
if _, isBoard := d2ast.BoardKeywords[firstPart]; isBoard {
|
||||||
firstPart = ""
|
firstPart = ""
|
||||||
}
|
}
|
||||||
|
if firstPart == "classes" {
|
||||||
|
firstPart = ""
|
||||||
|
}
|
||||||
|
|
||||||
_, isHolder := d2ast.ReservedKeywordHolders[firstPart]
|
_, isHolder := d2ast.ReservedKeywordHolders[firstPart]
|
||||||
if !isHolder {
|
if !isHolder {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,18 @@ func TestGetCompletionItems(t *testing.T) {
|
||||||
column: 8,
|
column: 8,
|
||||||
want: getStyleCompletions(),
|
want: getStyleCompletions(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "classes shapes",
|
||||||
|
text: `classes: {
|
||||||
|
goal: {
|
||||||
|
shape:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
line: 2,
|
||||||
|
column: 10,
|
||||||
|
want: getShapeCompletions(),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "nested style map suggestions",
|
name: "nested style map suggestions",
|
||||||
text: `a: {
|
text: `a: {
|
||||||
|
|
@ -291,6 +303,15 @@ layers: {
|
||||||
column: 16,
|
column: 16,
|
||||||
want: getShapeCompletions(),
|
want: getShapeCompletions(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "shape 2 suggestions",
|
||||||
|
text: `a: {
|
||||||
|
shape:
|
||||||
|
}`,
|
||||||
|
line: 1,
|
||||||
|
column: 8,
|
||||||
|
want: getShapeCompletions(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue