highlight record keys
This commit is contained in:
parent
7cbece9212
commit
81854702a7
|
@ -3,7 +3,7 @@ import * as vscode from "vscode";
|
||||||
import { parse } from "@quri/squiggle-lang";
|
import { parse } from "@quri/squiggle-lang";
|
||||||
import { AnyPeggyNode } from "@quri/squiggle-lang/dist/src/rescript/Reducer/Reducer_Peggy/helpers";
|
import { AnyPeggyNode } from "@quri/squiggle-lang/dist/src/rescript/Reducer/Reducer_Peggy/helpers";
|
||||||
|
|
||||||
const tokenTypes = ["class", "interface", "enum", "function", "variable"];
|
const tokenTypes = ["enum", "function", "variable", "property"];
|
||||||
const tokenModifiers = ["declaration", "documentation"];
|
const tokenModifiers = ["declaration", "documentation"];
|
||||||
const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers);
|
const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers);
|
||||||
|
|
||||||
|
@ -51,11 +51,17 @@ const populateTokensBuilder = (
|
||||||
populateTokensBuilder(tokensBuilder, node.falseExpression);
|
populateTokensBuilder(tokensBuilder, node.falseExpression);
|
||||||
break;
|
break;
|
||||||
case "KeyValue":
|
case "KeyValue":
|
||||||
|
if (node.key.type === "String" && node.key.location) {
|
||||||
|
tokensBuilder.push(convertRange(node.key.location), "property", [
|
||||||
|
"declaration",
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
populateTokensBuilder(tokensBuilder, node.key);
|
populateTokensBuilder(tokensBuilder, node.key);
|
||||||
|
}
|
||||||
populateTokensBuilder(tokensBuilder, node.value);
|
populateTokensBuilder(tokensBuilder, node.value);
|
||||||
break;
|
break;
|
||||||
case "Identifier":
|
case "Identifier":
|
||||||
tokensBuilder.push(convertRange(node.location), "variable", []);
|
tokensBuilder.push(convertRange(node.location), "variable");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user