Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(semanticTokens): make indexing of highlight groups more consistent #4500

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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