in package/src/syntaxHighlighting/SemanticTokensProvider.ts [18:46]
async provideDocumentSemanticTokens(model: editor.ITextModel) {
const resource = model.uri;
const classifications = await this.classificationsGetter(resource);
const tokens: DocumentSemanticToken[] = [];
let prevLine = 0;
let prevChar = 0;
for (const classification of classifications) {
const parts = toSemanticTokens(classification, model);
for (const part of parts) {
const [absLine, absChar, length, kind, modifiers] = part;
const deltaLine = absLine - prevLine;
const deltaChar = deltaLine === 0 ? absChar - prevChar : absChar;
tokens.push([deltaLine, deltaChar, length, kind, modifiers]);
prevLine = absLine;
prevChar = absChar;
}
}
return {
data: new Uint32Array(tokens.flat(2)),
resultId: model.getVersionId().toString(),
};
}