Differences in syntax colorization on file full of errors (#242085)

Fixes #241813
This commit is contained in:
Alex Ross
2025-02-26 16:48:17 +01:00
committed by GitHub
parent 08558cdc21
commit 3f1ff35be2
4 changed files with 35 additions and 23 deletions

View File

@@ -1261,7 +1261,7 @@
}, },
{ {
"c": "rest", "c": "rest",
"t": "variable", "t": "variable.parameter",
"r": { "r": {
"dark_plus": "variable: #9CDCFE", "dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080", "light_plus": "variable: #001080",

View File

@@ -15,16 +15,16 @@
}, },
{ {
"c": "module", "c": "module",
"t": "", "t": "storage.type.namespace.ts",
"r": { "r": {
"dark_plus": "default: #D4D4D4", "dark_plus": "storage.type: #569CD6",
"light_plus": "default: #000000", "light_plus": "storage.type: #0000FF",
"dark_vs": "default: #D4D4D4", "dark_vs": "storage.type: #569CD6",
"light_vs": "default: #000000", "light_vs": "storage.type: #0000FF",
"hc_black": "default: #FFFFFF", "hc_black": "storage.type: #569CD6",
"dark_modern": "default: #CCCCCC", "dark_modern": "storage.type: #569CD6",
"hc_light": "default: #292929", "hc_light": "storage.type: #0F4A85",
"light_modern": "default: #3B3B3B" "light_modern": "storage.type: #0000FF"
} }
}, },
{ {

View File

@@ -75,9 +75,16 @@
(required_parameter (required_parameter
(identifier) @variable.parameter) (identifier) @variable.parameter)
(required_parameter
(rest_pattern
(identifier) @variable.parameter))
(optional_parameter (optional_parameter
(identifier) @variable.parameter) (identifier) @variable.parameter)
(catch_clause
parameter: (identifier) @variable.parameter)
; Function and method calls ; Function and method calls
(call_expression (call_expression
@@ -103,6 +110,8 @@
(predefined_type) @support.type (predefined_type) @support.type
(predefined_type (["string" "boolean" "number" "any" "unknown"])) @support.type.primitive (predefined_type (["string" "boolean" "number" "any" "unknown"])) @support.type.primitive
(type_identifier) @entity.name.type (type_identifier) @entity.name.type
(internal_module
name: (identifier) @entity.name.type.ts)
([ ([
(identifier) (identifier)
@@ -297,6 +306,10 @@
"var" "var"
] @storage.type ] @storage.type
[
"module"
] @storage.type.namespace.ts
[ [
"debugger" "debugger"
"target" "target"

View File

@@ -905,20 +905,19 @@ export function findMetadata(colorThemeData: ColorThemeData, captureNames: strin
} }
const fontStyle = definitions.foreground?.settings.fontStyle || definitions.bold?.settings.fontStyle; const fontStyle = definitions.foreground?.settings.fontStyle || definitions.bold?.settings.fontStyle;
switch (fontStyle) { if (fontStyle?.includes('italic')) {
case 'italic': metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
break;
case 'bold':
metadata |= FontStyle.Bold | MetadataConsts.BOLD_MASK;
break;
case 'underline':
metadata |= FontStyle.Underline | MetadataConsts.UNDERLINE_MASK;
break;
case 'strikethrough':
metadata |= FontStyle.Strikethrough | MetadataConsts.STRIKETHROUGH_MASK;
break;
} }
if (fontStyle?.includes('bold')) {
metadata |= FontStyle.Bold | MetadataConsts.BOLD_MASK;
}
if (fontStyle?.includes('underline')) {
metadata |= FontStyle.Underline | MetadataConsts.UNDERLINE_MASK;
}
if (fontStyle?.includes('strikethrough')) {
metadata |= FontStyle.Strikethrough | MetadataConsts.STRIKETHROUGH_MASK;
}
const foreground = tokenStyle?.foreground; const foreground = tokenStyle?.foreground;
const tokenStyleForeground = (foreground !== undefined) ? colorThemeData.getTokenColorIndex().get(foreground) : ColorId.DefaultForeground; const tokenStyleForeground = (foreground !== undefined) ? colorThemeData.getTokenColorIndex().get(foreground) : ColorId.DefaultForeground;
metadata |= tokenStyleForeground << MetadataConsts.FOREGROUND_OFFSET; metadata |= tokenStyleForeground << MetadataConsts.FOREGROUND_OFFSET;