Skip to content

Commit

Permalink
fix(semanticTokens): make indexing of highlight groups more consistent (
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamnotagenius committed Feb 3, 2023
1 parent b7375d5 commit 8c0d3ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/handler/semanticTokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Disposable } from '../../util/protocol'
import { toErrorText, toText, upperFirst } from '../../util/string'
import window from '../../window'
import workspace from '../../workspace'
import SemanticTokensBuffer, { HLGROUP_PREFIX, NAMESPACE, StaticConfig } from './buffer'
import SemanticTokensBuffer, { HLGROUP_PREFIX, NAMESPACE, StaticConfig, toHighlightPart } from './buffer'
const headGroup = 'Statement'

function getFiletypes(): string[] {
Expand Down Expand Up @@ -215,7 +215,7 @@ export default class SemanticTokens {
let legend = languages.getLegend(doc.textDocument) ?? languages.getLegend(doc.textDocument, true)
if (legend.tokenTypes.length) {
for (const t of [...new Set(legend.tokenTypes)]) {
let text = HLGROUP_PREFIX + upperFirst(t)
let text = HLGROUP_PREFIX + toHighlightPart(t)
hl.addTexts([{ text: '-', hlGroup: 'Comment' }, { text: ' ' }, { text, hlGroup: text }])
}
hl.addLine('')
Expand All @@ -227,7 +227,7 @@ export default class SemanticTokens {
hl.addLine('')
if (legend.tokenModifiers.length) {
for (const t of [...new Set(legend.tokenModifiers)]) {
let text = HLGROUP_PREFIX + upperFirst(t)
let text = HLGROUP_PREFIX + toHighlightPart(t)
hl.addTexts([{ text: '-', hlGroup: 'Comment' }, { text: ' ' }, { text, hlGroup: text }])
}
hl.addLine('')
Expand Down

0 comments on commit 8c0d3ef

Please sign in to comment.