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",
"t": "variable",
"t": "variable.parameter",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",

View File

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

View File

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

View File

@@ -905,20 +905,19 @@ export function findMetadata(colorThemeData: ColorThemeData, captureNames: strin
}
const fontStyle = definitions.foreground?.settings.fontStyle || definitions.bold?.settings.fontStyle;
switch (fontStyle) {
case 'italic':
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('italic')) {
metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
}
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 tokenStyleForeground = (foreground !== undefined) ? colorThemeData.getTokenColorIndex().get(foreground) : ColorId.DefaultForeground;
metadata |= tokenStyleForeground << MetadataConsts.FOREGROUND_OFFSET;