mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 17:58:16 +00:00
Adding debugging to figure out missing scopes from theme.
This commit is contained in:
parent
89993517e9
commit
8c2cd28c48
2 changed files with 10 additions and 11 deletions
|
@ -66,15 +66,14 @@ export class Highlighter {
|
||||||
textDecoration?: string
|
textDecoration?: string
|
||||||
): [string, vscode.TextEditorDecorationType] => {
|
): [string, vscode.TextEditorDecorationType] => {
|
||||||
|
|
||||||
const foundRule = scopesMapper.toRule(tag, scopes.find) || scopes.find(tag)
|
const rule = scopesMapper.toRule(tag, scopes.find)
|
||||||
|
|
||||||
|
if (rule) {
|
||||||
|
const decor = createDecorationFromTextmate(rule);
|
||||||
if (foundRule) {
|
|
||||||
const decor = createDecorationFromTextmate(foundRule);
|
|
||||||
return [tag, decor];
|
return [tag, decor];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log('Missing theme for: ' + tag);
|
||||||
const color = new vscode.ThemeColor('ralsp.' + tag);
|
const color = new vscode.ThemeColor('ralsp.' + tag);
|
||||||
const decor = vscode.window.createTextEditorDecorationType({
|
const decor = vscode.window.createTextEditorDecorationType({
|
||||||
color,
|
color,
|
||||||
|
|
|
@ -8,11 +8,11 @@ let mappings = new Map<string, string[]>()
|
||||||
|
|
||||||
|
|
||||||
const defaultMapping = new Map<string, string[]>([
|
const defaultMapping = new Map<string, string[]>([
|
||||||
['comment', ['comment']],
|
['comment', ['comment', 'comment.block', 'comment.line', 'comment.block.documentation']],
|
||||||
['string', ['string']],
|
['string', ['string']],
|
||||||
['keyword', ['keyword']],
|
['keyword', ['keyword']],
|
||||||
['keyword.control', ['keyword.control', 'keyword', 'keyword.other']],
|
['keyword.control', ['keyword.control', 'keyword', 'keyword.other']],
|
||||||
['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']],
|
['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']],
|
||||||
['function', ['entity.name.function']],
|
['function', ['entity.name.function']],
|
||||||
['parameter', ['variable.parameter']],
|
['parameter', ['variable.parameter']],
|
||||||
['constant', ['constant', 'variable']],
|
['constant', ['constant', 'variable']],
|
||||||
|
@ -23,9 +23,9 @@ const defaultMapping = new Map<string, string[]>([
|
||||||
['literal', ['string', 'string.quoted', 'string.regexp']],
|
['literal', ['string', 'string.quoted', 'string.regexp']],
|
||||||
['macro', ['support.other']],
|
['macro', ['support.other']],
|
||||||
['variable', ['variable']],
|
['variable', ['variable']],
|
||||||
['variable.mut', ['variable']],
|
['variable.mut', ['variable', 'storage.modifier']],
|
||||||
['field', ['variable.object.property']],
|
['field', ['variable.object.property', 'meta.field.declaration', 'meta.definition.property', 'variable.other',]],
|
||||||
['module', ['entity.name.section']]
|
['module', ['entity.name.section', 'entity.other']]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
function find(scope: string): string[] {
|
function find(scope: string): string[] {
|
||||||
|
@ -33,7 +33,7 @@ function find(scope: string): string[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined {
|
export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined {
|
||||||
return find(scope).map(intoRule).find(rule => rule !== null)
|
return find(scope).map(intoRule).filter(rule => rule !== undefined)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue