Fix 68a5ff050f (r361019340)
This commit is contained in:
parent
b21d9337d9
commit
25537d294c
5
editors/code/package-lock.json
generated
5
editors/code/package-lock.json
generated
@ -750,6 +750,11 @@
|
|||||||
"esprima": "^4.0.0"
|
"esprima": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jsonc-parser": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA=="
|
||||||
|
},
|
||||||
"lines-and-columns": {
|
"lines-and-columns": {
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||||
|
@ -26,7 +26,7 @@ function fancify(seed: string, shade: 'light' | 'dark') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createDecorationFromTextmate(
|
function createDecorationFromTextmate(
|
||||||
themeStyle: scopes.TextMateRuleSettings
|
themeStyle: scopes.TextMateRuleSettings,
|
||||||
): vscode.TextEditorDecorationType {
|
): vscode.TextEditorDecorationType {
|
||||||
const decorationOptions: vscode.DecorationRenderOptions = {};
|
const decorationOptions: vscode.DecorationRenderOptions = {};
|
||||||
decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen;
|
decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen;
|
||||||
@ -84,7 +84,7 @@ export class Highlighter {
|
|||||||
const color = new vscode.ThemeColor(fallBackTag);
|
const color = new vscode.ThemeColor(fallBackTag);
|
||||||
const decor = vscode.window.createTextEditorDecorationType({
|
const decor = vscode.window.createTextEditorDecorationType({
|
||||||
color,
|
color,
|
||||||
textDecoration
|
textDecoration,
|
||||||
});
|
});
|
||||||
return [tag, decor];
|
return [tag, decor];
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,10 @@ function loadThemeNamed(themeName: string) {
|
|||||||
return extension.packageJSON.contributes.themes
|
return extension.packageJSON.contributes.themes
|
||||||
.filter(
|
.filter(
|
||||||
(element: any) =>
|
(element: any) =>
|
||||||
(element.id || element.label) === themeName
|
(element.id || element.label) === themeName,
|
||||||
)
|
)
|
||||||
.map((element: any) =>
|
.map((element: any) =>
|
||||||
path.join(extension.extensionPath, element.path)
|
path.join(extension.extensionPath, element.path),
|
||||||
)
|
)
|
||||||
.concat(list);
|
.concat(list);
|
||||||
}, Array<string>());
|
}, Array<string>());
|
||||||
@ -71,7 +71,7 @@ function loadThemeNamed(themeName: string) {
|
|||||||
const tokenColorCustomizations: [any] = [
|
const tokenColorCustomizations: [any] = [
|
||||||
vscode.workspace
|
vscode.workspace
|
||||||
.getConfiguration('editor')
|
.getConfiguration('editor')
|
||||||
.get('tokenColorCustomizations')
|
.get('tokenColorCustomizations'),
|
||||||
];
|
];
|
||||||
|
|
||||||
tokenColorCustomizations
|
tokenColorCustomizations
|
||||||
@ -100,7 +100,7 @@ function loadThemeFile(themePath: string) {
|
|||||||
|
|
||||||
function mergeRuleSettings(
|
function mergeRuleSettings(
|
||||||
defaultSetting: TextMateRuleSettings | undefined,
|
defaultSetting: TextMateRuleSettings | undefined,
|
||||||
override: TextMateRuleSettings
|
override: TextMateRuleSettings,
|
||||||
): TextMateRuleSettings {
|
): TextMateRuleSettings {
|
||||||
if (defaultSetting === undefined) {
|
if (defaultSetting === undefined) {
|
||||||
return override;
|
return override;
|
||||||
@ -116,7 +116,7 @@ function mergeRuleSettings(
|
|||||||
|
|
||||||
function updateRules(
|
function updateRules(
|
||||||
scope: string,
|
scope: string,
|
||||||
updatedSettings: TextMateRuleSettings
|
updatedSettings: TextMateRuleSettings,
|
||||||
): void {
|
): void {
|
||||||
[rules.get(scope)]
|
[rules.get(scope)]
|
||||||
.map(settings => mergeRuleSettings(settings, updatedSettings))
|
.map(settings => mergeRuleSettings(settings, updatedSettings))
|
||||||
|
@ -10,15 +10,15 @@ const defaultMapping = new Map<string, string[]>([
|
|||||||
'comment',
|
'comment',
|
||||||
'comment.block',
|
'comment.block',
|
||||||
'comment.line',
|
'comment.line',
|
||||||
'comment.block.documentation'
|
'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',
|
'keyword.unsafe',
|
||||||
['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']
|
['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'],
|
||||||
],
|
],
|
||||||
['function', ['entity.name.function']],
|
['function', ['entity.name.function']],
|
||||||
['parameter', ['variable.parameter']],
|
['parameter', ['variable.parameter']],
|
||||||
@ -28,7 +28,7 @@ const defaultMapping = new Map<string, string[]>([
|
|||||||
['text', ['string', 'string.quoted', 'string.regexp']],
|
['text', ['string', 'string.quoted', 'string.regexp']],
|
||||||
['attribute', ['keyword']],
|
['attribute', ['keyword']],
|
||||||
['literal', ['string', 'string.quoted', 'string.regexp']],
|
['literal', ['string', 'string.quoted', 'string.regexp']],
|
||||||
['macro', ['support.other']],
|
['macro', ['entity.name.function', 'keyword.other', 'entity.name.macro']],
|
||||||
['variable', ['variable']],
|
['variable', ['variable']],
|
||||||
['variable.mut', ['variable', 'storage.modifier']],
|
['variable.mut', ['variable', 'storage.modifier']],
|
||||||
[
|
[
|
||||||
@ -37,20 +37,19 @@ const defaultMapping = new Map<string, string[]>([
|
|||||||
'variable.object.property',
|
'variable.object.property',
|
||||||
'meta.field.declaration',
|
'meta.field.declaration',
|
||||||
'meta.definition.property',
|
'meta.definition.property',
|
||||||
'variable.other'
|
'variable.other',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
['module', ['entity.name.section', 'entity.other']]
|
['module', ['entity.name.section', 'entity.other']],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Temporary exported for debugging for now.
|
|
||||||
export function find(scope: string): string[] {
|
export function find(scope: string): string[] {
|
||||||
return mappings.get(scope) || [];
|
return mappings.get(scope) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toRule(
|
export function toRule(
|
||||||
scope: string,
|
scope: string,
|
||||||
intoRule: (scope: string) => TextMateRuleSettings | undefined
|
intoRule: (scope: string) => TextMateRuleSettings | undefined,
|
||||||
): TextMateRuleSettings | undefined {
|
): TextMateRuleSettings | undefined {
|
||||||
return find(scope)
|
return find(scope)
|
||||||
.map(intoRule)
|
.map(intoRule)
|
||||||
|
Loading…
Reference in New Issue
Block a user