mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fixes #138163 by removing unnecessary deriveFromWorkspaceTrust from some options.
This commit is contained in:
parent
16b9fc761b
commit
585cf37801
|
@ -3261,8 +3261,8 @@ export const deriveFromWorkspaceTrust: DeriveFromWorkspaceTrust = 'deriveFromWor
|
|||
*/
|
||||
export interface IUnicodeHighlightOptions {
|
||||
nonBasicASCII?: boolean | DeriveFromWorkspaceTrust;
|
||||
invisibleCharacters?: boolean | DeriveFromWorkspaceTrust;
|
||||
ambiguousCharacters?: boolean | DeriveFromWorkspaceTrust;
|
||||
invisibleCharacters?: boolean;
|
||||
ambiguousCharacters?: boolean;
|
||||
includeComments?: boolean | DeriveFromWorkspaceTrust;
|
||||
/**
|
||||
* A list of allowed code points in a single string.
|
||||
|
@ -3290,8 +3290,8 @@ class UnicodeHighlight extends BaseEditorOption<EditorOption.unicodeHighlighting
|
|||
constructor() {
|
||||
const defaults: InternalUnicodeHighlightOptions = {
|
||||
nonBasicASCII: deriveFromWorkspaceTrust,
|
||||
invisibleCharacters: deriveFromWorkspaceTrust,
|
||||
ambiguousCharacters: deriveFromWorkspaceTrust,
|
||||
invisibleCharacters: true,
|
||||
ambiguousCharacters: true,
|
||||
includeComments: deriveFromWorkspaceTrust,
|
||||
allowedCharacters: '',
|
||||
};
|
||||
|
@ -3308,15 +3308,13 @@ class UnicodeHighlight extends BaseEditorOption<EditorOption.unicodeHighlighting
|
|||
},
|
||||
[unicodeHighlightConfigKeys.invisibleCharacters]: {
|
||||
restricted: true,
|
||||
type: ['boolean', 'string'],
|
||||
enum: [true, false, deriveFromWorkspaceTrust],
|
||||
type: 'boolean',
|
||||
default: defaults.invisibleCharacters,
|
||||
description: nls.localize('unicodeHighlight.invisibleCharacters', "Controls whether characters that just reserve space or have no width at all are highlighted.")
|
||||
},
|
||||
[unicodeHighlightConfigKeys.ambiguousCharacters]: {
|
||||
restricted: true,
|
||||
type: ['boolean', 'string'],
|
||||
enum: [true, false, deriveFromWorkspaceTrust],
|
||||
type: 'boolean',
|
||||
default: defaults.ambiguousCharacters,
|
||||
description: nls.localize('unicodeHighlight.ambiguousCharacters', "Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")
|
||||
},
|
||||
|
@ -3344,8 +3342,8 @@ class UnicodeHighlight extends BaseEditorOption<EditorOption.unicodeHighlighting
|
|||
const input = _input as IUnicodeHighlightOptions;
|
||||
return {
|
||||
nonBasicASCII: primitiveSet<boolean | DeriveFromWorkspaceTrust>(input.nonBasicASCII, deriveFromWorkspaceTrust, [true, false, deriveFromWorkspaceTrust]),
|
||||
invisibleCharacters: primitiveSet<boolean | DeriveFromWorkspaceTrust>(input.invisibleCharacters, deriveFromWorkspaceTrust, [true, false, deriveFromWorkspaceTrust]),
|
||||
ambiguousCharacters: primitiveSet<boolean | DeriveFromWorkspaceTrust>(input.ambiguousCharacters, deriveFromWorkspaceTrust, [true, false, deriveFromWorkspaceTrust]),
|
||||
invisibleCharacters: boolean(input.invisibleCharacters, this.defaultValue.invisibleCharacters),
|
||||
ambiguousCharacters: boolean(input.ambiguousCharacters, this.defaultValue.ambiguousCharacters),
|
||||
includeComments: primitiveSet<boolean | DeriveFromWorkspaceTrust>(input.includeComments, deriveFromWorkspaceTrust, [true, false, deriveFromWorkspaceTrust]),
|
||||
allowedCharacters: string(input.allowedCharacters, ''),
|
||||
};
|
||||
|
|
|
@ -185,28 +185,11 @@ type RemoveDeriveFromWorkspaceTrust<T> = T extends DeriveFromWorkspaceTrust ? ne
|
|||
type ResolvedOptions = { [TKey in keyof InternalUnicodeHighlightOptions]: RemoveDeriveFromWorkspaceTrust<InternalUnicodeHighlightOptions[TKey]> };
|
||||
|
||||
function resolveOptions(trusted: boolean, options: InternalUnicodeHighlightOptions): ResolvedOptions {
|
||||
let defaults;
|
||||
if (trusted) {
|
||||
defaults = {
|
||||
nonBasicASCII: false,
|
||||
ambiguousCharacters: true,
|
||||
invisibleCharacters: true,
|
||||
includeComments: false,
|
||||
};
|
||||
} else {
|
||||
defaults = {
|
||||
nonBasicASCII: true,
|
||||
ambiguousCharacters: true,
|
||||
invisibleCharacters: true,
|
||||
includeComments: true,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
nonBasicASCII: options.nonBasicASCII !== deriveFromWorkspaceTrust ? options.nonBasicASCII : defaults.nonBasicASCII,
|
||||
ambiguousCharacters: options.ambiguousCharacters !== deriveFromWorkspaceTrust ? options.ambiguousCharacters : defaults.ambiguousCharacters,
|
||||
invisibleCharacters: options.invisibleCharacters !== deriveFromWorkspaceTrust ? options.invisibleCharacters : defaults.invisibleCharacters,
|
||||
includeComments: options.includeComments !== deriveFromWorkspaceTrust ? options.includeComments : defaults.includeComments,
|
||||
nonBasicASCII: options.nonBasicASCII !== deriveFromWorkspaceTrust ? options.nonBasicASCII : !trusted,
|
||||
ambiguousCharacters: options.ambiguousCharacters,
|
||||
invisibleCharacters: options.invisibleCharacters,
|
||||
includeComments: options.includeComments !== deriveFromWorkspaceTrust ? options.includeComments : !trusted,
|
||||
allowedCharacters: options.allowedCharacters ?? [],
|
||||
};
|
||||
}
|
||||
|
|
4
src/vs/monaco.d.ts
vendored
4
src/vs/monaco.d.ts
vendored
|
@ -3870,8 +3870,8 @@ declare namespace monaco.editor {
|
|||
*/
|
||||
export interface IUnicodeHighlightOptions {
|
||||
nonBasicASCII?: boolean | DeriveFromWorkspaceTrust;
|
||||
invisibleCharacters?: boolean | DeriveFromWorkspaceTrust;
|
||||
ambiguousCharacters?: boolean | DeriveFromWorkspaceTrust;
|
||||
invisibleCharacters?: boolean;
|
||||
ambiguousCharacters?: boolean;
|
||||
includeComments?: boolean | DeriveFromWorkspaceTrust;
|
||||
/**
|
||||
* A list of allowed code points in a single string.
|
||||
|
|
Loading…
Reference in a new issue