monaco-editor-core 0.54.0-dev-20250923 → 0.54.0-dev-20250924

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.54.0-dev-20250923(2e93787361c915029103f9f351879cf1c168d61d)
3
+ * Version: 0.54.0-dev-20250924(2e93787361c915029103f9f351879cf1c168d61d)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { illegalArgument } from './errors.js';
6
6
  import { escapeIcons } from './iconLabels.js';
7
+ import { Schemas } from './network.js';
7
8
  import { isEqual } from './resources.js';
8
9
  import { escapeRegExpCharacters } from './strings.js';
9
10
  import { URI } from './uri.js';
@@ -147,4 +148,11 @@ export function parseHrefAndDimensions(href) {
147
148
  }
148
149
  return { href, dimensions };
149
150
  }
151
+ export function createCommandUri(commandId, ...commandArgs) {
152
+ return URI.from({
153
+ scheme: Schemas.command,
154
+ path: commandId,
155
+ query: commandArgs.length ? encodeURIComponent(JSON.stringify(commandArgs)) : undefined,
156
+ });
157
+ }
150
158
  //# sourceMappingURL=htmlContent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/htmlContent.ts","vs/base/common/htmlContent.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,GAAG,EAAiB,MAAM,UAAU,CAAC;AAoB9C,MAAM,OAAO,cAAc;IAS1B,YACC,QAAgB,EAAE,EAClB,qBAA2I,KAAK;QAEhJ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACpC,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,OAA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AU,sBAAsB,CAAC,IAAY;IAClD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnB,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,UAAU,EAAE,CAAC;QAChB,MAAM,gBAAgB,GAAG,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,IAAI,aAAa,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC7B,CAAC","file":"htmlContent.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface MarkdownStringTrustedOptions {\n\treadonly enabledCommands: readonly string[];\n}\n\nexport interface IMarkdownString {\n\treadonly value: string;\n\treadonly isTrusted?: boolean | MarkdownStringTrustedOptions;\n\treadonly supportThemeIcons?: boolean;\n\treadonly supportHtml?: boolean;\n\treadonly baseUri?: UriComponents;\n\turis?: { [href: string]: UriComponents };\n}\n\nexport const enum MarkdownStringTextNewlineStyle {\n\tParagraph = 0,\n\tBreak = 1,\n}\n\nexport class MarkdownString implements IMarkdownString {\n\n\tpublic value: string;\n\tpublic isTrusted?: boolean | MarkdownStringTrustedOptions;\n\tpublic supportThemeIcons?: boolean;\n\tpublic supportHtml?: boolean;\n\tpublic baseUri?: URI;\n\tpublic uris?: { [href: string]: UriComponents } | undefined;\n\n\tconstructor(\n\t\tvalue: string = '',\n\t\tisTrustedOrOptions: boolean | { isTrusted?: boolean | MarkdownStringTrustedOptions; supportThemeIcons?: boolean; supportHtml?: boolean } = false,\n\t) {\n\t\tthis.value = value;\n\t\tif (typeof this.value !== 'string') {\n\t\t\tthrow illegalArgument('value');\n\t\t}\n\n\t\tif (typeof isTrustedOrOptions === 'boolean') {\n\t\t\tthis.isTrusted = isTrustedOrOptions;\n\t\t\tthis.supportThemeIcons = false;\n\t\t\tthis.supportHtml = false;\n\t\t}\n\t\telse {\n\t\t\tthis.isTrusted = isTrustedOrOptions.isTrusted ?? undefined;\n\t\t\tthis.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;\n\t\t\tthis.supportHtml = isTrustedOrOptions.supportHtml ?? false;\n\t\t}\n\t}\n\n\tappendText(value: string, newlineStyle: MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle.Paragraph): MarkdownString {\n\t\tthis.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/([ \\t]+)/g, (_match, g1) => '&nbsp;'.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\n/g, newlineStyle === MarkdownStringTextNewlineStyle.Break ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): MarkdownString {\n\t\tthis.value += value;\n\t\treturn this;\n\t}\n\n\tappendCodeblock(langId: string, code: string): MarkdownString {\n\t\tthis.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n\t\treturn this;\n\t}\n\n\tappendLink(target: URI | string, label: string, title?: string): MarkdownString {\n\t\tthis.value += '[';\n\t\tthis.value += this._escape(label, ']');\n\t\tthis.value += '](';\n\t\tthis.value += this._escape(String(target), ')');\n\t\tif (title) {\n\t\t\tthis.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n\t\t}\n\t\tthis.value += ')';\n\t\treturn this;\n\t}\n\n\tprivate _escape(value: string, ch: string): string {\n\t\tconst r = new RegExp(escapeRegExpCharacters(ch), 'g');\n\t\treturn value.replace(r, (match, offset) => {\n\t\t\tif (value.charAt(offset - 1) !== '\\\\') {\n\t\t\t\treturn `\\\\${match}`;\n\t\t\t} else {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean {\n\tif (isMarkdownString(oneOrMany)) {\n\t\treturn !oneOrMany.value;\n\t} else if (Array.isArray(oneOrMany)) {\n\t\treturn oneOrMany.every(isEmptyMarkdownString);\n\t} else {\n\t\treturn true;\n\t}\n}\n\nexport function isMarkdownString(thing: unknown): thing is IMarkdownString {\n\tif (thing instanceof MarkdownString) {\n\t\treturn true;\n\t} else if (thing && typeof thing === 'object') {\n\t\treturn typeof (<IMarkdownString>thing).value === 'string'\n\t\t\t&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || typeof (<IMarkdownString>thing).isTrusted === 'object' || (<IMarkdownString>thing).isTrusted === undefined)\n\t\t\t&& (typeof (<IMarkdownString>thing).supportThemeIcons === 'boolean' || (<IMarkdownString>thing).supportThemeIcons === undefined);\n\t}\n\treturn false;\n}\n\nexport function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t} else {\n\t\treturn a.value === b.value\n\t\t\t&& a.isTrusted === b.isTrusted\n\t\t\t&& a.supportThemeIcons === b.supportThemeIcons\n\t\t\t&& a.supportHtml === b.supportHtml\n\t\t\t&& (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n\t}\n}\n\nexport function escapeMarkdownSyntaxTokens(text: string): string {\n\t// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n\treturn text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code: string, langId: string) {\n\tconst longestFenceLength =\n\t\tcode.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ??\n\t\t0;\n\tconst desiredFenceLength =\n\t\tlongestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n\n\t// the markdown result\n\treturn [\n\t\t`${'`'.repeat(desiredFenceLength)}${langId}`,\n\t\tcode,\n\t\t`${'`'.repeat(desiredFenceLength)}`,\n\t].join('\\n');\n}\n\nexport function escapeDoubleQuotes(input: string) {\n\treturn input.replace(/\"/g, '&quot;');\n}\n\nexport function removeMarkdownEscapes(text: string): string {\n\tif (!text) {\n\t\treturn text;\n\t}\n\treturn text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\n\nexport function parseHrefAndDimensions(href: string): { href: string; dimensions: string[] } {\n\tconst dimensions: string[] = [];\n\tconst splitted = href.split('|').map(s => s.trim());\n\thref = splitted[0];\n\tconst parameters = splitted[1];\n\tif (parameters) {\n\t\tconst heightFromParams = /height=(\\d+)/.exec(parameters);\n\t\tconst widthFromParams = /width=(\\d+)/.exec(parameters);\n\t\tconst height = heightFromParams ? heightFromParams[1] : '';\n\t\tconst width = widthFromParams ? widthFromParams[1] : '';\n\t\tconst widthIsFinite = isFinite(parseInt(width));\n\t\tconst heightIsFinite = isFinite(parseInt(height));\n\t\tif (widthIsFinite) {\n\t\t\tdimensions.push(`width=\"${width}\"`);\n\t\t}\n\t\tif (heightIsFinite) {\n\t\t\tdimensions.push(`height=\"${height}\"`);\n\t\t}\n\t}\n\treturn { href, dimensions };\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface MarkdownStringTrustedOptions {\n\treadonly enabledCommands: readonly string[];\n}\n\nexport interface IMarkdownString {\n\treadonly value: string;\n\treadonly isTrusted?: boolean | MarkdownStringTrustedOptions;\n\treadonly supportThemeIcons?: boolean;\n\treadonly supportHtml?: boolean;\n\treadonly baseUri?: UriComponents;\n\turis?: { [href: string]: UriComponents };\n}\n\nexport const enum MarkdownStringTextNewlineStyle {\n\tParagraph = 0,\n\tBreak = 1,\n}\n\nexport class MarkdownString implements IMarkdownString {\n\n\tpublic value: string;\n\tpublic isTrusted?: boolean | MarkdownStringTrustedOptions;\n\tpublic supportThemeIcons?: boolean;\n\tpublic supportHtml?: boolean;\n\tpublic baseUri?: URI;\n\tpublic uris?: { [href: string]: UriComponents } | undefined;\n\n\tconstructor(\n\t\tvalue: string = '',\n\t\tisTrustedOrOptions: boolean | { isTrusted?: boolean | MarkdownStringTrustedOptions; supportThemeIcons?: boolean; supportHtml?: boolean } = false,\n\t) {\n\t\tthis.value = value;\n\t\tif (typeof this.value !== 'string') {\n\t\t\tthrow illegalArgument('value');\n\t\t}\n\n\t\tif (typeof isTrustedOrOptions === 'boolean') {\n\t\t\tthis.isTrusted = isTrustedOrOptions;\n\t\t\tthis.supportThemeIcons = false;\n\t\t\tthis.supportHtml = false;\n\t\t}\n\t\telse {\n\t\t\tthis.isTrusted = isTrustedOrOptions.isTrusted ?? undefined;\n\t\t\tthis.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;\n\t\t\tthis.supportHtml = isTrustedOrOptions.supportHtml ?? false;\n\t\t}\n\t}\n\n\tappendText(value: string, newlineStyle: MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle.Paragraph): MarkdownString {\n\t\tthis.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/([ \\t]+)/g, (_match, g1) => '&nbsp;'.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\n/g, newlineStyle === MarkdownStringTextNewlineStyle.Break ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): MarkdownString {\n\t\tthis.value += value;\n\t\treturn this;\n\t}\n\n\tappendCodeblock(langId: string, code: string): MarkdownString {\n\t\tthis.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n\t\treturn this;\n\t}\n\n\tappendLink(target: URI | string, label: string, title?: string): MarkdownString {\n\t\tthis.value += '[';\n\t\tthis.value += this._escape(label, ']');\n\t\tthis.value += '](';\n\t\tthis.value += this._escape(String(target), ')');\n\t\tif (title) {\n\t\t\tthis.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n\t\t}\n\t\tthis.value += ')';\n\t\treturn this;\n\t}\n\n\tprivate _escape(value: string, ch: string): string {\n\t\tconst r = new RegExp(escapeRegExpCharacters(ch), 'g');\n\t\treturn value.replace(r, (match, offset) => {\n\t\t\tif (value.charAt(offset - 1) !== '\\\\') {\n\t\t\t\treturn `\\\\${match}`;\n\t\t\t} else {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean {\n\tif (isMarkdownString(oneOrMany)) {\n\t\treturn !oneOrMany.value;\n\t} else if (Array.isArray(oneOrMany)) {\n\t\treturn oneOrMany.every(isEmptyMarkdownString);\n\t} else {\n\t\treturn true;\n\t}\n}\n\nexport function isMarkdownString(thing: unknown): thing is IMarkdownString {\n\tif (thing instanceof MarkdownString) {\n\t\treturn true;\n\t} else if (thing && typeof thing === 'object') {\n\t\treturn typeof (<IMarkdownString>thing).value === 'string'\n\t\t\t&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || typeof (<IMarkdownString>thing).isTrusted === 'object' || (<IMarkdownString>thing).isTrusted === undefined)\n\t\t\t&& (typeof (<IMarkdownString>thing).supportThemeIcons === 'boolean' || (<IMarkdownString>thing).supportThemeIcons === undefined);\n\t}\n\treturn false;\n}\n\nexport function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t} else {\n\t\treturn a.value === b.value\n\t\t\t&& a.isTrusted === b.isTrusted\n\t\t\t&& a.supportThemeIcons === b.supportThemeIcons\n\t\t\t&& a.supportHtml === b.supportHtml\n\t\t\t&& (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n\t}\n}\n\nexport function escapeMarkdownSyntaxTokens(text: string): string {\n\t// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n\treturn text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code: string, langId: string) {\n\tconst longestFenceLength =\n\t\tcode.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ??\n\t\t0;\n\tconst desiredFenceLength =\n\t\tlongestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n\n\t// the markdown result\n\treturn [\n\t\t`${'`'.repeat(desiredFenceLength)}${langId}`,\n\t\tcode,\n\t\t`${'`'.repeat(desiredFenceLength)}`,\n\t].join('\\n');\n}\n\nexport function escapeDoubleQuotes(input: string) {\n\treturn input.replace(/\"/g, '&quot;');\n}\n\nexport function removeMarkdownEscapes(text: string): string {\n\tif (!text) {\n\t\treturn text;\n\t}\n\treturn text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\n\nexport function parseHrefAndDimensions(href: string): { href: string; dimensions: string[] } {\n\tconst dimensions: string[] = [];\n\tconst splitted = href.split('|').map(s => s.trim());\n\thref = splitted[0];\n\tconst parameters = splitted[1];\n\tif (parameters) {\n\t\tconst heightFromParams = /height=(\\d+)/.exec(parameters);\n\t\tconst widthFromParams = /width=(\\d+)/.exec(parameters);\n\t\tconst height = heightFromParams ? heightFromParams[1] : '';\n\t\tconst width = widthFromParams ? widthFromParams[1] : '';\n\t\tconst widthIsFinite = isFinite(parseInt(width));\n\t\tconst heightIsFinite = isFinite(parseInt(height));\n\t\tif (widthIsFinite) {\n\t\t\tdimensions.push(`width=\"${width}\"`);\n\t\t}\n\t\tif (heightIsFinite) {\n\t\t\tdimensions.push(`height=\"${height}\"`);\n\t\t}\n\t}\n\treturn { href, dimensions };\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/htmlContent.ts","vs/base/common/htmlContent.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,GAAG,EAAiB,MAAM,UAAU,CAAC;AAoB9C,MAAM,OAAO,cAAc;IAS1B,YACC,QAAgB,EAAE,EAClB,qBAA2I,KAAK;QAEhJ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACpC,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,OAAO,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC;YACpC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC1B,CAAC;aACI,CAAC;YACL,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC,SAAS,IAAI,SAAS,CAAC;YAC3D,IAAI,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,iBAAiB,IAAI,KAAK,CAAC;YACvE,IAAI,CAAC,WAAW,GAAG,kBAAkB,CA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AAI,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,IAAI,aAAa,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,GAAG,WAAsB;IAC5E,OAAO,GAAG,CAAC,IAAI,CAAC;QACf,MAAM,EAAE,OAAO,CAAC,OAAO;QACvB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;KACvF,CAAC,CAAC;AACJ,CAAC","file":"htmlContent.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { Schemas } from './network.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface MarkdownStringTrustedOptions {\n\treadonly enabledCommands: readonly string[];\n}\n\nexport interface IMarkdownString {\n\treadonly value: string;\n\treadonly isTrusted?: boolean | MarkdownStringTrustedOptions;\n\treadonly supportThemeIcons?: boolean;\n\treadonly supportHtml?: boolean;\n\treadonly baseUri?: UriComponents;\n\turis?: { [href: string]: UriComponents };\n}\n\nexport const enum MarkdownStringTextNewlineStyle {\n\tParagraph = 0,\n\tBreak = 1,\n}\n\nexport class MarkdownString implements IMarkdownString {\n\n\tpublic value: string;\n\tpublic isTrusted?: boolean | MarkdownStringTrustedOptions;\n\tpublic supportThemeIcons?: boolean;\n\tpublic supportHtml?: boolean;\n\tpublic baseUri?: URI;\n\tpublic uris?: { [href: string]: UriComponents } | undefined;\n\n\tconstructor(\n\t\tvalue: string = '',\n\t\tisTrustedOrOptions: boolean | { isTrusted?: boolean | MarkdownStringTrustedOptions; supportThemeIcons?: boolean; supportHtml?: boolean } = false,\n\t) {\n\t\tthis.value = value;\n\t\tif (typeof this.value !== 'string') {\n\t\t\tthrow illegalArgument('value');\n\t\t}\n\n\t\tif (typeof isTrustedOrOptions === 'boolean') {\n\t\t\tthis.isTrusted = isTrustedOrOptions;\n\t\t\tthis.supportThemeIcons = false;\n\t\t\tthis.supportHtml = false;\n\t\t}\n\t\telse {\n\t\t\tthis.isTrusted = isTrustedOrOptions.isTrusted ?? undefined;\n\t\t\tthis.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;\n\t\t\tthis.supportHtml = isTrustedOrOptions.supportHtml ?? false;\n\t\t}\n\t}\n\n\tappendText(value: string, newlineStyle: MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle.Paragraph): MarkdownString {\n\t\tthis.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/([ \\t]+)/g, (_match, g1) => '&nbsp;'.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\n/g, newlineStyle === MarkdownStringTextNewlineStyle.Break ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): MarkdownString {\n\t\tthis.value += value;\n\t\treturn this;\n\t}\n\n\tappendCodeblock(langId: string, code: string): MarkdownString {\n\t\tthis.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n\t\treturn this;\n\t}\n\n\tappendLink(target: URI | string, label: string, title?: string): MarkdownString {\n\t\tthis.value += '[';\n\t\tthis.value += this._escape(label, ']');\n\t\tthis.value += '](';\n\t\tthis.value += this._escape(String(target), ')');\n\t\tif (title) {\n\t\t\tthis.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n\t\t}\n\t\tthis.value += ')';\n\t\treturn this;\n\t}\n\n\tprivate _escape(value: string, ch: string): string {\n\t\tconst r = new RegExp(escapeRegExpCharacters(ch), 'g');\n\t\treturn value.replace(r, (match, offset) => {\n\t\t\tif (value.charAt(offset - 1) !== '\\\\') {\n\t\t\t\treturn `\\\\${match}`;\n\t\t\t} else {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean {\n\tif (isMarkdownString(oneOrMany)) {\n\t\treturn !oneOrMany.value;\n\t} else if (Array.isArray(oneOrMany)) {\n\t\treturn oneOrMany.every(isEmptyMarkdownString);\n\t} else {\n\t\treturn true;\n\t}\n}\n\nexport function isMarkdownString(thing: unknown): thing is IMarkdownString {\n\tif (thing instanceof MarkdownString) {\n\t\treturn true;\n\t} else if (thing && typeof thing === 'object') {\n\t\treturn typeof (<IMarkdownString>thing).value === 'string'\n\t\t\t&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || typeof (<IMarkdownString>thing).isTrusted === 'object' || (<IMarkdownString>thing).isTrusted === undefined)\n\t\t\t&& (typeof (<IMarkdownString>thing).supportThemeIcons === 'boolean' || (<IMarkdownString>thing).supportThemeIcons === undefined);\n\t}\n\treturn false;\n}\n\nexport function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t} else {\n\t\treturn a.value === b.value\n\t\t\t&& a.isTrusted === b.isTrusted\n\t\t\t&& a.supportThemeIcons === b.supportThemeIcons\n\t\t\t&& a.supportHtml === b.supportHtml\n\t\t\t&& (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n\t}\n}\n\nexport function escapeMarkdownSyntaxTokens(text: string): string {\n\t// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n\treturn text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code: string, langId: string) {\n\tconst longestFenceLength =\n\t\tcode.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ??\n\t\t0;\n\tconst desiredFenceLength =\n\t\tlongestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n\n\t// the markdown result\n\treturn [\n\t\t`${'`'.repeat(desiredFenceLength)}${langId}`,\n\t\tcode,\n\t\t`${'`'.repeat(desiredFenceLength)}`,\n\t].join('\\n');\n}\n\nexport function escapeDoubleQuotes(input: string) {\n\treturn input.replace(/\"/g, '&quot;');\n}\n\nexport function removeMarkdownEscapes(text: string): string {\n\tif (!text) {\n\t\treturn text;\n\t}\n\treturn text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\n\nexport function parseHrefAndDimensions(href: string): { href: string; dimensions: string[] } {\n\tconst dimensions: string[] = [];\n\tconst splitted = href.split('|').map(s => s.trim());\n\thref = splitted[0];\n\tconst parameters = splitted[1];\n\tif (parameters) {\n\t\tconst heightFromParams = /height=(\\d+)/.exec(parameters);\n\t\tconst widthFromParams = /width=(\\d+)/.exec(parameters);\n\t\tconst height = heightFromParams ? heightFromParams[1] : '';\n\t\tconst width = widthFromParams ? widthFromParams[1] : '';\n\t\tconst widthIsFinite = isFinite(parseInt(width));\n\t\tconst heightIsFinite = isFinite(parseInt(height));\n\t\tif (widthIsFinite) {\n\t\t\tdimensions.push(`width=\"${width}\"`);\n\t\t}\n\t\tif (heightIsFinite) {\n\t\t\tdimensions.push(`height=\"${height}\"`);\n\t\t}\n\t}\n\treturn { href, dimensions };\n}\n\nexport function createCommandUri(commandId: string, ...commandArgs: unknown[]): URI {\n\treturn URI.from({\n\t\tscheme: Schemas.command,\n\t\tpath: commandId,\n\t\tquery: commandArgs.length ? encodeURIComponent(JSON.stringify(commandArgs)) : undefined,\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from './errors.js';\nimport { escapeIcons } from './iconLabels.js';\nimport { Schemas } from './network.js';\nimport { isEqual } from './resources.js';\nimport { escapeRegExpCharacters } from './strings.js';\nimport { URI, UriComponents } from './uri.js';\n\nexport interface MarkdownStringTrustedOptions {\n\treadonly enabledCommands: readonly string[];\n}\n\nexport interface IMarkdownString {\n\treadonly value: string;\n\treadonly isTrusted?: boolean | MarkdownStringTrustedOptions;\n\treadonly supportThemeIcons?: boolean;\n\treadonly supportHtml?: boolean;\n\treadonly baseUri?: UriComponents;\n\turis?: { [href: string]: UriComponents };\n}\n\nexport const enum MarkdownStringTextNewlineStyle {\n\tParagraph = 0,\n\tBreak = 1,\n}\n\nexport class MarkdownString implements IMarkdownString {\n\n\tpublic value: string;\n\tpublic isTrusted?: boolean | MarkdownStringTrustedOptions;\n\tpublic supportThemeIcons?: boolean;\n\tpublic supportHtml?: boolean;\n\tpublic baseUri?: URI;\n\tpublic uris?: { [href: string]: UriComponents } | undefined;\n\n\tconstructor(\n\t\tvalue: string = '',\n\t\tisTrustedOrOptions: boolean | { isTrusted?: boolean | MarkdownStringTrustedOptions; supportThemeIcons?: boolean; supportHtml?: boolean } = false,\n\t) {\n\t\tthis.value = value;\n\t\tif (typeof this.value !== 'string') {\n\t\t\tthrow illegalArgument('value');\n\t\t}\n\n\t\tif (typeof isTrustedOrOptions === 'boolean') {\n\t\t\tthis.isTrusted = isTrustedOrOptions;\n\t\t\tthis.supportThemeIcons = false;\n\t\t\tthis.supportHtml = false;\n\t\t}\n\t\telse {\n\t\t\tthis.isTrusted = isTrustedOrOptions.isTrusted ?? undefined;\n\t\t\tthis.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;\n\t\t\tthis.supportHtml = isTrustedOrOptions.supportHtml ?? false;\n\t\t}\n\t}\n\n\tappendText(value: string, newlineStyle: MarkdownStringTextNewlineStyle = MarkdownStringTextNewlineStyle.Paragraph): MarkdownString {\n\t\tthis.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/([ \\t]+)/g, (_match, g1) => '&nbsp;'.repeat(g1.length)) // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\>/gm, '\\\\>') // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\t\t\t.replace(/\\n/g, newlineStyle === MarkdownStringTextNewlineStyle.Break ? '\\\\\\n' : '\\n\\n'); // CodeQL [SM02383] The Markdown is fully sanitized after being rendered.\n\n\t\treturn this;\n\t}\n\n\tappendMarkdown(value: string): MarkdownString {\n\t\tthis.value += value;\n\t\treturn this;\n\t}\n\n\tappendCodeblock(langId: string, code: string): MarkdownString {\n\t\tthis.value += `\\n${appendEscapedMarkdownCodeBlockFence(code, langId)}\\n`;\n\t\treturn this;\n\t}\n\n\tappendLink(target: URI | string, label: string, title?: string): MarkdownString {\n\t\tthis.value += '[';\n\t\tthis.value += this._escape(label, ']');\n\t\tthis.value += '](';\n\t\tthis.value += this._escape(String(target), ')');\n\t\tif (title) {\n\t\t\tthis.value += ` \"${this._escape(this._escape(title, '\"'), ')')}\"`;\n\t\t}\n\t\tthis.value += ')';\n\t\treturn this;\n\t}\n\n\tprivate _escape(value: string, ch: string): string {\n\t\tconst r = new RegExp(escapeRegExpCharacters(ch), 'g');\n\t\treturn value.replace(r, (match, offset) => {\n\t\t\tif (value.charAt(offset - 1) !== '\\\\') {\n\t\t\t\treturn `\\\\${match}`;\n\t\t\t} else {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean {\n\tif (isMarkdownString(oneOrMany)) {\n\t\treturn !oneOrMany.value;\n\t} else if (Array.isArray(oneOrMany)) {\n\t\treturn oneOrMany.every(isEmptyMarkdownString);\n\t} else {\n\t\treturn true;\n\t}\n}\n\nexport function isMarkdownString(thing: unknown): thing is IMarkdownString {\n\tif (thing instanceof MarkdownString) {\n\t\treturn true;\n\t} else if (thing && typeof thing === 'object') {\n\t\treturn typeof (<IMarkdownString>thing).value === 'string'\n\t\t\t&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || typeof (<IMarkdownString>thing).isTrusted === 'object' || (<IMarkdownString>thing).isTrusted === undefined)\n\t\t\t&& (typeof (<IMarkdownString>thing).supportThemeIcons === 'boolean' || (<IMarkdownString>thing).supportThemeIcons === undefined);\n\t}\n\treturn false;\n}\n\nexport function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t} else if (!a || !b) {\n\t\treturn false;\n\t} else {\n\t\treturn a.value === b.value\n\t\t\t&& a.isTrusted === b.isTrusted\n\t\t\t&& a.supportThemeIcons === b.supportThemeIcons\n\t\t\t&& a.supportHtml === b.supportHtml\n\t\t\t&& (a.baseUri === b.baseUri || !!a.baseUri && !!b.baseUri && isEqual(URI.from(a.baseUri), URI.from(b.baseUri)));\n\t}\n}\n\nexport function escapeMarkdownSyntaxTokens(text: string): string {\n\t// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n\treturn text.replace(/[\\\\`*_{}[\\]()#+\\-!~]/g, '\\\\$&'); // CodeQL [SM02383] Backslash is escaped in the character class\n}\n\n/**\n * @see https://github.com/microsoft/vscode/issues/193746\n */\nexport function appendEscapedMarkdownCodeBlockFence(code: string, langId: string) {\n\tconst longestFenceLength =\n\t\tcode.match(/^`+/gm)?.reduce((a, b) => (a.length > b.length ? a : b)).length ??\n\t\t0;\n\tconst desiredFenceLength =\n\t\tlongestFenceLength >= 3 ? longestFenceLength + 1 : 3;\n\n\t// the markdown result\n\treturn [\n\t\t`${'`'.repeat(desiredFenceLength)}${langId}`,\n\t\tcode,\n\t\t`${'`'.repeat(desiredFenceLength)}`,\n\t].join('\\n');\n}\n\nexport function escapeDoubleQuotes(input: string) {\n\treturn input.replace(/\"/g, '&quot;');\n}\n\nexport function removeMarkdownEscapes(text: string): string {\n\tif (!text) {\n\t\treturn text;\n\t}\n\treturn text.replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!~])/g, '$1');\n}\n\nexport function parseHrefAndDimensions(href: string): { href: string; dimensions: string[] } {\n\tconst dimensions: string[] = [];\n\tconst splitted = href.split('|').map(s => s.trim());\n\thref = splitted[0];\n\tconst parameters = splitted[1];\n\tif (parameters) {\n\t\tconst heightFromParams = /height=(\\d+)/.exec(parameters);\n\t\tconst widthFromParams = /width=(\\d+)/.exec(parameters);\n\t\tconst height = heightFromParams ? heightFromParams[1] : '';\n\t\tconst width = widthFromParams ? widthFromParams[1] : '';\n\t\tconst widthIsFinite = isFinite(parseInt(width));\n\t\tconst heightIsFinite = isFinite(parseInt(height));\n\t\tif (widthIsFinite) {\n\t\t\tdimensions.push(`width=\"${width}\"`);\n\t\t}\n\t\tif (heightIsFinite) {\n\t\t\tdimensions.push(`height=\"${height}\"`);\n\t\t}\n\t}\n\treturn { href, dimensions };\n}\n\nexport function createCommandUri(commandId: string, ...commandArgs: unknown[]): URI {\n\treturn URI.from({\n\t\tscheme: Schemas.command,\n\t\tpath: commandId,\n\t\tquery: commandArgs.length ? encodeURIComponent(JSON.stringify(commandArgs)) : undefined,\n\t});\n}\n"]}
@@ -18,12 +18,18 @@
18
18
  .action-item > .action-label {
19
19
  padding: 5px;
20
20
  font-size: 12px;
21
+ border-radius: 2px;
21
22
  }
22
23
 
23
24
  .action-item > .action-label.codicon {
24
25
  color: var(--vscode-button-foreground);
25
26
  }
26
27
 
28
+ .action-item > .action-label.codicon:not(.separator) {
29
+ padding-top: 6px;
30
+ padding-bottom: 6px;
31
+ }
32
+
27
33
  .action-item:first-child > .action-label {
28
34
  padding-left: 7px;
29
35
  }
@@ -14,13 +14,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  import { h } from '../../../../base/browser/dom.js';
15
15
  import { Disposable } from '../../../../base/common/lifecycle.js';
16
16
  import { autorun, constObservable, observableFromEvent } from '../../../../base/common/observable.js';
17
+ import { MenuEntryActionViewItem } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';
17
18
  import { MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';
18
- import { IMenuService, MenuId } from '../../../../platform/actions/common/actions.js';
19
+ import { IMenuService, MenuId, MenuItemAction } from '../../../../platform/actions/common/actions.js';
19
20
  import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
21
+ import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
20
22
  import { observableCodeEditor } from '../../../browser/observableCodeEditor.js';
21
23
  let FloatingEditorToolbar = class FloatingEditorToolbar extends Disposable {
22
24
  static { this.ID = 'editor.contrib.floatingToolbar'; }
23
- constructor(editor, instantiationService, menuService) {
25
+ constructor(editor, instantiationService, keybindingService, menuService) {
24
26
  super();
25
27
  const editorObs = this._register(observableCodeEditor(editor));
26
28
  const menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));
@@ -36,6 +38,22 @@ let FloatingEditorToolbar = class FloatingEditorToolbar extends Disposable {
36
38
  container.root.style.height = '28px';
37
39
  // Toolbar
38
40
  const toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {
41
+ actionViewItemProvider: (action, options) => {
42
+ if (!(action instanceof MenuItemAction)) {
43
+ return undefined;
44
+ }
45
+ const keybinding = keybindingService.lookupKeybinding(action.id);
46
+ if (!keybinding) {
47
+ return undefined;
48
+ }
49
+ return instantiationService.createInstance(class extends MenuEntryActionViewItem {
50
+ updateLabel() {
51
+ if (this.options.label && this.label) {
52
+ this.label.textContent = `${this._commandAction.label} (${keybinding.getLabel()})`;
53
+ }
54
+ }
55
+ }, action, { ...options, keybindingNotRenderedWithLabel: true });
56
+ },
39
57
  hiddenItemStrategy: 0 /* HiddenItemStrategy.Ignore */,
40
58
  menuOptions: {
41
59
  shouldForwardArgs: true
@@ -65,7 +83,8 @@ let FloatingEditorToolbar = class FloatingEditorToolbar extends Disposable {
65
83
  };
66
84
  FloatingEditorToolbar = __decorate([
67
85
  __param(1, IInstantiationService),
68
- __param(2, IMenuService)
86
+ __param(2, IKeybindingService),
87
+ __param(3, IMenuService)
69
88
  ], FloatingEditorToolbar);
70
89
  export { FloatingEditorToolbar };
71
90
  //# sourceMappingURL=floatingMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/floatingMenu/browser/floating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_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { h } from '../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor, OverlayWidgetPositionPreference } from '../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../browser/observableCodeEditor.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\n\nexport class FloatingEditorToolbar extends Disposable implements IEditorContribution {\n\tstatic readonly ID = 'editor.contrib.floatingToolbar';\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IMenuService menuService: IMenuService\n\t) {\n\t\tsuper();\n\n\t\tconst editorObs = this._register(observableCodeEditor(editor));\n\n\t\tconst menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));\n\t\tconst menuIsEmptyObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions().length === 0);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst menuIsEmpty = menuIsEmptyObs.read(reader);\n\t\t\tif (menuIsEmpty) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst container = h('div.floating-menu-overlay-widget');\n\n\t\t\t// Set height explicitly to ensure that the floating menu element\n\t\t\t// is rendered in the lower right corner at the correct position.\n\t\t\tcontainer.root.style.height = '28px';\n\n\t\t\t// Toolbar\n\t\t\tconst toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true\n\t\t\t\t},\n\t\t\t\ttelemetrySource: 'editor.overlayToolbar',\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: () => true,\n\t\t\t\t\tuseSeparatorsInPrimaryActions: true\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treader.store.add(toolbar);\n\t\t\treader.store.add(autorun(reader => {\n\t\t\t\tconst model = editorObs.model.read(reader);\n\t\t\t\ttoolbar.context = model?.uri;\n\t\t\t}));\n\n\t\t\t// Overlay widget\n\t\t\treader.store.add(editorObs.createOverlayWidget({\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: container.root,\n\t\t\t\tminContentWidthInPx: constObservable(0),\n\t\t\t\tposition: constObservable({\n\t\t\t\t\tpreference: OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER\n\t\t\t\t})\n\t\t\t}));\n\t\t}));\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { h } from '../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor, OverlayWidgetPositionPreference } from '../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../browser/observableCodeEditor.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\n\nexport class FloatingEditorToolbar extends Disposable implements IEditorContribution {\n\tstatic readonly ID = 'editor.contrib.floatingToolbar';\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IMenuService menuService: IMenuService\n\t) {\n\t\tsuper();\n\n\t\tconst editorObs = this._register(observableCodeEditor(editor));\n\n\t\tconst menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));\n\t\tconst menuIsEmptyObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions().length === 0);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst menuIsEmpty = menuIsEmptyObs.read(reader);\n\t\t\tif (menuIsEmpty) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst container = h('div.floating-menu-overlay-widget');\n\n\t\t\t// Set height explicitly to ensure that the floating menu element\n\t\t\t// is rendered in the lower right corner at the correct position.\n\t\t\tcontainer.root.style.height = '28px';\n\n\t\t\t// Toolbar\n\t\t\tconst toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true\n\t\t\t\t},\n\t\t\t\ttelemetrySource: 'editor.overlayToolbar',\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: () => true,\n\t\t\t\t\tuseSeparatorsInPrimaryActions: true\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treader.store.add(toolbar);\n\t\t\treader.store.add(autorun(reader => {\n\t\t\t\tconst model = editorObs.model.read(reader);\n\t\t\t\ttoolbar.context = model?.uri;\n\t\t\t}));\n\n\t\t\t// Overlay widget\n\t\t\treader.store.add(editorObs.createOverlayWidget({\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: container.root,\n\t\t\t\tminContentWidthInPx: constObservable(0),\n\t\t\t\tposition: constObservable({\n\t\t\t\t\tpreference: OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER\n\t\t\t\t})\n\t\t\t}));\n\t\t}));\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/floatingMenu/browser/floatingMenu.ts","vs/editor/contrib/floatingMenu/browser/floatingMenu.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,MAAM,iCAAiC,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iEAAiE,CAAC;AAC1G,OAAO,EAAsB,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAE1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAGzE,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;aACpC,OAAE,GAAG,gCAAH,AAAmC,CAAC;IAEtD,YACC,MAAmB,EACI,oBAA2C,EAC9C,iBAAqC,EAC3C,WAAyB;QAEvC,KAAK,EAAE,CAAC;QAER,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;QAE/D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACpG,MAAM,cAAc,GAAG,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,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Z,iBAAiB,EAAE,IAAI;iBACvB;gBACD,eAAe,EAAE,uBAAuB;gBACxC,cAAc,EAAE;oBACf,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;oBACxB,6BAA6B,EAAE,IAAI;iBACnC;aACD,CAAC,CAAC;YAEH,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACjC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3C,OAAO,CAAC,OAAO,GAAG,KAAK,EAAE,GAAG,CAAC;YAC9B,CAAC,CAAC,CAAC,CAAC;YAEJ,iBAAiB;YACjB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,CAAC;gBAC9C,mBAAmB,EAAE,KAAK;gBAC1B,OAAO,EAAE,SAAS,CAAC,IAAI;gBACvB,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC;gBACvC,QAAQ,EAAE,eAAe,CAAC;oBACzB,UAAU,6DAAqD;iBAC/D,CAAC;aACF,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACL,CAAC;;AA3EW,qBAAqB;IAK/B,WAAA,qBAAqB,CAAA;IACrB,WAAA,kBAAkB,CAAA;IAClB,WAAA,YAAY,CAAA;GAPF,qBAAqB,CA4EjC","file":"floatingMenu.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { h } from '../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { MenuEntryActionViewItem } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId, MenuItemAction } from '../../../../platform/actions/common/actions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';\nimport { ICodeEditor, OverlayWidgetPositionPreference } from '../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../browser/observableCodeEditor.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\n\nexport class FloatingEditorToolbar extends Disposable implements IEditorContribution {\n\tstatic readonly ID = 'editor.contrib.floatingToolbar';\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IKeybindingService keybindingService: IKeybindingService,\n\t\t@IMenuService menuService: IMenuService\n\t) {\n\t\tsuper();\n\n\t\tconst editorObs = this._register(observableCodeEditor(editor));\n\n\t\tconst menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));\n\t\tconst menuIsEmptyObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions().length === 0);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst menuIsEmpty = menuIsEmptyObs.read(reader);\n\t\t\tif (menuIsEmpty) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst container = h('div.floating-menu-overlay-widget');\n\n\t\t\t// Set height explicitly to ensure that the floating menu element\n\t\t\t// is rendered in the lower right corner at the correct position.\n\t\t\tcontainer.root.style.height = '28px';\n\n\t\t\t// Toolbar\n\t\t\tconst toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {\n\t\t\t\tactionViewItemProvider: (action, options) => {\n\t\t\t\t\tif (!(action instanceof MenuItemAction)) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keybinding = keybindingService.lookupKeybinding(action.id);\n\t\t\t\t\tif (!keybinding) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn instantiationService.createInstance(class extends MenuEntryActionViewItem {\n\t\t\t\t\t\tprotected override updateLabel(): void {\n\t\t\t\t\t\t\tif (this.options.label && this.label) {\n\t\t\t\t\t\t\t\tthis.label.textContent = `${this._commandAction.label} (${keybinding.getLabel()})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, action, { ...options, keybindingNotRenderedWithLabel: true });\n\t\t\t\t},\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true\n\t\t\t\t},\n\t\t\t\ttelemetrySource: 'editor.overlayToolbar',\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: () => true,\n\t\t\t\t\tuseSeparatorsInPrimaryActions: true\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treader.store.add(toolbar);\n\t\t\treader.store.add(autorun(reader => {\n\t\t\t\tconst model = editorObs.model.read(reader);\n\t\t\t\ttoolbar.context = model?.uri;\n\t\t\t}));\n\n\t\t\t// Overlay widget\n\t\t\treader.store.add(editorObs.createOverlayWidget({\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: container.root,\n\t\t\t\tminContentWidthInPx: constObservable(0),\n\t\t\t\tposition: constObservable({\n\t\t\t\t\tpreference: OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER\n\t\t\t\t})\n\t\t\t}));\n\t\t}));\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { h } from '../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { MenuEntryActionViewItem } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId, MenuItemAction } from '../../../../platform/actions/common/actions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';\nimport { ICodeEditor, OverlayWidgetPositionPreference } from '../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../browser/observableCodeEditor.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\n\nexport class FloatingEditorToolbar extends Disposable implements IEditorContribution {\n\tstatic readonly ID = 'editor.contrib.floatingToolbar';\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IKeybindingService keybindingService: IKeybindingService,\n\t\t@IMenuService menuService: IMenuService\n\t) {\n\t\tsuper();\n\n\t\tconst editorObs = this._register(observableCodeEditor(editor));\n\n\t\tconst menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));\n\t\tconst menuIsEmptyObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions().length === 0);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst menuIsEmpty = menuIsEmptyObs.read(reader);\n\t\t\tif (menuIsEmpty) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst container = h('div.floating-menu-overlay-widget');\n\n\t\t\t// Set height explicitly to ensure that the floating menu element\n\t\t\t// is rendered in the lower right corner at the correct position.\n\t\t\tcontainer.root.style.height = '28px';\n\n\t\t\t// Toolbar\n\t\t\tconst toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {\n\t\t\t\tactionViewItemProvider: (action, options) => {\n\t\t\t\t\tif (!(action instanceof MenuItemAction)) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst keybinding = keybindingService.lookupKeybinding(action.id);\n\t\t\t\t\tif (!keybinding) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn instantiationService.createInstance(class extends MenuEntryActionViewItem {\n\t\t\t\t\t\tprotected override updateLabel(): void {\n\t\t\t\t\t\t\tif (this.options.label && this.label) {\n\t\t\t\t\t\t\t\tthis.label.textContent = `${this._commandAction.label} (${keybinding.getLabel()})`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, action, { ...options, keybindingNotRenderedWithLabel: true });\n\t\t\t\t},\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true\n\t\t\t\t},\n\t\t\t\ttelemetrySource: 'editor.overlayToolbar',\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: () => true,\n\t\t\t\t\tuseSeparatorsInPrimaryActions: true\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treader.store.add(toolbar);\n\t\t\treader.store.add(autorun(reader => {\n\t\t\t\tconst model = editorObs.model.read(reader);\n\t\t\t\ttoolbar.context = model?.uri;\n\t\t\t}));\n\n\t\t\t// Overlay widget\n\t\t\treader.store.add(editorObs.createOverlayWidget({\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: container.root,\n\t\t\t\tminContentWidthInPx: constObservable(0),\n\t\t\t\tposition: constObservable({\n\t\t\t\t\tpreference: OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER\n\t\t\t\t})\n\t\t\t}));\n\t\t}));\n\t}\n}\n"]}
@@ -6,8 +6,7 @@ import { CancellationError, onUnexpectedExternalError } from '../../../../base/c
6
6
  import { DisposableStore } from '../../../../base/common/lifecycle.js';
7
7
  import { Position } from '../../../common/core/position.js';
8
8
  import { Range } from '../../../common/core/range.js';
9
- import { Schemas } from '../../../../base/common/network.js';
10
- import { URI } from '../../../../base/common/uri.js';
9
+ import { createCommandUri } from '../../../../base/common/htmlContent.js';
11
10
  export class InlayHintAnchor {
12
11
  constructor(range, direction) {
13
12
  this.range = range;
@@ -141,10 +140,6 @@ export class InlayHintsFragments {
141
140
  }
142
141
  }
143
142
  export function asCommandLink(command) {
144
- return URI.from({
145
- scheme: Schemas.command,
146
- path: command.id,
147
- query: command.arguments && encodeURIComponent(JSON.stringify(command.arguments))
148
- }).toString();
143
+ return createCommandUri(command.id, ...(command.arguments ?? [])).toString();
149
144
  }
150
145
  //# sourceMappingURL=inlayHints.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlayHints/browser/inlayHints.ts","vs/editor/contrib/inlayHints/browser/inlayHints.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAa,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAItD,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAErD,MAAM,OAAO,eAAe;IAC3B,YAAqB,KAAY,EAAW,SAA6B;QAApD,UAAK,GAAL,KAAK,CAAO;QAAW,cAAS,GAAT,SAAS,CAAoB;IAAI,CAAC;CAC9E;AAED,MAAM,OAAO,aAAa;IAKzB,YAAqB,IAAe,EAAW,MAAuB,EAAW,QAA4B;QAAxF,SAAI,GAAJ,IAAI,CAAW;QAAW,WAAM,GAAN,MAAM,CAAiB;QAAW,aAAQ,GAAR,QAAQ,CAAoB;QAHrG,gBAAW,GAAY,KAAK,CAAC;IAG4E,CAAC;IAElH,IAAI,CAAC,KAAkC;QACtC,MAAM,MAAM,GAAG,IAAI,aAAa,C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,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAEnC,IAAI,GAAG,GAAG,KAAK,KAAK,CAAC,EAAE,CAAC;YACvB,6EAA6E;YAC7E,IAAI,KAAK,KAAK,MAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;gBACjC,gBAAgB;gBAChB,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACvC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC1D,iBAAiB;gBACjB,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACvC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;QACF,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;;AAGF,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC7C,OAAO,GAAG,CAAC,IAAI,CAAC;QACf,MAAM,EAAE,OAAO,CAAC,OAAO;QACvB,IAAI,EAAE,OAAO,CAAC,EAAE;QAChB,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACjF,CAAC,CAAC,QAAQ,EAAE,CAAC;AACf,CAAC","file":"inlayHints.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancellationError, onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { InlayHint, InlayHintList, InlayHintsProvider, Command } from '../../../common/languages.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport { URI } from '../../../../base/common/uri.js';\n\nexport class InlayHintAnchor {\n\tconstructor(readonly range: Range, readonly direction: 'before' | 'after') { }\n}\n\nexport class InlayHintItem {\n\n\tprivate _isResolved: boolean = false;\n\tprivate _currentResolve?: Promise<void>;\n\n\tconstructor(readonly hint: InlayHint, readonly anchor: InlayHintAnchor, readonly provider: InlayHintsProvider) { }\n\n\twith(delta: { anchor: InlayHintAnchor }): InlayHintItem {\n\t\tconst result = new InlayHintItem(this.hint, delta.anchor, this.provider);\n\t\tresult._isResolved = this._isResolved;\n\t\tresult._currentResolve = this._currentResolve;\n\t\treturn result;\n\t}\n\n\tasync resolve(token: CancellationToken): Promise<void> {\n\t\tif (typeof this.provider.resolveInlayHint !== 'function') {\n\t\t\treturn;\n\t\t}\n\t\tif (this._currentResolve) {\n\t\t\t// wait for an active resolve operation and try again\n\t\t\t// when that's done.\n\t\t\tawait this._currentResolve;\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.resolve(token);\n\t\t}\n\t\tif (!this._isResolved) {\n\t\t\tthis._currentResolve = this._doResolve(token)\n\t\t\t\t.finally(() => this._currentResolve = undefined);\n\t\t}\n\t\tawait this._currentResolve;\n\t}\n\n\tprivate async _doResolve(token: CancellationToken) {\n\t\ttry {\n\t\t\tconst newHint = await Promise.resolve(this.provider.resolveInlayHint!(this.hint, token));\n\t\t\tthis.hint.tooltip = newHint?.tooltip ?? this.hint.tooltip;\n\t\t\tthis.hint.label = newHint?.label ?? this.hint.label;\n\t\t\tthis.hint.textEdits = newHint?.textEdits ?? this.hint.textEdits;\n\t\t\tthis._isResolved = true;\n\t\t} catch (err) {\n\t\t\tonUnexpectedExternalError(err);\n\t\t\tthis._isResolved = false;\n\t\t}\n\t}\n}\n\nexport class InlayHintsFragments {\n\n\tprivate static _emptyInlayHintList: InlayHintList = Object.freeze({ dispose() { }, hints: [] });\n\n\tstatic async create(registry: LanguageFeatureRegistry<InlayHintsProvider>, model: ITextModel, ranges: Range[], token: CancellationToken): Promise<InlayHintsFragments> {\n\n\t\tconst data: [InlayHintList, InlayHintsProvider][] = [];\n\n\t\tconst promises = registry.ordered(model).reverse().map(provider => ranges.map(async range => {\n\t\t\ttry {\n\t\t\t\tconst result = await provider.provideInlayHints(model, range, token);\n\t\t\t\tif (result?.hints.length || provider.onDidChangeInlayHints) {\n\t\t\t\t\tdata.push([result ?? InlayHintsFragments._emptyInlayHintList, provider]);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonUnexpectedExternalError(err);\n\t\t\t}\n\t\t}));\n\n\t\tawait Promise.all(promises.flat());\n\n\t\tif (token.isCancellationRequested || model.isDisposed()) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\treturn new InlayHintsFragments(ranges, data, model);\n\t}\n\n\tprivate readonly _disposables = new DisposableStore();\n\n\treadonly items: readonly InlayHintItem[];\n\treadonly ranges: readonly Range[];\n\treadonly provider: Set<InlayHintsProvider>;\n\n\tprivate constructor(ranges: Range[], data: [InlayHintList, InlayHintsProvider][], model: ITextModel) {\n\t\tthis.ranges = ranges;\n\t\tthis.provider = new Set();\n\t\tconst items: InlayHintItem[] = [];\n\t\tfor (const [list, provider] of data) {\n\t\t\tthis._disposables.add(list);\n\t\t\tthis.provider.add(provider);\n\n\t\t\tfor (const hint of list.hints) {\n\t\t\t\t// compute the range to which the item should be attached to\n\t\t\t\tconst position = model.validatePosition(hint.position);\n\t\t\t\tlet direction: 'before' | 'after' = 'before';\n\n\t\t\t\tconst wordRange = InlayHintsFragments._getRangeAtPosition(model, position);\n\t\t\t\tlet range: Range;\n\n\t\t\t\tif (wordRange.getStartPosition().isBefore(position)) {\n\t\t\t\t\trange = Range.fromPositions(wordRange.getStartPosition(), position);\n\t\t\t\t\tdirection = 'after';\n\t\t\t\t} else {\n\t\t\t\t\trange = Range.fromPositions(position, wordRange.getEndPosition());\n\t\t\t\t\tdirection = 'before';\n\t\t\t\t}\n\n\t\t\t\titems.push(new InlayHintItem(hint, new InlayHintAnchor(range, direction), provider));\n\t\t\t}\n\t\t}\n\t\tthis.items = items.sort((a, b) => Position.compare(a.hint.position, b.hint.position));\n\t}\n\n\tdispose(): void {\n\t\tthis._disposables.dispose();\n\t}\n\n\tprivate static _getRangeAtPosition(model: ITextModel, position: IPosition): Range {\n\t\tconst line = position.lineNumber;\n\t\tconst word = model.getWordAtPosition(position);\n\t\tif (word) {\n\t\t\t// always prefer the word range\n\t\t\treturn new Range(line, word.startColumn, line, word.endColumn);\n\t\t}\n\n\t\tmodel.tokenization.tokenizeIfCheap(line);\n\t\tconst tokens = model.tokenization.getLineTokens(line);\n\t\tconst offset = position.column - 1;\n\t\tconst idx = tokens.findTokenIndexAtOffset(offset);\n\n\t\tlet start = tokens.getStartOffset(idx);\n\t\tlet end = tokens.getEndOffset(idx);\n\n\t\tif (end - start === 1) {\n\t\t\t// single character token, when at its end try leading/trailing token instead\n\t\t\tif (start === offset && idx > 1) {\n\t\t\t\t// leading token\n\t\t\t\tstart = tokens.getStartOffset(idx - 1);\n\t\t\t\tend = tokens.getEndOffset(idx - 1);\n\t\t\t} else if (end === offset && idx < tokens.getCount() - 1) {\n\t\t\t\t// trailing token\n\t\t\t\tstart = tokens.getStartOffset(idx + 1);\n\t\t\t\tend = tokens.getEndOffset(idx + 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Range(line, start + 1, line, end + 1);\n\t}\n}\n\nexport function asCommandLink(command: Command): string {\n\treturn URI.from({\n\t\tscheme: Schemas.command,\n\t\tpath: command.id,\n\t\tquery: command.arguments && encodeURIComponent(JSON.stringify(command.arguments))\n\t}).toString();\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancellationError, onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { InlayHint, InlayHintList, InlayHintsProvider, Command } from '../../../common/languages.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { Schemas } from '../../../../base/common/network.js';\nimport { URI } from '../../../../base/common/uri.js';\n\nexport class InlayHintAnchor {\n\tconstructor(readonly range: Range, readonly direction: 'before' | 'after') { }\n}\n\nexport class InlayHintItem {\n\n\tprivate _isResolved: boolean = false;\n\tprivate _currentResolve?: Promise<void>;\n\n\tconstructor(readonly hint: InlayHint, readonly anchor: InlayHintAnchor, readonly provider: InlayHintsProvider) { }\n\n\twith(delta: { anchor: InlayHintAnchor }): InlayHintItem {\n\t\tconst result = new InlayHintItem(this.hint, delta.anchor, this.provider);\n\t\tresult._isResolved = this._isResolved;\n\t\tresult._currentResolve = this._currentResolve;\n\t\treturn result;\n\t}\n\n\tasync resolve(token: CancellationToken): Promise<void> {\n\t\tif (typeof this.provider.resolveInlayHint !== 'function') {\n\t\t\treturn;\n\t\t}\n\t\tif (this._currentResolve) {\n\t\t\t// wait for an active resolve operation and try again\n\t\t\t// when that's done.\n\t\t\tawait this._currentResolve;\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.resolve(token);\n\t\t}\n\t\tif (!this._isResolved) {\n\t\t\tthis._currentResolve = this._doResolve(token)\n\t\t\t\t.finally(() => this._currentResolve = undefined);\n\t\t}\n\t\tawait this._currentResolve;\n\t}\n\n\tprivate async _doResolve(token: CancellationToken) {\n\t\ttry {\n\t\t\tconst newHint = await Promise.resolve(this.provider.resolveInlayHint!(this.hint, token));\n\t\t\tthis.hint.tooltip = newHint?.tooltip ?? this.hint.tooltip;\n\t\t\tthis.hint.label = newHint?.label ?? this.hint.label;\n\t\t\tthis.hint.textEdits = newHint?.textEdits ?? this.hint.textEdits;\n\t\t\tthis._isResolved = true;\n\t\t} catch (err) {\n\t\t\tonUnexpectedExternalError(err);\n\t\t\tthis._isResolved = false;\n\t\t}\n\t}\n}\n\nexport class InlayHintsFragments {\n\n\tprivate static _emptyInlayHintList: InlayHintList = Object.freeze({ dispose() { }, hints: [] });\n\n\tstatic async create(registry: LanguageFeatureRegistry<InlayHintsProvider>, model: ITextModel, ranges: Range[], token: CancellationToken): Promise<InlayHintsFragments> {\n\n\t\tconst data: [InlayHintList, InlayHintsProvider][] = [];\n\n\t\tconst promises = registry.ordered(model).reverse().map(provider => ranges.map(async range => {\n\t\t\ttry {\n\t\t\t\tconst result = await provider.provideInlayHints(model, range, token);\n\t\t\t\tif (result?.hints.length || provider.onDidChangeInlayHints) {\n\t\t\t\t\tdata.push([result ?? InlayHintsFragments._emptyInlayHintList, provider]);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonUnexpectedExternalError(err);\n\t\t\t}\n\t\t}));\n\n\t\tawait Promise.all(promises.flat());\n\n\t\tif (token.isCancellationRequested || model.isDisposed()) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\treturn new InlayHintsFragments(ranges, data, model);\n\t}\n\n\tprivate readonly _disposables = new DisposableStore();\n\n\treadonly items: readonly InlayHintItem[];\n\treadonly ranges: readonly Range[];\n\treadonly provider: Set<InlayHintsProvider>;\n\n\tprivate constructor(ranges: Range[], data: [InlayHintList, InlayHintsProvider][], model: ITextModel) {\n\t\tthis.ranges = ranges;\n\t\tthis.provider = new Set();\n\t\tconst items: InlayHintItem[] = [];\n\t\tfor (const [list, provider] of data) {\n\t\t\tthis._disposables.add(list);\n\t\t\tthis.provider.add(provider);\n\n\t\t\tfor (const hint of list.hints) {\n\t\t\t\t// compute the range to which the item should be attached to\n\t\t\t\tconst position = model.validatePosition(hint.position);\n\t\t\t\tlet direction: 'before' | 'after' = 'before';\n\n\t\t\t\tconst wordRange = InlayHintsFragments._getRangeAtPosition(model, position);\n\t\t\t\tlet range: Range;\n\n\t\t\t\tif (wordRange.getStartPosition().isBefore(position)) {\n\t\t\t\t\trange = Range.fromPositions(wordRange.getStartPosition(), position);\n\t\t\t\t\tdirection = 'after';\n\t\t\t\t} else {\n\t\t\t\t\trange = Range.fromPositions(position, wordRange.getEndPosition());\n\t\t\t\t\tdirection = 'before';\n\t\t\t\t}\n\n\t\t\t\titems.push(new InlayHintItem(hint, new InlayHintAnchor(range, direction), provider));\n\t\t\t}\n\t\t}\n\t\tthis.items = items.sort((a, b) => Position.compare(a.hint.position, b.hint.position));\n\t}\n\n\tdispose(): void {\n\t\tthis._disposables.dispose();\n\t}\n\n\tprivate static _getRangeAtPosition(model: ITextModel, position: IPosition): Range {\n\t\tconst line = position.lineNumber;\n\t\tconst word = model.getWordAtPosition(position);\n\t\tif (word) {\n\t\t\t// always prefer the word range\n\t\t\treturn new Range(line, word.startColumn, line, word.endColumn);\n\t\t}\n\n\t\tmodel.tokenization.tokenizeIfCheap(line);\n\t\tconst tokens = model.tokenization.getLineTokens(line);\n\t\tconst offset = position.column - 1;\n\t\tconst idx = tokens.findTokenIndexAtOffset(offset);\n\n\t\tlet start = tokens.getStartOffset(idx);\n\t\tlet end = tokens.getEndOffset(idx);\n\n\t\tif (end - start === 1) {\n\t\t\t// single character token, when at its end try leading/trailing token instead\n\t\t\tif (start === offset && idx > 1) {\n\t\t\t\t// leading token\n\t\t\t\tstart = tokens.getStartOffset(idx - 1);\n\t\t\t\tend = tokens.getEndOffset(idx - 1);\n\t\t\t} else if (end === offset && idx < tokens.getCount() - 1) {\n\t\t\t\t// trailing token\n\t\t\t\tstart = tokens.getStartOffset(idx + 1);\n\t\t\t\tend = tokens.getEndOffset(idx + 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Range(line, start + 1, line, end + 1);\n\t}\n}\n\nexport function asCommandLink(command: Command): string {\n\treturn URI.from({\n\t\tscheme: Schemas.command,\n\t\tpath: command.id,\n\t\tquery: command.arguments && encodeURIComponent(JSON.stringify(command.arguments))\n\t}).toString();\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlayHints/browser/inlayHints.ts","vs/editor/contrib/inlayHints/browser/inlayHints.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAa,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,OAAO,eAAe;IAC3B,YAAqB,KAAY,EAAW,SAA6B;QAApD,UAAK,GAAL,KAAK,CAAO;QAAW,cAAS,GAAT,SAAS,CAAoB;IAAI,CAAC;CAC9E;AAED,MAAM,OAAO,aAAa;IAKzB,YAAqB,IAAe,EAAW,MAAuB,EAAW,QAA4B;QAAxF,SAAI,GAAJ,IAAI,CAAW;QAAW,WAAM,GAAN,MAAM,CAAiB;QAAW,aAAQ,GAAR,QAAQ,CAAoB;QAHrG,gBAAW,GAAY,KAAK,CAAC;IAG4E,CAAC;IAElH,IAAI,CAA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AAsB,CAAC,MAAM,CAAC,CAAC;QAElD,IAAI,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAEnC,IAAI,GAAG,GAAG,KAAK,KAAK,CAAC,EAAE,CAAC;YACvB,6EAA6E;YAC7E,IAAI,KAAK,KAAK,MAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;gBACjC,gBAAgB;gBAChB,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACvC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC1D,iBAAiB;gBACjB,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACvC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;QACF,CAAC;QAED,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;;AAGF,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC7C,OAAO,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC9E,CAAC","file":"inlayHints.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancellationError, onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { InlayHint, InlayHintList, InlayHintsProvider, Command } from '../../../common/languages.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { createCommandUri } from '../../../../base/common/htmlContent.js';\n\nexport class InlayHintAnchor {\n\tconstructor(readonly range: Range, readonly direction: 'before' | 'after') { }\n}\n\nexport class InlayHintItem {\n\n\tprivate _isResolved: boolean = false;\n\tprivate _currentResolve?: Promise<void>;\n\n\tconstructor(readonly hint: InlayHint, readonly anchor: InlayHintAnchor, readonly provider: InlayHintsProvider) { }\n\n\twith(delta: { anchor: InlayHintAnchor }): InlayHintItem {\n\t\tconst result = new InlayHintItem(this.hint, delta.anchor, this.provider);\n\t\tresult._isResolved = this._isResolved;\n\t\tresult._currentResolve = this._currentResolve;\n\t\treturn result;\n\t}\n\n\tasync resolve(token: CancellationToken): Promise<void> {\n\t\tif (typeof this.provider.resolveInlayHint !== 'function') {\n\t\t\treturn;\n\t\t}\n\t\tif (this._currentResolve) {\n\t\t\t// wait for an active resolve operation and try again\n\t\t\t// when that's done.\n\t\t\tawait this._currentResolve;\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.resolve(token);\n\t\t}\n\t\tif (!this._isResolved) {\n\t\t\tthis._currentResolve = this._doResolve(token)\n\t\t\t\t.finally(() => this._currentResolve = undefined);\n\t\t}\n\t\tawait this._currentResolve;\n\t}\n\n\tprivate async _doResolve(token: CancellationToken) {\n\t\ttry {\n\t\t\tconst newHint = await Promise.resolve(this.provider.resolveInlayHint!(this.hint, token));\n\t\t\tthis.hint.tooltip = newHint?.tooltip ?? this.hint.tooltip;\n\t\t\tthis.hint.label = newHint?.label ?? this.hint.label;\n\t\t\tthis.hint.textEdits = newHint?.textEdits ?? this.hint.textEdits;\n\t\t\tthis._isResolved = true;\n\t\t} catch (err) {\n\t\t\tonUnexpectedExternalError(err);\n\t\t\tthis._isResolved = false;\n\t\t}\n\t}\n}\n\nexport class InlayHintsFragments {\n\n\tprivate static _emptyInlayHintList: InlayHintList = Object.freeze({ dispose() { }, hints: [] });\n\n\tstatic async create(registry: LanguageFeatureRegistry<InlayHintsProvider>, model: ITextModel, ranges: Range[], token: CancellationToken): Promise<InlayHintsFragments> {\n\n\t\tconst data: [InlayHintList, InlayHintsProvider][] = [];\n\n\t\tconst promises = registry.ordered(model).reverse().map(provider => ranges.map(async range => {\n\t\t\ttry {\n\t\t\t\tconst result = await provider.provideInlayHints(model, range, token);\n\t\t\t\tif (result?.hints.length || provider.onDidChangeInlayHints) {\n\t\t\t\t\tdata.push([result ?? InlayHintsFragments._emptyInlayHintList, provider]);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonUnexpectedExternalError(err);\n\t\t\t}\n\t\t}));\n\n\t\tawait Promise.all(promises.flat());\n\n\t\tif (token.isCancellationRequested || model.isDisposed()) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\treturn new InlayHintsFragments(ranges, data, model);\n\t}\n\n\tprivate readonly _disposables = new DisposableStore();\n\n\treadonly items: readonly InlayHintItem[];\n\treadonly ranges: readonly Range[];\n\treadonly provider: Set<InlayHintsProvider>;\n\n\tprivate constructor(ranges: Range[], data: [InlayHintList, InlayHintsProvider][], model: ITextModel) {\n\t\tthis.ranges = ranges;\n\t\tthis.provider = new Set();\n\t\tconst items: InlayHintItem[] = [];\n\t\tfor (const [list, provider] of data) {\n\t\t\tthis._disposables.add(list);\n\t\t\tthis.provider.add(provider);\n\n\t\t\tfor (const hint of list.hints) {\n\t\t\t\t// compute the range to which the item should be attached to\n\t\t\t\tconst position = model.validatePosition(hint.position);\n\t\t\t\tlet direction: 'before' | 'after' = 'before';\n\n\t\t\t\tconst wordRange = InlayHintsFragments._getRangeAtPosition(model, position);\n\t\t\t\tlet range: Range;\n\n\t\t\t\tif (wordRange.getStartPosition().isBefore(position)) {\n\t\t\t\t\trange = Range.fromPositions(wordRange.getStartPosition(), position);\n\t\t\t\t\tdirection = 'after';\n\t\t\t\t} else {\n\t\t\t\t\trange = Range.fromPositions(position, wordRange.getEndPosition());\n\t\t\t\t\tdirection = 'before';\n\t\t\t\t}\n\n\t\t\t\titems.push(new InlayHintItem(hint, new InlayHintAnchor(range, direction), provider));\n\t\t\t}\n\t\t}\n\t\tthis.items = items.sort((a, b) => Position.compare(a.hint.position, b.hint.position));\n\t}\n\n\tdispose(): void {\n\t\tthis._disposables.dispose();\n\t}\n\n\tprivate static _getRangeAtPosition(model: ITextModel, position: IPosition): Range {\n\t\tconst line = position.lineNumber;\n\t\tconst word = model.getWordAtPosition(position);\n\t\tif (word) {\n\t\t\t// always prefer the word range\n\t\t\treturn new Range(line, word.startColumn, line, word.endColumn);\n\t\t}\n\n\t\tmodel.tokenization.tokenizeIfCheap(line);\n\t\tconst tokens = model.tokenization.getLineTokens(line);\n\t\tconst offset = position.column - 1;\n\t\tconst idx = tokens.findTokenIndexAtOffset(offset);\n\n\t\tlet start = tokens.getStartOffset(idx);\n\t\tlet end = tokens.getEndOffset(idx);\n\n\t\tif (end - start === 1) {\n\t\t\t// single character token, when at its end try leading/trailing token instead\n\t\t\tif (start === offset && idx > 1) {\n\t\t\t\t// leading token\n\t\t\t\tstart = tokens.getStartOffset(idx - 1);\n\t\t\t\tend = tokens.getEndOffset(idx - 1);\n\t\t\t} else if (end === offset && idx < tokens.getCount() - 1) {\n\t\t\t\t// trailing token\n\t\t\t\tstart = tokens.getStartOffset(idx + 1);\n\t\t\t\tend = tokens.getEndOffset(idx + 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Range(line, start + 1, line, end + 1);\n\t}\n}\n\nexport function asCommandLink(command: Command): string {\n\treturn createCommandUri(command.id, ...(command.arguments ?? [])).toString();\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancellationError, onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { InlayHint, InlayHintList, InlayHintsProvider, Command } from '../../../common/languages.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { createCommandUri } from '../../../../base/common/htmlContent.js';\n\nexport class InlayHintAnchor {\n\tconstructor(readonly range: Range, readonly direction: 'before' | 'after') { }\n}\n\nexport class InlayHintItem {\n\n\tprivate _isResolved: boolean = false;\n\tprivate _currentResolve?: Promise<void>;\n\n\tconstructor(readonly hint: InlayHint, readonly anchor: InlayHintAnchor, readonly provider: InlayHintsProvider) { }\n\n\twith(delta: { anchor: InlayHintAnchor }): InlayHintItem {\n\t\tconst result = new InlayHintItem(this.hint, delta.anchor, this.provider);\n\t\tresult._isResolved = this._isResolved;\n\t\tresult._currentResolve = this._currentResolve;\n\t\treturn result;\n\t}\n\n\tasync resolve(token: CancellationToken): Promise<void> {\n\t\tif (typeof this.provider.resolveInlayHint !== 'function') {\n\t\t\treturn;\n\t\t}\n\t\tif (this._currentResolve) {\n\t\t\t// wait for an active resolve operation and try again\n\t\t\t// when that's done.\n\t\t\tawait this._currentResolve;\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.resolve(token);\n\t\t}\n\t\tif (!this._isResolved) {\n\t\t\tthis._currentResolve = this._doResolve(token)\n\t\t\t\t.finally(() => this._currentResolve = undefined);\n\t\t}\n\t\tawait this._currentResolve;\n\t}\n\n\tprivate async _doResolve(token: CancellationToken) {\n\t\ttry {\n\t\t\tconst newHint = await Promise.resolve(this.provider.resolveInlayHint!(this.hint, token));\n\t\t\tthis.hint.tooltip = newHint?.tooltip ?? this.hint.tooltip;\n\t\t\tthis.hint.label = newHint?.label ?? this.hint.label;\n\t\t\tthis.hint.textEdits = newHint?.textEdits ?? this.hint.textEdits;\n\t\t\tthis._isResolved = true;\n\t\t} catch (err) {\n\t\t\tonUnexpectedExternalError(err);\n\t\t\tthis._isResolved = false;\n\t\t}\n\t}\n}\n\nexport class InlayHintsFragments {\n\n\tprivate static _emptyInlayHintList: InlayHintList = Object.freeze({ dispose() { }, hints: [] });\n\n\tstatic async create(registry: LanguageFeatureRegistry<InlayHintsProvider>, model: ITextModel, ranges: Range[], token: CancellationToken): Promise<InlayHintsFragments> {\n\n\t\tconst data: [InlayHintList, InlayHintsProvider][] = [];\n\n\t\tconst promises = registry.ordered(model).reverse().map(provider => ranges.map(async range => {\n\t\t\ttry {\n\t\t\t\tconst result = await provider.provideInlayHints(model, range, token);\n\t\t\t\tif (result?.hints.length || provider.onDidChangeInlayHints) {\n\t\t\t\t\tdata.push([result ?? InlayHintsFragments._emptyInlayHintList, provider]);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonUnexpectedExternalError(err);\n\t\t\t}\n\t\t}));\n\n\t\tawait Promise.all(promises.flat());\n\n\t\tif (token.isCancellationRequested || model.isDisposed()) {\n\t\t\tthrow new CancellationError();\n\t\t}\n\n\t\treturn new InlayHintsFragments(ranges, data, model);\n\t}\n\n\tprivate readonly _disposables = new DisposableStore();\n\n\treadonly items: readonly InlayHintItem[];\n\treadonly ranges: readonly Range[];\n\treadonly provider: Set<InlayHintsProvider>;\n\n\tprivate constructor(ranges: Range[], data: [InlayHintList, InlayHintsProvider][], model: ITextModel) {\n\t\tthis.ranges = ranges;\n\t\tthis.provider = new Set();\n\t\tconst items: InlayHintItem[] = [];\n\t\tfor (const [list, provider] of data) {\n\t\t\tthis._disposables.add(list);\n\t\t\tthis.provider.add(provider);\n\n\t\t\tfor (const hint of list.hints) {\n\t\t\t\t// compute the range to which the item should be attached to\n\t\t\t\tconst position = model.validatePosition(hint.position);\n\t\t\t\tlet direction: 'before' | 'after' = 'before';\n\n\t\t\t\tconst wordRange = InlayHintsFragments._getRangeAtPosition(model, position);\n\t\t\t\tlet range: Range;\n\n\t\t\t\tif (wordRange.getStartPosition().isBefore(position)) {\n\t\t\t\t\trange = Range.fromPositions(wordRange.getStartPosition(), position);\n\t\t\t\t\tdirection = 'after';\n\t\t\t\t} else {\n\t\t\t\t\trange = Range.fromPositions(position, wordRange.getEndPosition());\n\t\t\t\t\tdirection = 'before';\n\t\t\t\t}\n\n\t\t\t\titems.push(new InlayHintItem(hint, new InlayHintAnchor(range, direction), provider));\n\t\t\t}\n\t\t}\n\t\tthis.items = items.sort((a, b) => Position.compare(a.hint.position, b.hint.position));\n\t}\n\n\tdispose(): void {\n\t\tthis._disposables.dispose();\n\t}\n\n\tprivate static _getRangeAtPosition(model: ITextModel, position: IPosition): Range {\n\t\tconst line = position.lineNumber;\n\t\tconst word = model.getWordAtPosition(position);\n\t\tif (word) {\n\t\t\t// always prefer the word range\n\t\t\treturn new Range(line, word.startColumn, line, word.endColumn);\n\t\t}\n\n\t\tmodel.tokenization.tokenizeIfCheap(line);\n\t\tconst tokens = model.tokenization.getLineTokens(line);\n\t\tconst offset = position.column - 1;\n\t\tconst idx = tokens.findTokenIndexAtOffset(offset);\n\n\t\tlet start = tokens.getStartOffset(idx);\n\t\tlet end = tokens.getEndOffset(idx);\n\n\t\tif (end - start === 1) {\n\t\t\t// single character token, when at its end try leading/trailing token instead\n\t\t\tif (start === offset && idx > 1) {\n\t\t\t\t// leading token\n\t\t\t\tstart = tokens.getStartOffset(idx - 1);\n\t\t\t\tend = tokens.getEndOffset(idx - 1);\n\t\t\t} else if (end === offset && idx < tokens.getCount() - 1) {\n\t\t\t\t// trailing token\n\t\t\t\tstart = tokens.getStartOffset(idx + 1);\n\t\t\t\tend = tokens.getEndOffset(idx + 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Range(line, start + 1, line, end + 1);\n\t}\n}\n\nexport function asCommandLink(command: Command): string {\n\treturn createCommandUri(command.id, ...(command.arguments ?? [])).toString();\n}\n"]}
@@ -13,7 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  import { RunOnceScheduler } from '../../../../base/common/async.js';
15
15
  import { Codicon } from '../../../../base/common/codicons.js';
16
- import { MarkdownString } from '../../../../base/common/htmlContent.js';
16
+ import { createCommandUri, MarkdownString } from '../../../../base/common/htmlContent.js';
17
17
  import { Disposable } from '../../../../base/common/lifecycle.js';
18
18
  import * as platform from '../../../../base/common/platform.js';
19
19
  import { InvisibleCharacters, isBasicASCII } from '../../../../base/common/strings.js';
@@ -396,7 +396,7 @@ let UnicodeHighlighterHoverParticipant = class UnicodeHighlighterHoverParticipan
396
396
  inString: highlightInfo.inString,
397
397
  };
398
398
  const adjustSettings = nls.localize(1527, 'Adjust settings');
399
- const uri = `command:${ShowExcludeOptions.ID}?${encodeURIComponent(JSON.stringify(adjustSettingsArgs))}`;
399
+ const uri = createCommandUri(ShowExcludeOptions.ID, adjustSettingsArgs);
400
400
  const markdown = new MarkdownString('', true)
401
401
  .appendMarkdown(reason)
402
402
  .appendText(' ')
@@ -1 +1 @@
1
- {"version":3,"sources":["vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,m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BAA2C,EAAE,OAAiB;IAC9G,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAC,0BAA0B,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC;IAE1G,IAAI,KAA8B,CAAC;IACnC,IAAI,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC;QAC1D,iDAAiD;QACjD,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAoB,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,MAAM,oBAAoB,CAAC,WAAW,CAAC,0BAA0B,CAAC,cAAc,EAAE,KAAK,mCAA2B,CAAC;AACpH,CAAC;AAED,SAAS,WAAW,CAAC,KAAY;IAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,eAAe,CAAC,8CAA8C,CAAC,CAAC;AAChE,eAAe,CAAC,8CAA8C,CAAC,CAAC;AAChE,eAAe,CAAC,kDAAkD,CAAC,CAAC;AACpE,eAAe,CAAC,kBAAkB,CAAC,CAAC;AACpC,0BAA0B,CAAC,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,2DAAmD,CAAC;AACxH,wBAAwB,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC","file":"unicodeHighlighter.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { CharCode } from '../../../../base/common/charCode.js';\nimport { Codicon } from '../../../../base/common/codicons.js';\nimport { MarkdownString } from '../../../../base/common/htmlContent.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport { InvisibleCharacters, isBasicASCII } from '../../../../base/common/strings.js';\nimport './unicodeHighlighter.css';\nimport { IActiveCodeEditor, ICodeEditor } from '../../../browser/editorBrowser.js';\nimport { EditorAction, EditorContributionInstantiation, registerEditorContribution, ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { InUntrustedWorkspace, inUntrustedWorkspace, EditorOption, InternalUnicodeHighlightOptions, unicodeHighlightConfigKeys } from '../../../common/config/editorOptions.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\nimport { IModelDecoration, IModelDeltaDecoration, ITextModel, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { UnicodeHighlighterOptions, UnicodeHighlighterReason, UnicodeHighlighterReasonKind, UnicodeTextModelHighlighter } from '../../../common/services/unicodeTextModelHighlighter.js';\nimport { IEditorWorkerService, IUnicodeHighlightsResult } from '../../../common/services/editorWorker.js';\nimport { ILanguageService } from '../../../common/languages/language.js';\nimport { HoverAnchor, HoverAnchorType, HoverParticipantRegistry, IEditorHoverParticipant, IEditorHoverRenderContext, IRenderedHoverParts } from '../../hover/browser/hoverTypes.js';\nimport { MarkdownHover, renderMarkdownHovers } from '../../hover/browser/markdownHoverParticipant.js';\nimport { BannerController } from './bannerController.js';\nimport * as nls from '../../../../nls.js';\nimport { ConfigurationTarget, IConfigurationService } from '../../../../platform/configuration/common/configuration.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IOpenerService } from '../../../../platform/opener/common/opener.js';\nimport { IQuickInputService, IQuickPickItem } from '../../../../platform/quickinput/common/quickInput.js';\nimport { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';\nimport { IWorkspaceTrustManagementService } from '../../../../platform/workspace/common/workspaceTrust.js';\nimport { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';\nimport { safeIntl } from '../../../../base/common/date.js';\nimport { isModelDecorationInComment, isModelDecorationInString, isModelDecorationVisible } from '../../../common/viewModel/viewModelDecoration.js';\n\nexport const warningIcon = registerIcon('extensions-warning-message', Codicon.warning, nls.localize('warningIcon', 'Icon shown with a warning message in the extensions editor.'));\n\nexport class UnicodeHighlighter extends Disposable implements IEditorContribution {\n\tpublic static readonly ID = 'editor.contrib.unicodeHighlighter';\n\n\tprivate _highlighter: DocumentUnicodeHighlighter | ViewportUnicodeHighlighter | null = null;\n\tprivate _options: InternalUnicodeHighlightOptions;\n\n\tprivate readonly _bannerController: BannerController;\n\tprivate _bannerClosed: boolean = false;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService,\n\t\t@IWorkspaceTrustManagementService private readonly _workspaceTrustService: IWorkspaceTrustManagementService,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._bannerController = this._register(instantiationService.createInstance(BannerController, _editor));\n\n\t\tthis._register(this._editor.onDidChangeModel(() => {\n\t\t\tthis._bannerClosed = false;\n\t\t\tthis._updateHighlighter();\n\t\t}));\n\n\t\tthis._options = _editor.getOption(EditorOption.unicodeHighlighting);\n\n\t\tthis._register(_workspaceTrustService.onDidChangeTrust(e => {\n\t\t\tthis._updateHighlighter();\n\t\t}));\n\n\t\tthis._register(_editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(EditorOption.unicodeHighlighting)) {\n\t\t\t\tthis._options = _editor.getOption(EditorOption.unicodeHighlighting);\n\t\t\t\tthis._updateHighlighter();\n\t\t\t}\n\t\t}));\n\n\t\tthis._updateHighlighter();\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._highlighter) {\n\t\t\tthis._highlighter.dispose();\n\t\t\tthis._highlighter = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tprivate readonly _updateState = (state: IUnicodeHighlightsResult | null): void => {\n\t\tif (state && state.hasMore) {\n\t\t\tif (this._bannerClosed) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// This document contains many non-basic ASCII characters.\n\t\t\tconst max = Math.max(state.ambiguousCharacterCount, state.nonBasicAsciiCharacterCount, state.invisibleCharacterCount);\n\n\t\t\tlet data;\n\t\t\tif (state.nonBasicAsciiCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters', 'This document contains many non-basic ASCII unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfNonBasicAsciiCharactersAction(),\n\t\t\t\t};\n\t\t\t} else if (state.ambiguousCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters', 'This document contains many ambiguous unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfAmbiguousCharactersAction(),\n\t\t\t\t};\n\t\t\t} else if (state.invisibleCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters', 'This document contains many invisible unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfInvisibleCharactersAction(),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tthrow new Error('Unreachable');\n\t\t\t}\n\n\t\t\tthis._bannerController.show({\n\t\t\t\tid: 'unicodeHighlightBanner',\n\t\t\t\tmessage: data.message,\n\t\t\t\ticon: warningIcon,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: data.command.shortLabel,\n\t\t\t\t\t\thref: `command:${data.command.desc.id}`\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tonClose: () => {\n\t\t\t\t\tthis._bannerClosed = true;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthis._bannerController.hide();\n\t\t}\n\t};\n\n\tprivate _updateHighlighter(): void {\n\t\tthis._updateState(null);\n\n\t\tif (this._highlighter) {\n\t\t\tthis._highlighter.dispose();\n\t\t\tthis._highlighter = null;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\treturn;\n\t\t}\n\t\tconst options = resolveOptions(this._workspaceTrustService.isWorkspaceTrusted(), this._options);\n\n\t\tif (\n\t\t\t[\n\t\t\t\toptions.nonBasicASCII,\n\t\t\t\toptions.ambiguousCharacters,\n\t\t\t\toptions.invisibleCharacters,\n\t\t\t].every((option) => option === false)\n\t\t) {\n\t\t\t// Don't do anything if the feature is fully disabled\n\t\t\treturn;\n\t\t}\n\n\t\tconst highlightOptions: UnicodeHighlighterOptions = {\n\t\t\tnonBasicASCII: options.nonBasicASCII,\n\t\t\tambiguousCharacters: options.ambiguousCharacters,\n\t\t\tinvisibleCharacters: options.invisibleCharacters,\n\t\t\tincludeComments: options.includeComments,\n\t\t\tincludeStrings: options.includeStrings,\n\t\t\tallowedCodePoints: Object.keys(options.allowedCharacters).map(c => c.codePointAt(0)!),\n\t\t\tallowedLocales: Object.keys(options.allowedLocales).map(locale => {\n\t\t\t\tif (locale === '_os') {\n\t\t\t\t\tconst osLocale = safeIntl.NumberFormat().value.resolvedOptions().locale;\n\t\t\t\t\treturn osLocale;\n\t\t\t\t} else if (locale === '_vscode') {\n\t\t\t\t\treturn platform.language;\n\t\t\t\t}\n\t\t\t\treturn locale;\n\t\t\t}),\n\t\t};\n\n\t\tif (this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)) {\n\t\t\tthis._highlighter = new DocumentUnicodeHighlighter(this._editor, highlightOptions, this._updateState, this._editorWorkerService);\n\t\t} else {\n\t\t\tthis._highlighter = new ViewportUnicodeHighlighter(this._editor, highlightOptions, this._updateState);\n\t\t}\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (this._highlighter) {\n\t\t\treturn this._highlighter.getDecorationInfo(decoration);\n\t\t}\n\t\treturn null;\n\t}\n}\n\nexport interface UnicodeHighlighterDecorationInfo {\n\treason: UnicodeHighlighterReason;\n\tinComment: boolean;\n\tinString: boolean;\n}\n\ntype Resolve<T> =\n\tT extends InUntrustedWorkspace ? never\n\t: T extends 'auto' ? never : T;\n\ntype ResolvedOptions = { [TKey in keyof InternalUnicodeHighlightOptions]: Resolve<InternalUnicodeHighlightOptions[TKey]> };\n\nfunction resolveOptions(trusted: boolean, options: InternalUnicodeHighlightOptions): ResolvedOptions {\n\treturn {\n\t\tnonBasicASCII: options.nonBasicASCII === inUntrustedWorkspace ? !trusted : options.nonBasicASCII,\n\t\tambiguousCharacters: options.ambiguousCharacters,\n\t\tinvisibleCharacters: options.invisibleCharacters,\n\t\tincludeComments: options.includeComments === inUntrustedWorkspace ? !trusted : options.includeComments,\n\t\tincludeStrings: options.includeStrings === inUntrustedWorkspace ? !trusted : options.includeStrings,\n\t\tallowedCharacters: options.allowedCharacters,\n\t\tallowedLocales: options.allowedLocales,\n\t};\n}\n\nclass DocumentUnicodeHighlighter extends Disposable {\n\tprivate readonly _model: ITextModel;\n\tprivate readonly _updateSoon: RunOnceScheduler;\n\tprivate _decorations;\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tprivate readonly _options: UnicodeHighlighterOptions,\n\t\tprivate readonly _updateState: (state: IUnicodeHighlightsResult | null) => void,\n\t\t@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._model = this._editor.getModel();\n\t\tthis._decorations = this._editor.createDecorationsCollection();\n\t\tthis._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250));\n\n\t\tthis._register(this._editor.onDidChangeModelContent(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\n\t\tthis._updateSoon.schedule();\n\t}\n\n\tpublic override dispose() {\n\t\tthis._decorations.clear();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _update(): void {\n\t\tif (this._model.isDisposed()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._model.mightContainNonBasicASCII()) {\n\t\t\tthis._decorations.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst modelVersionId = this._model.getVersionId();\n\t\tthis._editorWorkerService\n\t\t\t.computedUnicodeHighlights(this._model.uri, this._options)\n\t\t\t.then((info) => {\n\t\t\t\tif (this._model.isDisposed()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this._model.getVersionId() !== modelVersionId) {\n\t\t\t\t\t// model changed in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._updateState(info);\n\n\t\t\t\tconst decorations: IModelDeltaDecoration[] = [];\n\t\t\t\tif (!info.hasMore) {\n\t\t\t\t\t// Don't show decoration if there are too many.\n\t\t\t\t\t// In this case, a banner is shown.\n\t\t\t\t\tfor (const range of info.ranges) {\n\t\t\t\t\t\tdecorations.push({\n\t\t\t\t\t\t\trange: range,\n\t\t\t\t\t\t\toptions: Decorations.instance.getDecorationFromOptions(this._options),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis._decorations.set(decorations);\n\t\t\t});\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (!this._decorations.has(decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst model = this._editor.getModel();\n\t\tif (\n\t\t\t!isModelDecorationVisible(model, decoration)\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tconst text = model.getValueInRange(decoration.range);\n\t\treturn {\n\t\t\treason: computeReason(text, this._options)!,\n\t\t\tinComment: isModelDecorationInComment(model, decoration),\n\t\t\tinString: isModelDecorationInString(model, decoration),\n\t\t};\n\t}\n}\n\nclass ViewportUnicodeHighlighter extends Disposable {\n\n\tprivate readonly _model: ITextModel;\n\tprivate readonly _updateSoon: RunOnceScheduler;\n\tprivate readonly _decorations;\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tprivate readonly _options: UnicodeHighlighterOptions,\n\t\tprivate readonly _updateState: (state: IUnicodeHighlightsResult | null) => void,\n\t) {\n\t\tsuper();\n\t\tthis._model = this._editor.getModel();\n\t\tthis._decorations = this._editor.createDecorationsCollection();\n\n\t\tthis._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250));\n\n\t\tthis._register(this._editor.onDidLayoutChange(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidScrollChange(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeHiddenAreas(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\n\t\tthis._updateSoon.schedule();\n\t}\n\n\tpublic override dispose() {\n\t\tthis._decorations.clear();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _update(): void {\n\t\tif (this._model.isDisposed()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._model.mightContainNonBasicASCII()) {\n\t\t\tthis._decorations.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst ranges = this._editor.getVisibleRanges();\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\t\tconst totalResult: IUnicodeHighlightsResult = {\n\t\t\tranges: [],\n\t\t\tambiguousCharacterCount: 0,\n\t\t\tinvisibleCharacterCount: 0,\n\t\t\tnonBasicAsciiCharacterCount: 0,\n\t\t\thasMore: false,\n\t\t};\n\t\tfor (const range of ranges) {\n\t\t\tconst result = UnicodeTextModelHighlighter.computeUnicodeHighlights(this._model, this._options, range);\n\t\t\tfor (const r of result.ranges) {\n\t\t\t\ttotalResult.ranges.push(r);\n\t\t\t}\n\t\t\ttotalResult.ambiguousCharacterCount += totalResult.ambiguousCharacterCount;\n\t\t\ttotalResult.invisibleCharacterCount += totalResult.invisibleCharacterCount;\n\t\t\ttotalResult.nonBasicAsciiCharacterCount += totalResult.nonBasicAsciiCharacterCount;\n\t\t\ttotalResult.hasMore = totalResult.hasMore || result.hasMore;\n\t\t}\n\n\t\tif (!totalResult.hasMore) {\n\t\t\t// Don't show decorations if there are too many.\n\t\t\t// A banner will be shown instead.\n\t\t\tfor (const range of totalResult.ranges) {\n\t\t\t\tdecorations.push({ range, options: Decorations.instance.getDecorationFromOptions(this._options) });\n\t\t\t}\n\t\t}\n\t\tthis._updateState(totalResult);\n\n\t\tthis._decorations.set(decorations);\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (!this._decorations.has(decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst model = this._editor.getModel();\n\t\tconst text = model.getValueInRange(decoration.range);\n\t\tif (!isModelDecorationVisible(model, decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn {\n\t\t\treason: computeReason(text, this._options)!,\n\t\t\tinComment: isModelDecorationInComment(model, decoration),\n\t\t\tinString: isModelDecorationInString(model, decoration),\n\t\t};\n\t}\n}\n\nconst configureUnicodeHighlightOptionsStr = nls.localize('unicodeHighlight.configureUnicodeHighlightOptions', 'Configure Unicode Highlight Options');\n\nexport class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipant<MarkdownHover> {\n\n\tpublic readonly hoverOrdinal: number = 5;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IOpenerService private readonly _openerService: IOpenerService,\n\t) {\n\t}\n\n\tcomputeSync(anchor: HoverAnchor, lineDecorations: IModelDecoration[]): MarkdownHover[] {\n\t\tif (!this._editor.hasModel() || anchor.type !== HoverAnchorType.Range) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\n\t\tconst unicodeHighlighter = this._editor.getContribution<UnicodeHighlighter>(UnicodeHighlighter.ID);\n\t\tif (!unicodeHighlighter) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst result: MarkdownHover[] = [];\n\t\tconst existedReason = new Set<string>();\n\t\tlet index = 300;\n\t\tfor (const d of lineDecorations) {\n\n\t\t\tconst highlightInfo = unicodeHighlighter.getDecorationInfo(d);\n\t\t\tif (!highlightInfo) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst char = model.getValueInRange(d.range);\n\t\t\t// text refers to a single character.\n\t\t\tconst codePoint = char.codePointAt(0)!;\n\n\t\t\tconst codePointStr = formatCodePointMarkdown(codePoint);\n\n\t\t\tlet reason: string;\n\t\t\tswitch (highlightInfo.reason.kind) {\n\t\t\t\tcase UnicodeHighlighterReasonKind.Ambiguous: {\n\t\t\t\t\tif (isBasicASCII(highlightInfo.reason.confusableWith)) {\n\t\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t\t'unicodeHighlight.characterIsAmbiguousASCII',\n\t\t\t\t\t\t\t'The character {0} could be confused with the ASCII character {1}, which is more common in source code.',\n\t\t\t\t\t\t\tcodePointStr,\n\t\t\t\t\t\t\tformatCodePointMarkdown(highlightInfo.reason.confusableWith.codePointAt(0)!)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t\t'unicodeHighlight.characterIsAmbiguous',\n\t\t\t\t\t\t\t'The character {0} could be confused with the character {1}, which is more common in source code.',\n\t\t\t\t\t\t\tcodePointStr,\n\t\t\t\t\t\t\tformatCodePointMarkdown(highlightInfo.reason.confusableWith.codePointAt(0)!)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase UnicodeHighlighterReasonKind.Invisible:\n\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t'unicodeHighlight.characterIsInvisible',\n\t\t\t\t\t\t'The character {0} is invisible.',\n\t\t\t\t\t\tcodePointStr\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase UnicodeHighlighterReasonKind.NonBasicAscii:\n\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t'unicodeHighlight.characterIsNonBasicAscii',\n\t\t\t\t\t\t'The character {0} is not a basic ASCII character.',\n\t\t\t\t\t\tcodePointStr\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (existedReason.has(reason)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\texistedReason.add(reason);\n\n\t\t\tconst adjustSettingsArgs: ShowExcludeOptionsArgs = {\n\t\t\t\tcodePoint: codePoint,\n\t\t\t\treason: highlightInfo.reason,\n\t\t\t\tinComment: highlightInfo.inComment,\n\t\t\t\tinString: highlightInfo.inString,\n\t\t\t};\n\n\t\t\tconst adjustSettings = nls.localize('unicodeHighlight.adjustSettings', 'Adjust settings');\n\t\t\tconst uri = `command:${ShowExcludeOptions.ID}?${encodeURIComponent(JSON.stringify(adjustSettingsArgs))}`;\n\t\t\tconst markdown = new MarkdownString('', true)\n\t\t\t\t.appendMarkdown(reason)\n\t\t\t\t.appendText(' ')\n\t\t\t\t.appendLink(uri, adjustSettings, configureUnicodeHighlightOptionsStr);\n\t\t\tresult.push(new MarkdownHover(this, d.range, [markdown], false, index++));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic renderHoverParts(context: IEditorHoverRenderContext, hoverParts: MarkdownHover[]): IRenderedHoverParts<MarkdownHover> {\n\t\treturn renderMarkdownHovers(context, hoverParts, this._editor, this._languageService, this._openerService);\n\t}\n}\n\nfunction codePointToHex(codePoint: number): string {\n\treturn `U+${codePoint.toString(16).padStart(4, '0')}`;\n}\n\nfunction formatCodePointMarkdown(codePoint: number) {\n\tlet value = `\\`${codePointToHex(codePoint)}\\``;\n\tif (!InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n\t\t// Don't render any control characters or any invisible characters, as they cannot be seen anyways.\n\t\tvalue += ` \"${`${renderCodePointAsInlineCode(codePoint)}`}\"`;\n\t}\n\treturn value;\n}\n\nfunction renderCodePointAsInlineCode(codePoint: number): string {\n\tif (codePoint === CharCode.BackTick) {\n\t\treturn '`` ` ``';\n\t}\n\treturn '`' + String.fromCodePoint(codePoint) + '`';\n}\n\nfunction computeReason(char: string, options: UnicodeHighlighterOptions): UnicodeHighlighterReason | null {\n\treturn UnicodeTextModelHighlighter.computeUnicodeHighlightReason(char, options);\n}\n\nclass Decorations {\n\tpublic static readonly instance = new Decorations();\n\n\tprivate readonly map = new Map<string, ModelDecorationOptions>();\n\n\tgetDecorationFromOptions(options: UnicodeHighlighterOptions): ModelDecorationOptions {\n\t\treturn this.getDecoration(!options.includeComments, !options.includeStrings);\n\t}\n\n\tprivate getDecoration(hideInComments: boolean, hideInStrings: boolean): ModelDecorationOptions {\n\t\tconst key = `${hideInComments}${hideInStrings}`;\n\t\tlet options = this.map.get(key);\n\t\tif (!options) {\n\t\t\toptions = ModelDecorationOptions.createDynamic({\n\t\t\t\tdescription: 'unicode-highlight',\n\t\t\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\t\t\tclassName: 'unicode-highlight',\n\t\t\t\tshowIfCollapsed: true,\n\t\t\t\toverviewRuler: null,\n\t\t\t\tminimap: null,\n\t\t\t\thideInCommentTokens: hideInComments,\n\t\t\t\thideInStringTokens: hideInStrings,\n\t\t\t});\n\t\t\tthis.map.set(key, options);\n\t\t}\n\t\treturn options;\n\t}\n}\n\ninterface IDisableUnicodeHighlightAction {\n}\n\nexport class DisableHighlightingInCommentsAction extends EditorAction implements IDisableUnicodeHighlightAction {\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingInComments.shortLabel', 'Disable Highlight In Comments');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\tlabel: nls.localize2('action.unicodeHighlight.disableHighlightingInComments', \"Disable highlighting of characters in comments\"),\n\t\t\tprecondition: undefined\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.includeComments, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingInStringsAction extends EditorAction implements IDisableUnicodeHighlightAction {\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingInStrings.shortLabel', 'Disable Highlight In Strings');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\tlabel: nls.localize2('action.unicodeHighlight.disableHighlightingInStrings', \"Disable highlighting of characters in strings\"),\n\t\t\tprecondition: undefined\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.includeStrings, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfAmbiguousCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel', 'Disable Ambiguous Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters', \"Disable highlighting of ambiguous characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.ambiguousCharacters, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfInvisibleCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel', 'Disable Invisible Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfInvisibleCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfInvisibleCharacters', \"Disable highlighting of invisible characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.invisibleCharacters, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfNonBasicAsciiCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel', 'Disable Non ASCII Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfNonBasicAsciiCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters', \"Disable highlighting of non basic ASCII characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.nonBasicASCII, false, ConfigurationTarget.USER);\n\t}\n}\n\ninterface ShowExcludeOptionsArgs {\n\tcodePoint: number;\n\treason: UnicodeHighlighterReason;\n\tinComment: boolean;\n\tinString: boolean;\n}\n\nexport class ShowExcludeOptions extends Action2 {\n\tpublic static ID = 'editor.action.unicodeHighlight.showExcludeOptions';\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: ShowExcludeOptions.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.showExcludeOptions', \"Show Exclude Options\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, args: any): Promise<void> {\n\t\tconst { codePoint, reason, inString, inComment } = args as ShowExcludeOptionsArgs;\n\n\t\tconst char = String.fromCodePoint(codePoint);\n\n\t\tconst quickPickService = accessor.get(IQuickInputService);\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\n\t\tinterface ExtendedOptions extends IQuickPickItem {\n\t\t\trun(): Promise<void>;\n\t\t}\n\n\t\tfunction getExcludeCharFromBeingHighlightedLabel(codePoint: number) {\n\t\t\tif (InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n\t\t\t\treturn nls.localize('unicodeHighlight.excludeInvisibleCharFromBeingHighlighted', 'Exclude {0} (invisible character) from being highlighted', codePointToHex(codePoint));\n\t\t\t}\n\t\t\treturn nls.localize('unicodeHighlight.excludeCharFromBeingHighlighted', 'Exclude {0} from being highlighted', `${codePointToHex(codePoint)} \"${char}\"`);\n\t\t}\n\n\t\tconst options: ExtendedOptions[] = [];\n\n\t\tif (reason.kind === UnicodeHighlighterReasonKind.Ambiguous) {\n\t\t\tfor (const locale of reason.notAmbiguousInLocales) {\n\t\t\t\toptions.push({\n\t\t\t\t\tlabel: nls.localize(\"unicodeHighlight.allowCommonCharactersInLanguage\", \"Allow unicode characters that are more common in the language \\\"{0}\\\".\", locale),\n\t\t\t\t\trun: async () => {\n\t\t\t\t\t\texcludeLocaleFromBeingHighlighted(configurationService, [locale]);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\toptions.push(\n\t\t\t{\n\t\t\t\tlabel: getExcludeCharFromBeingHighlightedLabel(codePoint),\n\t\t\t\trun: () => excludeCharFromBeingHighlighted(configurationService, [codePoint])\n\t\t\t}\n\t\t);\n\n\t\tif (inComment) {\n\t\t\tconst action = new DisableHighlightingInCommentsAction();\n\t\t\toptions.push({ label: action.label, run: async () => action.runAction(configurationService) });\n\t\t} else if (inString) {\n\t\t\tconst action = new DisableHighlightingInStringsAction();\n\t\t\toptions.push({ label: action.label, run: async () => action.runAction(configurationService) });\n\t\t}\n\n\t\tfunction getTitle(options: Action2) {\n\t\t\treturn typeof options.desc.title === 'string' ? options.desc.title : options.desc.title.value;\n\t\t}\n\n\t\tif (reason.kind === UnicodeHighlighterReasonKind.Ambiguous) {\n\t\t\tconst action = new DisableHighlightingOfAmbiguousCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else if (reason.kind === UnicodeHighlighterReasonKind.Invisible) {\n\t\t\tconst action = new DisableHighlightingOfInvisibleCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else if (reason.kind === UnicodeHighlighterReasonKind.NonBasicAscii) {\n\t\t\tconst action = new DisableHighlightingOfNonBasicAsciiCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else {\n\t\t\texpectNever(reason);\n\t\t}\n\n\t\tconst result = await quickPickService.pick(\n\t\t\toptions,\n\t\t\t{ title: configureUnicodeHighlightOptionsStr }\n\t\t);\n\n\t\tif (result) {\n\t\t\tawait result.run();\n\t\t}\n\t}\n}\n\nasync function excludeCharFromBeingHighlighted(configurationService: IConfigurationService, charCodes: number[]) {\n\tconst existingValue = configurationService.getValue(unicodeHighlightConfigKeys.allowedCharacters);\n\n\tlet value: Record<string, boolean>;\n\tif ((typeof existingValue === 'object') && existingValue) {\n\t\tvalue = existingValue as any;\n\t} else {\n\t\tvalue = {};\n\t}\n\n\tfor (const charCode of charCodes) {\n\t\tvalue[String.fromCodePoint(charCode)] = true;\n\t}\n\n\tawait configurationService.updateValue(unicodeHighlightConfigKeys.allowedCharacters, value, ConfigurationTarget.USER);\n}\n\nasync function excludeLocaleFromBeingHighlighted(configurationService: IConfigurationService, locales: string[]) {\n\tconst existingValue = configurationService.inspect(unicodeHighlightConfigKeys.allowedLocales).user?.value;\n\n\tlet value: Record<string, boolean>;\n\tif ((typeof existingValue === 'object') && existingValue) {\n\t\t// Copy value, as the existing value is read only\n\t\tvalue = Object.assign({}, existingValue as any);\n\t} else {\n\t\tvalue = {};\n\t}\n\n\tfor (const locale of locales) {\n\t\tvalue[locale] = true;\n\t}\n\n\tawait configurationService.updateValue(unicodeHighlightConfigKeys.allowedLocales, value, ConfigurationTarget.USER);\n}\n\nfunction expectNever(value: never) {\n\tthrow new Error(`Unexpected value: ${value}`);\n}\n\nregisterAction2(DisableHighlightingOfAmbiguousCharactersAction);\nregisterAction2(DisableHighlightingOfInvisibleCharactersAction);\nregisterAction2(DisableHighlightingOfNonBasicAsciiCharactersAction);\nregisterAction2(ShowExcludeOptions);\nregisterEditorContribution(UnicodeHighlighter.ID, UnicodeHighlighter, EditorContributionInstantiation.AfterFirstRender);\nHoverParticipantRegistry.register(UnicodeHighlighterHoverParticipant);\n"]}
1
+ {"version":3,"sources":["vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,KAAK,QAAQ,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,EAAmC,0BAA0B,EAAoB,MAAM,sCAAsC,CAAC;AACnJ,OAAO,EAAwB,oBAAoB,EAAiD,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAGhL,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAqF,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACzL,OAAO,EAAE,oBAAoB,EAA4B,MAAM,0CAA0C,CAAC;AAC1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAgC,wBAAwB,EAA2E,MAAM,mCAAmC,CAAC;AACpL,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAuB,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,8CA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C,CAAC;AACpC,0BAA0B,CAAC,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,2DAAmD,CAAC;AACxH,wBAAwB,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC","file":"unicodeHighlighter.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { CharCode } from '../../../../base/common/charCode.js';\nimport { Codicon } from '../../../../base/common/codicons.js';\nimport { createCommandUri, MarkdownString } from '../../../../base/common/htmlContent.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport { InvisibleCharacters, isBasicASCII } from '../../../../base/common/strings.js';\nimport './unicodeHighlighter.css';\nimport { IActiveCodeEditor, ICodeEditor } from '../../../browser/editorBrowser.js';\nimport { EditorAction, EditorContributionInstantiation, registerEditorContribution, ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { InUntrustedWorkspace, inUntrustedWorkspace, EditorOption, InternalUnicodeHighlightOptions, unicodeHighlightConfigKeys } from '../../../common/config/editorOptions.js';\nimport { IEditorContribution } from '../../../common/editorCommon.js';\nimport { IModelDecoration, IModelDeltaDecoration, ITextModel, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { UnicodeHighlighterOptions, UnicodeHighlighterReason, UnicodeHighlighterReasonKind, UnicodeTextModelHighlighter } from '../../../common/services/unicodeTextModelHighlighter.js';\nimport { IEditorWorkerService, IUnicodeHighlightsResult } from '../../../common/services/editorWorker.js';\nimport { ILanguageService } from '../../../common/languages/language.js';\nimport { HoverAnchor, HoverAnchorType, HoverParticipantRegistry, IEditorHoverParticipant, IEditorHoverRenderContext, IRenderedHoverParts } from '../../hover/browser/hoverTypes.js';\nimport { MarkdownHover, renderMarkdownHovers } from '../../hover/browser/markdownHoverParticipant.js';\nimport { BannerController } from './bannerController.js';\nimport * as nls from '../../../../nls.js';\nimport { ConfigurationTarget, IConfigurationService } from '../../../../platform/configuration/common/configuration.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IOpenerService } from '../../../../platform/opener/common/opener.js';\nimport { IQuickInputService, IQuickPickItem } from '../../../../platform/quickinput/common/quickInput.js';\nimport { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';\nimport { IWorkspaceTrustManagementService } from '../../../../platform/workspace/common/workspaceTrust.js';\nimport { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';\nimport { safeIntl } from '../../../../base/common/date.js';\nimport { isModelDecorationInComment, isModelDecorationInString, isModelDecorationVisible } from '../../../common/viewModel/viewModelDecoration.js';\n\nexport const warningIcon = registerIcon('extensions-warning-message', Codicon.warning, nls.localize('warningIcon', 'Icon shown with a warning message in the extensions editor.'));\n\nexport class UnicodeHighlighter extends Disposable implements IEditorContribution {\n\tpublic static readonly ID = 'editor.contrib.unicodeHighlighter';\n\n\tprivate _highlighter: DocumentUnicodeHighlighter | ViewportUnicodeHighlighter | null = null;\n\tprivate _options: InternalUnicodeHighlightOptions;\n\n\tprivate readonly _bannerController: BannerController;\n\tprivate _bannerClosed: boolean = false;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService,\n\t\t@IWorkspaceTrustManagementService private readonly _workspaceTrustService: IWorkspaceTrustManagementService,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._bannerController = this._register(instantiationService.createInstance(BannerController, _editor));\n\n\t\tthis._register(this._editor.onDidChangeModel(() => {\n\t\t\tthis._bannerClosed = false;\n\t\t\tthis._updateHighlighter();\n\t\t}));\n\n\t\tthis._options = _editor.getOption(EditorOption.unicodeHighlighting);\n\n\t\tthis._register(_workspaceTrustService.onDidChangeTrust(e => {\n\t\t\tthis._updateHighlighter();\n\t\t}));\n\n\t\tthis._register(_editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(EditorOption.unicodeHighlighting)) {\n\t\t\t\tthis._options = _editor.getOption(EditorOption.unicodeHighlighting);\n\t\t\t\tthis._updateHighlighter();\n\t\t\t}\n\t\t}));\n\n\t\tthis._updateHighlighter();\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._highlighter) {\n\t\t\tthis._highlighter.dispose();\n\t\t\tthis._highlighter = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tprivate readonly _updateState = (state: IUnicodeHighlightsResult | null): void => {\n\t\tif (state && state.hasMore) {\n\t\t\tif (this._bannerClosed) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// This document contains many non-basic ASCII characters.\n\t\t\tconst max = Math.max(state.ambiguousCharacterCount, state.nonBasicAsciiCharacterCount, state.invisibleCharacterCount);\n\n\t\t\tlet data;\n\t\t\tif (state.nonBasicAsciiCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters', 'This document contains many non-basic ASCII unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfNonBasicAsciiCharactersAction(),\n\t\t\t\t};\n\t\t\t} else if (state.ambiguousCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters', 'This document contains many ambiguous unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfAmbiguousCharactersAction(),\n\t\t\t\t};\n\t\t\t} else if (state.invisibleCharacterCount >= max) {\n\t\t\t\tdata = {\n\t\t\t\t\tmessage: nls.localize('unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters', 'This document contains many invisible unicode characters'),\n\t\t\t\t\tcommand: new DisableHighlightingOfInvisibleCharactersAction(),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tthrow new Error('Unreachable');\n\t\t\t}\n\n\t\t\tthis._bannerController.show({\n\t\t\t\tid: 'unicodeHighlightBanner',\n\t\t\t\tmessage: data.message,\n\t\t\t\ticon: warningIcon,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: data.command.shortLabel,\n\t\t\t\t\t\thref: `command:${data.command.desc.id}`\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tonClose: () => {\n\t\t\t\t\tthis._bannerClosed = true;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tthis._bannerController.hide();\n\t\t}\n\t};\n\n\tprivate _updateHighlighter(): void {\n\t\tthis._updateState(null);\n\n\t\tif (this._highlighter) {\n\t\t\tthis._highlighter.dispose();\n\t\t\tthis._highlighter = null;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\treturn;\n\t\t}\n\t\tconst options = resolveOptions(this._workspaceTrustService.isWorkspaceTrusted(), this._options);\n\n\t\tif (\n\t\t\t[\n\t\t\t\toptions.nonBasicASCII,\n\t\t\t\toptions.ambiguousCharacters,\n\t\t\t\toptions.invisibleCharacters,\n\t\t\t].every((option) => option === false)\n\t\t) {\n\t\t\t// Don't do anything if the feature is fully disabled\n\t\t\treturn;\n\t\t}\n\n\t\tconst highlightOptions: UnicodeHighlighterOptions = {\n\t\t\tnonBasicASCII: options.nonBasicASCII,\n\t\t\tambiguousCharacters: options.ambiguousCharacters,\n\t\t\tinvisibleCharacters: options.invisibleCharacters,\n\t\t\tincludeComments: options.includeComments,\n\t\t\tincludeStrings: options.includeStrings,\n\t\t\tallowedCodePoints: Object.keys(options.allowedCharacters).map(c => c.codePointAt(0)!),\n\t\t\tallowedLocales: Object.keys(options.allowedLocales).map(locale => {\n\t\t\t\tif (locale === '_os') {\n\t\t\t\t\tconst osLocale = safeIntl.NumberFormat().value.resolvedOptions().locale;\n\t\t\t\t\treturn osLocale;\n\t\t\t\t} else if (locale === '_vscode') {\n\t\t\t\t\treturn platform.language;\n\t\t\t\t}\n\t\t\t\treturn locale;\n\t\t\t}),\n\t\t};\n\n\t\tif (this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)) {\n\t\t\tthis._highlighter = new DocumentUnicodeHighlighter(this._editor, highlightOptions, this._updateState, this._editorWorkerService);\n\t\t} else {\n\t\t\tthis._highlighter = new ViewportUnicodeHighlighter(this._editor, highlightOptions, this._updateState);\n\t\t}\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (this._highlighter) {\n\t\t\treturn this._highlighter.getDecorationInfo(decoration);\n\t\t}\n\t\treturn null;\n\t}\n}\n\nexport interface UnicodeHighlighterDecorationInfo {\n\treason: UnicodeHighlighterReason;\n\tinComment: boolean;\n\tinString: boolean;\n}\n\ntype Resolve<T> =\n\tT extends InUntrustedWorkspace ? never\n\t: T extends 'auto' ? never : T;\n\ntype ResolvedOptions = { [TKey in keyof InternalUnicodeHighlightOptions]: Resolve<InternalUnicodeHighlightOptions[TKey]> };\n\nfunction resolveOptions(trusted: boolean, options: InternalUnicodeHighlightOptions): ResolvedOptions {\n\treturn {\n\t\tnonBasicASCII: options.nonBasicASCII === inUntrustedWorkspace ? !trusted : options.nonBasicASCII,\n\t\tambiguousCharacters: options.ambiguousCharacters,\n\t\tinvisibleCharacters: options.invisibleCharacters,\n\t\tincludeComments: options.includeComments === inUntrustedWorkspace ? !trusted : options.includeComments,\n\t\tincludeStrings: options.includeStrings === inUntrustedWorkspace ? !trusted : options.includeStrings,\n\t\tallowedCharacters: options.allowedCharacters,\n\t\tallowedLocales: options.allowedLocales,\n\t};\n}\n\nclass DocumentUnicodeHighlighter extends Disposable {\n\tprivate readonly _model: ITextModel;\n\tprivate readonly _updateSoon: RunOnceScheduler;\n\tprivate _decorations;\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tprivate readonly _options: UnicodeHighlighterOptions,\n\t\tprivate readonly _updateState: (state: IUnicodeHighlightsResult | null) => void,\n\t\t@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._model = this._editor.getModel();\n\t\tthis._decorations = this._editor.createDecorationsCollection();\n\t\tthis._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250));\n\n\t\tthis._register(this._editor.onDidChangeModelContent(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\n\t\tthis._updateSoon.schedule();\n\t}\n\n\tpublic override dispose() {\n\t\tthis._decorations.clear();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _update(): void {\n\t\tif (this._model.isDisposed()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._model.mightContainNonBasicASCII()) {\n\t\t\tthis._decorations.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst modelVersionId = this._model.getVersionId();\n\t\tthis._editorWorkerService\n\t\t\t.computedUnicodeHighlights(this._model.uri, this._options)\n\t\t\t.then((info) => {\n\t\t\t\tif (this._model.isDisposed()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this._model.getVersionId() !== modelVersionId) {\n\t\t\t\t\t// model changed in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._updateState(info);\n\n\t\t\t\tconst decorations: IModelDeltaDecoration[] = [];\n\t\t\t\tif (!info.hasMore) {\n\t\t\t\t\t// Don't show decoration if there are too many.\n\t\t\t\t\t// In this case, a banner is shown.\n\t\t\t\t\tfor (const range of info.ranges) {\n\t\t\t\t\t\tdecorations.push({\n\t\t\t\t\t\t\trange: range,\n\t\t\t\t\t\t\toptions: Decorations.instance.getDecorationFromOptions(this._options),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis._decorations.set(decorations);\n\t\t\t});\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (!this._decorations.has(decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst model = this._editor.getModel();\n\t\tif (\n\t\t\t!isModelDecorationVisible(model, decoration)\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tconst text = model.getValueInRange(decoration.range);\n\t\treturn {\n\t\t\treason: computeReason(text, this._options)!,\n\t\t\tinComment: isModelDecorationInComment(model, decoration),\n\t\t\tinString: isModelDecorationInString(model, decoration),\n\t\t};\n\t}\n}\n\nclass ViewportUnicodeHighlighter extends Disposable {\n\n\tprivate readonly _model: ITextModel;\n\tprivate readonly _updateSoon: RunOnceScheduler;\n\tprivate readonly _decorations;\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tprivate readonly _options: UnicodeHighlighterOptions,\n\t\tprivate readonly _updateState: (state: IUnicodeHighlightsResult | null) => void,\n\t) {\n\t\tsuper();\n\t\tthis._model = this._editor.getModel();\n\t\tthis._decorations = this._editor.createDecorationsCollection();\n\n\t\tthis._updateSoon = this._register(new RunOnceScheduler(() => this._update(), 250));\n\n\t\tthis._register(this._editor.onDidLayoutChange(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidScrollChange(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeHiddenAreas(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => {\n\t\t\tthis._updateSoon.schedule();\n\t\t}));\n\n\t\tthis._updateSoon.schedule();\n\t}\n\n\tpublic override dispose() {\n\t\tthis._decorations.clear();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _update(): void {\n\t\tif (this._model.isDisposed()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._model.mightContainNonBasicASCII()) {\n\t\t\tthis._decorations.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst ranges = this._editor.getVisibleRanges();\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\t\tconst totalResult: IUnicodeHighlightsResult = {\n\t\t\tranges: [],\n\t\t\tambiguousCharacterCount: 0,\n\t\t\tinvisibleCharacterCount: 0,\n\t\t\tnonBasicAsciiCharacterCount: 0,\n\t\t\thasMore: false,\n\t\t};\n\t\tfor (const range of ranges) {\n\t\t\tconst result = UnicodeTextModelHighlighter.computeUnicodeHighlights(this._model, this._options, range);\n\t\t\tfor (const r of result.ranges) {\n\t\t\t\ttotalResult.ranges.push(r);\n\t\t\t}\n\t\t\ttotalResult.ambiguousCharacterCount += totalResult.ambiguousCharacterCount;\n\t\t\ttotalResult.invisibleCharacterCount += totalResult.invisibleCharacterCount;\n\t\t\ttotalResult.nonBasicAsciiCharacterCount += totalResult.nonBasicAsciiCharacterCount;\n\t\t\ttotalResult.hasMore = totalResult.hasMore || result.hasMore;\n\t\t}\n\n\t\tif (!totalResult.hasMore) {\n\t\t\t// Don't show decorations if there are too many.\n\t\t\t// A banner will be shown instead.\n\t\t\tfor (const range of totalResult.ranges) {\n\t\t\t\tdecorations.push({ range, options: Decorations.instance.getDecorationFromOptions(this._options) });\n\t\t\t}\n\t\t}\n\t\tthis._updateState(totalResult);\n\n\t\tthis._decorations.set(decorations);\n\t}\n\n\tpublic getDecorationInfo(decoration: IModelDecoration): UnicodeHighlighterDecorationInfo | null {\n\t\tif (!this._decorations.has(decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst model = this._editor.getModel();\n\t\tconst text = model.getValueInRange(decoration.range);\n\t\tif (!isModelDecorationVisible(model, decoration)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn {\n\t\t\treason: computeReason(text, this._options)!,\n\t\t\tinComment: isModelDecorationInComment(model, decoration),\n\t\t\tinString: isModelDecorationInString(model, decoration),\n\t\t};\n\t}\n}\n\nconst configureUnicodeHighlightOptionsStr = nls.localize('unicodeHighlight.configureUnicodeHighlightOptions', 'Configure Unicode Highlight Options');\n\nexport class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipant<MarkdownHover> {\n\n\tpublic readonly hoverOrdinal: number = 5;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IOpenerService private readonly _openerService: IOpenerService,\n\t) {\n\t}\n\n\tcomputeSync(anchor: HoverAnchor, lineDecorations: IModelDecoration[]): MarkdownHover[] {\n\t\tif (!this._editor.hasModel() || anchor.type !== HoverAnchorType.Range) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\n\t\tconst unicodeHighlighter = this._editor.getContribution<UnicodeHighlighter>(UnicodeHighlighter.ID);\n\t\tif (!unicodeHighlighter) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst result: MarkdownHover[] = [];\n\t\tconst existedReason = new Set<string>();\n\t\tlet index = 300;\n\t\tfor (const d of lineDecorations) {\n\n\t\t\tconst highlightInfo = unicodeHighlighter.getDecorationInfo(d);\n\t\t\tif (!highlightInfo) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst char = model.getValueInRange(d.range);\n\t\t\t// text refers to a single character.\n\t\t\tconst codePoint = char.codePointAt(0)!;\n\n\t\t\tconst codePointStr = formatCodePointMarkdown(codePoint);\n\n\t\t\tlet reason: string;\n\t\t\tswitch (highlightInfo.reason.kind) {\n\t\t\t\tcase UnicodeHighlighterReasonKind.Ambiguous: {\n\t\t\t\t\tif (isBasicASCII(highlightInfo.reason.confusableWith)) {\n\t\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t\t'unicodeHighlight.characterIsAmbiguousASCII',\n\t\t\t\t\t\t\t'The character {0} could be confused with the ASCII character {1}, which is more common in source code.',\n\t\t\t\t\t\t\tcodePointStr,\n\t\t\t\t\t\t\tformatCodePointMarkdown(highlightInfo.reason.confusableWith.codePointAt(0)!)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t\t'unicodeHighlight.characterIsAmbiguous',\n\t\t\t\t\t\t\t'The character {0} could be confused with the character {1}, which is more common in source code.',\n\t\t\t\t\t\t\tcodePointStr,\n\t\t\t\t\t\t\tformatCodePointMarkdown(highlightInfo.reason.confusableWith.codePointAt(0)!)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase UnicodeHighlighterReasonKind.Invisible:\n\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t'unicodeHighlight.characterIsInvisible',\n\t\t\t\t\t\t'The character {0} is invisible.',\n\t\t\t\t\t\tcodePointStr\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase UnicodeHighlighterReasonKind.NonBasicAscii:\n\t\t\t\t\treason = nls.localize(\n\t\t\t\t\t\t'unicodeHighlight.characterIsNonBasicAscii',\n\t\t\t\t\t\t'The character {0} is not a basic ASCII character.',\n\t\t\t\t\t\tcodePointStr\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (existedReason.has(reason)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\texistedReason.add(reason);\n\n\t\t\tconst adjustSettingsArgs: ShowExcludeOptionsArgs = {\n\t\t\t\tcodePoint: codePoint,\n\t\t\t\treason: highlightInfo.reason,\n\t\t\t\tinComment: highlightInfo.inComment,\n\t\t\t\tinString: highlightInfo.inString,\n\t\t\t};\n\n\t\t\tconst adjustSettings = nls.localize('unicodeHighlight.adjustSettings', 'Adjust settings');\n\t\t\tconst uri = createCommandUri(ShowExcludeOptions.ID, adjustSettingsArgs);\n\t\t\tconst markdown = new MarkdownString('', true)\n\t\t\t\t.appendMarkdown(reason)\n\t\t\t\t.appendText(' ')\n\t\t\t\t.appendLink(uri, adjustSettings, configureUnicodeHighlightOptionsStr);\n\t\t\tresult.push(new MarkdownHover(this, d.range, [markdown], false, index++));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic renderHoverParts(context: IEditorHoverRenderContext, hoverParts: MarkdownHover[]): IRenderedHoverParts<MarkdownHover> {\n\t\treturn renderMarkdownHovers(context, hoverParts, this._editor, this._languageService, this._openerService);\n\t}\n}\n\nfunction codePointToHex(codePoint: number): string {\n\treturn `U+${codePoint.toString(16).padStart(4, '0')}`;\n}\n\nfunction formatCodePointMarkdown(codePoint: number) {\n\tlet value = `\\`${codePointToHex(codePoint)}\\``;\n\tif (!InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n\t\t// Don't render any control characters or any invisible characters, as they cannot be seen anyways.\n\t\tvalue += ` \"${`${renderCodePointAsInlineCode(codePoint)}`}\"`;\n\t}\n\treturn value;\n}\n\nfunction renderCodePointAsInlineCode(codePoint: number): string {\n\tif (codePoint === CharCode.BackTick) {\n\t\treturn '`` ` ``';\n\t}\n\treturn '`' + String.fromCodePoint(codePoint) + '`';\n}\n\nfunction computeReason(char: string, options: UnicodeHighlighterOptions): UnicodeHighlighterReason | null {\n\treturn UnicodeTextModelHighlighter.computeUnicodeHighlightReason(char, options);\n}\n\nclass Decorations {\n\tpublic static readonly instance = new Decorations();\n\n\tprivate readonly map = new Map<string, ModelDecorationOptions>();\n\n\tgetDecorationFromOptions(options: UnicodeHighlighterOptions): ModelDecorationOptions {\n\t\treturn this.getDecoration(!options.includeComments, !options.includeStrings);\n\t}\n\n\tprivate getDecoration(hideInComments: boolean, hideInStrings: boolean): ModelDecorationOptions {\n\t\tconst key = `${hideInComments}${hideInStrings}`;\n\t\tlet options = this.map.get(key);\n\t\tif (!options) {\n\t\t\toptions = ModelDecorationOptions.createDynamic({\n\t\t\t\tdescription: 'unicode-highlight',\n\t\t\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\t\t\tclassName: 'unicode-highlight',\n\t\t\t\tshowIfCollapsed: true,\n\t\t\t\toverviewRuler: null,\n\t\t\t\tminimap: null,\n\t\t\t\thideInCommentTokens: hideInComments,\n\t\t\t\thideInStringTokens: hideInStrings,\n\t\t\t});\n\t\t\tthis.map.set(key, options);\n\t\t}\n\t\treturn options;\n\t}\n}\n\ninterface IDisableUnicodeHighlightAction {\n}\n\nexport class DisableHighlightingInCommentsAction extends EditorAction implements IDisableUnicodeHighlightAction {\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingInComments.shortLabel', 'Disable Highlight In Comments');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\tlabel: nls.localize2('action.unicodeHighlight.disableHighlightingInComments', \"Disable highlighting of characters in comments\"),\n\t\t\tprecondition: undefined\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.includeComments, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingInStringsAction extends EditorAction implements IDisableUnicodeHighlightAction {\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingInStrings.shortLabel', 'Disable Highlight In Strings');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\tlabel: nls.localize2('action.unicodeHighlight.disableHighlightingInStrings', \"Disable highlighting of characters in strings\"),\n\t\t\tprecondition: undefined\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.includeStrings, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfAmbiguousCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel', 'Disable Ambiguous Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfAmbiguousCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters', \"Disable highlighting of ambiguous characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.ambiguousCharacters, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfInvisibleCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel', 'Disable Invisible Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfInvisibleCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfInvisibleCharacters', \"Disable highlighting of invisible characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.invisibleCharacters, false, ConfigurationTarget.USER);\n\t}\n}\n\nexport class DisableHighlightingOfNonBasicAsciiCharactersAction extends Action2 implements IDisableUnicodeHighlightAction {\n\tpublic static ID = 'editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters';\n\tpublic readonly shortLabel = nls.localize('unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel', 'Disable Non ASCII Highlight');\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: DisableHighlightingOfNonBasicAsciiCharactersAction.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters', \"Disable highlighting of non basic ASCII characters\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): Promise<void> {\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\t\tif (configurationService) {\n\t\t\tthis.runAction(configurationService);\n\t\t}\n\t}\n\n\tpublic async runAction(configurationService: IConfigurationService): Promise<void> {\n\t\tawait configurationService.updateValue(unicodeHighlightConfigKeys.nonBasicASCII, false, ConfigurationTarget.USER);\n\t}\n}\n\ninterface ShowExcludeOptionsArgs {\n\tcodePoint: number;\n\treason: UnicodeHighlighterReason;\n\tinComment: boolean;\n\tinString: boolean;\n}\n\nexport class ShowExcludeOptions extends Action2 {\n\tpublic static ID = 'editor.action.unicodeHighlight.showExcludeOptions';\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: ShowExcludeOptions.ID,\n\t\t\ttitle: nls.localize2('action.unicodeHighlight.showExcludeOptions', \"Show Exclude Options\"),\n\t\t\tprecondition: undefined,\n\t\t\tf1: false,\n\t\t});\n\t}\n\n\tpublic async run(accessor: ServicesAccessor, args: any): Promise<void> {\n\t\tconst { codePoint, reason, inString, inComment } = args as ShowExcludeOptionsArgs;\n\n\t\tconst char = String.fromCodePoint(codePoint);\n\n\t\tconst quickPickService = accessor.get(IQuickInputService);\n\t\tconst configurationService = accessor.get(IConfigurationService);\n\n\t\tinterface ExtendedOptions extends IQuickPickItem {\n\t\t\trun(): Promise<void>;\n\t\t}\n\n\t\tfunction getExcludeCharFromBeingHighlightedLabel(codePoint: number) {\n\t\t\tif (InvisibleCharacters.isInvisibleCharacter(codePoint)) {\n\t\t\t\treturn nls.localize('unicodeHighlight.excludeInvisibleCharFromBeingHighlighted', 'Exclude {0} (invisible character) from being highlighted', codePointToHex(codePoint));\n\t\t\t}\n\t\t\treturn nls.localize('unicodeHighlight.excludeCharFromBeingHighlighted', 'Exclude {0} from being highlighted', `${codePointToHex(codePoint)} \"${char}\"`);\n\t\t}\n\n\t\tconst options: ExtendedOptions[] = [];\n\n\t\tif (reason.kind === UnicodeHighlighterReasonKind.Ambiguous) {\n\t\t\tfor (const locale of reason.notAmbiguousInLocales) {\n\t\t\t\toptions.push({\n\t\t\t\t\tlabel: nls.localize(\"unicodeHighlight.allowCommonCharactersInLanguage\", \"Allow unicode characters that are more common in the language \\\"{0}\\\".\", locale),\n\t\t\t\t\trun: async () => {\n\t\t\t\t\t\texcludeLocaleFromBeingHighlighted(configurationService, [locale]);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\toptions.push(\n\t\t\t{\n\t\t\t\tlabel: getExcludeCharFromBeingHighlightedLabel(codePoint),\n\t\t\t\trun: () => excludeCharFromBeingHighlighted(configurationService, [codePoint])\n\t\t\t}\n\t\t);\n\n\t\tif (inComment) {\n\t\t\tconst action = new DisableHighlightingInCommentsAction();\n\t\t\toptions.push({ label: action.label, run: async () => action.runAction(configurationService) });\n\t\t} else if (inString) {\n\t\t\tconst action = new DisableHighlightingInStringsAction();\n\t\t\toptions.push({ label: action.label, run: async () => action.runAction(configurationService) });\n\t\t}\n\n\t\tfunction getTitle(options: Action2) {\n\t\t\treturn typeof options.desc.title === 'string' ? options.desc.title : options.desc.title.value;\n\t\t}\n\n\t\tif (reason.kind === UnicodeHighlighterReasonKind.Ambiguous) {\n\t\t\tconst action = new DisableHighlightingOfAmbiguousCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else if (reason.kind === UnicodeHighlighterReasonKind.Invisible) {\n\t\t\tconst action = new DisableHighlightingOfInvisibleCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else if (reason.kind === UnicodeHighlighterReasonKind.NonBasicAscii) {\n\t\t\tconst action = new DisableHighlightingOfNonBasicAsciiCharactersAction();\n\t\t\toptions.push({ label: getTitle(action), run: async () => action.runAction(configurationService) });\n\t\t} else {\n\t\t\texpectNever(reason);\n\t\t}\n\n\t\tconst result = await quickPickService.pick(\n\t\t\toptions,\n\t\t\t{ title: configureUnicodeHighlightOptionsStr }\n\t\t);\n\n\t\tif (result) {\n\t\t\tawait result.run();\n\t\t}\n\t}\n}\n\nasync function excludeCharFromBeingHighlighted(configurationService: IConfigurationService, charCodes: number[]) {\n\tconst existingValue = configurationService.getValue(unicodeHighlightConfigKeys.allowedCharacters);\n\n\tlet value: Record<string, boolean>;\n\tif ((typeof existingValue === 'object') && existingValue) {\n\t\tvalue = existingValue as any;\n\t} else {\n\t\tvalue = {};\n\t}\n\n\tfor (const charCode of charCodes) {\n\t\tvalue[String.fromCodePoint(charCode)] = true;\n\t}\n\n\tawait configurationService.updateValue(unicodeHighlightConfigKeys.allowedCharacters, value, ConfigurationTarget.USER);\n}\n\nasync function excludeLocaleFromBeingHighlighted(configurationService: IConfigurationService, locales: string[]) {\n\tconst existingValue = configurationService.inspect(unicodeHighlightConfigKeys.allowedLocales).user?.value;\n\n\tlet value: Record<string, boolean>;\n\tif ((typeof existingValue === 'object') && existingValue) {\n\t\t// Copy value, as the existing value is read only\n\t\tvalue = Object.assign({}, existingValue as any);\n\t} else {\n\t\tvalue = {};\n\t}\n\n\tfor (const locale of locales) {\n\t\tvalue[locale] = true;\n\t}\n\n\tawait configurationService.updateValue(unicodeHighlightConfigKeys.allowedLocales, value, ConfigurationTarget.USER);\n}\n\nfunction expectNever(value: never) {\n\tthrow new Error(`Unexpected value: ${value}`);\n}\n\nregisterAction2(DisableHighlightingOfAmbiguousCharactersAction);\nregisterAction2(DisableHighlightingOfInvisibleCharactersAction);\nregisterAction2(DisableHighlightingOfNonBasicAsciiCharactersAction);\nregisterAction2(ShowExcludeOptions);\nregisterEditorContribution(UnicodeHighlighter.ID, UnicodeHighlighter, EditorContributionInstantiation.AfterFirstRender);\nHoverParticipantRegistry.register(UnicodeHighlighterHoverParticipant);\n"]}
@@ -11,9 +11,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- import { PauseableEmitter } from '../../../base/common/event.js';
14
+ import { Event, PauseableEmitter } from '../../../base/common/event.js';
15
15
  import { Iterable } from '../../../base/common/iterator.js';
16
- import { Disposable, MutableDisposable } from '../../../base/common/lifecycle.js';
16
+ import { Disposable, DisposableStore, MutableDisposable } from '../../../base/common/lifecycle.js';
17
17
  import { cloneAndChange } from '../../../base/common/objects.js';
18
18
  import { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';
19
19
  import { URI } from '../../../base/common/uri.js';
@@ -21,6 +21,9 @@ import { localize } from '../../../nls.js';
21
21
  import { CommandsRegistry } from '../../commands/common/commands.js';
22
22
  import { IConfigurationService } from '../../configuration/common/configuration.js';
23
23
  import { IContextKeyService, RawContextKey } from '../common/contextkey.js';
24
+ import { InputFocusedContext } from '../common/contextkeys.js';
25
+ import { mainWindow } from '../../../base/browser/window.js';
26
+ import { addDisposableListener, EventType, getActiveWindow, isEditableElement, onDidRegisterWindow, trackFocus } from '../../../base/browser/dom.js';
24
27
  const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';
25
28
  export class Context {
26
29
  constructor(id, parent) {
@@ -289,6 +292,7 @@ let ContextKeyService = class ContextKeyService extends AbstractContextKeyServic
289
292
  super(0);
290
293
  this._contexts = new Map();
291
294
  this._lastContextId = 0;
295
+ this.inputFocusedContext = InputFocusedContext.bindTo(this);
292
296
  const myContext = this._register(new ConfigAwareContextValuesContainer(this._myContextId, configurationService, this._onDidChangeContext));
293
297
  this._contexts.set(this._myContextId, myContext);
294
298
  // Uncomment this to see the contexts continuously logged
@@ -301,6 +305,36 @@ let ContextKeyService = class ContextKeyService extends AbstractContextKeyServic
301
305
  // console.log(lastLoggedValue);
302
306
  // }
303
307
  // }, 2000);
308
+ this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => {
309
+ const onFocusDisposables = disposables.add(new MutableDisposable());
310
+ disposables.add(addDisposableListener(window, EventType.FOCUS_IN, () => {
311
+ onFocusDisposables.value = new DisposableStore();
312
+ this.updateInputContextKeys(window.document, onFocusDisposables.value);
313
+ }, true));
314
+ }, { window: mainWindow, disposables: this._store }));
315
+ }
316
+ updateInputContextKeys(ownerDocument, disposables) {
317
+ function activeElementIsInput() {
318
+ return !!ownerDocument.activeElement && isEditableElement(ownerDocument.activeElement);
319
+ }
320
+ const isInputFocused = activeElementIsInput();
321
+ this.inputFocusedContext.set(isInputFocused);
322
+ if (isInputFocused) {
323
+ const tracker = disposables.add(trackFocus(ownerDocument.activeElement));
324
+ Event.once(tracker.onDidBlur)(() => {
325
+ // Ensure we are only updating the context key if we are
326
+ // still in the same document that we are tracking. This
327
+ // fixes a race condition in multi-window setups where
328
+ // the blur event arrives in the inactive window overwriting
329
+ // the context key of the active window. This is because
330
+ // blur events from the focus tracker are emitted with a
331
+ // timeout of 0.
332
+ if (getActiveWindow().document === ownerDocument) {
333
+ this.inputFocusedContext.set(activeElementIsInput());
334
+ }
335
+ tracker.dispose();
336
+ }, undefined, disposables);
337
+ }
304
338
  }
305
339
  getContextValuesContainer(contextId) {
306
340
  if (this._isDisposed) {
@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G,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5E,CAAC;IACD,QAAQ,EAAE;QACT,WAAW,EAAE,QAAQ,CAAC,IAAmB,EAAE,uDAAuD,CAAC;QACnG,IAAI,EAAE,EAAE;KACR;CACD,CAAC,CAAC;AAEH,gBAAgB,CAAC,eAAe,CAAC,yBAAyB,EAAE;IAC3D,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,GAAG,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC","file":"contextKeyService.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, PauseableEmitter } from '../../../base/common/event.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { Disposable, IDisposable, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { MarshalledObject } from '../../../base/common/marshalling.js';\nimport { MarshalledId } from '../../../base/common/marshallingIds.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { CommandsRegistry } from '../../commands/common/commands.js';\nimport { ConfigurationTarget, IConfigurationService } from '../../configuration/common/configuration.js';\nimport { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, IScopedContextKeyService, RawContextKey } from '../common/contextkey.js';\nimport { ServicesAccessor } from '../../instantiation/common/instantiation.js';\n\nconst KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';\n\nexport class Context implements IContext {\n\n\tprotected _parent: Context | null;\n\tprotected _value: Record<string, any>;\n\tprotected _id: number;\n\n\tconstructor(id: number, parent: Context | null) {\n\t\tthis._id = id;\n\t\tthis._parent = parent;\n\t\tthis._value = Object.create(null);\n\t\tthis._value['_contextId'] = id;\n\t}\n\n\tpublic get value(): Record<string, any> {\n\t\treturn { ...this._value };\n\t}\n\n\tpublic setValue(key: string, value: any): boolean {\n\t\t// console.log('SET ' + key + ' = ' + value + ' ON ' + this._id);\n\t\tif (this._value[key] !== value) {\n\t\t\tthis._value[key] = value;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic removeValue(key: string): boolean {\n\t\t// console.log('REMOVE ' + key + ' FROM ' + this._id);\n\t\tif (key in this._value) {\n\t\t\tdelete this._value[key];\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic getValue<T>(key: string): T | undefined {\n\t\tconst ret = this._value[key];\n\t\tif (typeof ret === 'undefined' && this._parent) {\n\t\t\treturn this._parent.getValue<T>(key);\n\t\t}\n\t\treturn ret;\n\t}\n}\n\nclass NullContext extends Context {\n\n\tstatic readonly INSTANCE = new NullContext();\n\n\tconstructor() {\n\t\tsuper(-1, null);\n\t}\n\n\tpublic override setValue(key: string, value: any): boolean {\n\t\treturn false;\n\t}\n\n\tpublic override removeValue(key: string): boolean {\n\t\treturn false;\n\t}\n\n\tpublic override getValue<T>(key: string): T | undefined {\n\t\treturn undefined;\n\t}\n}\n\nclass ConfigAwareContextValuesContainer extends Context {\n\tprivate static readonly _keyPrefix = 'config.';\n\n\tprivate readonly _values = TernarySearchTree.forConfigKeys<any>();\n\tprivate readonly _listener: IDisposable;\n\n\tconstructor(\n\t\tid: number,\n\t\tprivate readonly _configurationService: IConfigurationService,\n\t\temitter: Emitter<IContextKeyChangeEvent>\n\t) {\n\t\tsuper(id, null);\n\n\t\tthis._listener = this._configurationService.onDidChangeConfiguration(event => {\n\t\t\tif (event.source === ConfigurationTarget.DEFAULT) {\n\t\t\t\t// new setting, reset everything\n\t\t\t\tconst allKeys = Array.from(this._values, ([k]) => k);\n\t\t\t\tthis._values.clear();\n\t\t\t\temitter.fire(new ArrayContextKeyChangeEvent(allKeys));\n\t\t\t} else {\n\t\t\t\tconst changedKeys: string[] = [];\n\t\t\t\tfor (const configKey of event.affectedKeys) {\n\t\t\t\t\tconst contextKey = `config.${configKey}`;\n\n\t\t\t\t\tconst cachedItems = this._values.findSuperstr(contextKey);\n\t\t\t\t\tif (cachedItems !== undefined) {\n\t\t\t\t\t\tchangedKeys.push(...Iterable.map(cachedItems, ([key]) => key));\n\t\t\t\t\t\tthis._values.deleteSuperstr(contextKey);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this._values.has(contextKey)) {\n\t\t\t\t\t\tchangedKeys.push(contextKey);\n\t\t\t\t\t\tthis._values.delete(contextKey);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\temitter.fire(new ArrayContextKeyChangeEvent(changedKeys));\n\t\t\t}\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis._listener.dispose();\n\t}\n\n\toverride getValue(key: string): any {\n\n\t\tif (key.indexOf(ConfigAwareContextValuesContainer._keyPrefix) !== 0) {\n\t\t\treturn super.getValue(key);\n\t\t}\n\n\t\tif (this._values.has(key)) {\n\t\t\treturn this._values.get(key);\n\t\t}\n\n\t\tconst configKey = key.substr(ConfigAwareContextValuesContainer._keyPrefix.length);\n\t\tconst configValue = this._configurationService.getValue(configKey);\n\t\tlet value: any = undefined;\n\t\tswitch (typeof configValue) {\n\t\t\tcase 'number':\n\t\t\tcase 'boolean':\n\t\t\tcase 'string':\n\t\t\t\tvalue = configValue;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (Array.isArray(configValue)) {\n\t\t\t\t\tvalue = JSON.stringify(configValue);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = configValue;\n\t\t\t\t}\n\t\t}\n\n\t\tthis._values.set(key, value);\n\t\treturn value;\n\t}\n\n\toverride setValue(key: string, value: any): boolean {\n\t\treturn super.setValue(key, value);\n\t}\n\n\toverride removeValue(key: string): boolean {\n\t\treturn super.removeValue(key);\n\t}\n}\n\nclass ContextKey<T extends ContextKeyValue> implements IContextKey<T> {\n\n\tprivate _service: AbstractContextKeyService;\n\tprivate _key: string;\n\tprivate _defaultValue: T | undefined;\n\n\tconstructor(service: AbstractContextKeyService, key: string, defaultValue: T | undefined) {\n\t\tthis._service = service;\n\t\tthis._key = key;\n\t\tthis._defaultValue = defaultValue;\n\t\tthis.reset();\n\t}\n\n\tpublic set(value: T): void {\n\t\tthis._service.setContext(this._key, value);\n\t}\n\n\tpublic reset(): void {\n\t\tif (typeof this._defaultValue === 'undefined') {\n\t\t\tthis._service.removeContext(this._key);\n\t\t} else {\n\t\t\tthis._service.setContext(this._key, this._defaultValue);\n\t\t}\n\t}\n\n\tpublic get(): T | undefined {\n\t\treturn this._service.getContextKeyValue<T>(this._key);\n\t}\n}\n\nclass SimpleContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly key: string) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\treturn keys.has(this.key);\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.affectsSome(keys);\n\t}\n}\n\nclass ArrayContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly keys: string[]) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\tfor (const key of this.keys) {\n\t\t\tif (keys.has(key)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.keys.every(key => keys.has(key));\n\t}\n}\n\nclass CompositeContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly events: IContextKeyChangeEvent[]) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\tfor (const e of this.events) {\n\t\t\tif (e.affectsSome(keys)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.events.every(evt => evt.allKeysContainedIn(keys));\n\t}\n}\n\nfunction allEventKeysInContext(event: IContextKeyChangeEvent, context: Record<string, any>): boolean {\n\treturn event.allKeysContainedIn(new Set(Object.keys(context)));\n}\n\nexport abstract class AbstractContextKeyService extends Disposable implements IContextKeyService {\n\tdeclare _serviceBrand: undefined;\n\n\tprotected _isDisposed: boolean;\n\tprotected _myContextId: number;\n\n\tprotected _onDidChangeContext = this._register(new PauseableEmitter<IContextKeyChangeEvent>({ merge: input => new CompositeContextKeyChangeEvent(input) }));\n\tget onDidChangeContext() { return this._onDidChangeContext.event; }\n\n\tconstructor(myContextId: number) {\n\t\tsuper();\n\t\tthis._isDisposed = false;\n\t\tthis._myContextId = myContextId;\n\t}\n\n\tpublic createKey<T extends ContextKeyValue>(key: string, defaultValue: T | undefined): IContextKey<T> {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\treturn new ContextKey(this, key, defaultValue);\n\t}\n\n\n\tbufferChangeEvents(callback: Function): void {\n\t\tthis._onDidChangeContext.pause();\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis._onDidChangeContext.resume();\n\t\t}\n\t}\n\n\tpublic createScoped(domNode: IContextKeyServiceTarget): IScopedContextKeyService {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\treturn new ScopedContextKeyService(this, domNode);\n\t}\n\n\tpublic contextMatchesRules(rules: ContextKeyExpression | undefined): boolean {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\tconst context = this.getContextValuesContainer(this._myContextId);\n\t\tconst result = (rules ? rules.evaluate(context) : true);\n\t\t// console.group(rules.serialize() + ' -> ' + result);\n\t\t// rules.keys().forEach(key => { console.log(key, ctx[key]); });\n\t\t// console.groupEnd();\n\t\treturn result;\n\t}\n\n\tpublic getContextKeyValue<T>(key: string): T | undefined {\n\t\tif (this._isDisposed) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.getContextValuesContainer(this._myContextId).getValue<T>(key);\n\t}\n\n\tpublic setContext(key: string, value: any): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst myContext = this.getContextValuesContainer(this._myContextId);\n\t\tif (!myContext) {\n\t\t\treturn;\n\t\t}\n\t\tif (myContext.setValue(key, value)) {\n\t\t\tthis._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));\n\t\t}\n\t}\n\n\tpublic removeContext(key: string): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.getContextValuesContainer(this._myContextId).removeValue(key)) {\n\t\t\tthis._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));\n\t\t}\n\t}\n\n\tpublic getContext(target: IContextKeyServiceTarget | null): IContext {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this.getContextValuesContainer(findContextAttr(target));\n\t}\n\n\tpublic abstract getContextValuesContainer(contextId: number): Context;\n\tpublic abstract createChildContext(parentContextId?: number): number;\n\tpublic abstract disposeContext(contextId: number): void;\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._isDisposed = true;\n\t}\n}\n\nexport class ContextKeyService extends AbstractContextKeyService implements IContextKeyService {\n\n\tprivate _lastContextId: number;\n\tprivate readonly _contexts = new Map<number, Context>();\n\n\tconstructor(@IConfigurationService configurationService: IConfigurationService) {\n\t\tsuper(0);\n\t\tthis._lastContextId = 0;\n\n\t\tconst myContext = this._register(new ConfigAwareContextValuesContainer(this._myContextId, configurationService, this._onDidChangeContext));\n\t\tthis._contexts.set(this._myContextId, myContext);\n\n\t\t// Uncomment this to see the contexts continuously logged\n\t\t// let lastLoggedValue: string | null = null;\n\t\t// setInterval(() => {\n\t\t// \tlet values = Object.keys(this._contexts).map((key) => this._contexts[key]);\n\t\t// \tlet logValue = values.map(v => JSON.stringify(v._value, null, '\\t')).join('\\n');\n\t\t// \tif (lastLoggedValue !== logValue) {\n\t\t// \t\tlastLoggedValue = logValue;\n\t\t// \t\tconsole.log(lastLoggedValue);\n\t\t// \t}\n\t\t// }, 2000);\n\t}\n\n\tpublic getContextValuesContainer(contextId: number): Context {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this._contexts.get(contextId) || NullContext.INSTANCE;\n\t}\n\n\tpublic createChildContext(parentContextId: number = this._myContextId): number {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`ContextKeyService has been disposed`);\n\t\t}\n\t\tconst id = (++this._lastContextId);\n\t\tthis._contexts.set(id, new Context(id, this.getContextValuesContainer(parentContextId)));\n\t\treturn id;\n\t}\n\n\tpublic disposeContext(contextId: number): void {\n\t\tif (!this._isDisposed) {\n\t\t\tthis._contexts.delete(contextId);\n\t\t}\n\t}\n}\n\nclass ScopedContextKeyService extends AbstractContextKeyService {\n\n\tprivate _parent: AbstractContextKeyService;\n\tprivate _domNode: IContextKeyServiceTarget;\n\n\tprivate readonly _parentChangeListener = this._register(new MutableDisposable());\n\n\tconstructor(parent: AbstractContextKeyService, domNode: IContextKeyServiceTarget) {\n\t\tsuper(parent.createChildContext());\n\t\tthis._parent = parent;\n\t\tthis._updateParentChangeListener();\n\n\t\tthis._domNode = domNode;\n\t\tif (this._domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {\n\t\t\tlet extraInfo = '';\n\t\t\tif ((this._domNode as HTMLElement).classList) {\n\t\t\t\textraInfo = Array.from((this._domNode as HTMLElement).classList.values()).join(', ');\n\t\t\t}\n\n\t\t\tconsole.error(`Element already has context attribute${extraInfo ? ': ' + extraInfo : ''}`);\n\t\t}\n\t\tthis._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(this._myContextId));\n\t}\n\n\tprivate _updateParentChangeListener(): void {\n\t\t// Forward parent events to this listener. Parent will change.\n\t\tthis._parentChangeListener.value = this._parent.onDidChangeContext(e => {\n\t\t\tconst thisContainer = this._parent.getContextValuesContainer(this._myContextId);\n\t\t\tconst thisContextValues = thisContainer.value;\n\n\t\t\tif (!allEventKeysInContext(e, thisContextValues)) {\n\t\t\t\tthis._onDidChangeContext.fire(e);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._parent.disposeContext(this._myContextId);\n\t\tthis._domNode.removeAttribute(KEYBINDING_CONTEXT_ATTR);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getContextValuesContainer(contextId: number): Context {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this._parent.getContextValuesContainer(contextId);\n\t}\n\n\tpublic createChildContext(parentContextId: number = this._myContextId): number {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`ScopedContextKeyService has been disposed`);\n\t\t}\n\t\treturn this._parent.createChildContext(parentContextId);\n\t}\n\n\tpublic disposeContext(contextId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._parent.disposeContext(contextId);\n\t}\n}\n\nfunction findContextAttr(domNode: IContextKeyServiceTarget | null): number {\n\twhile (domNode) {\n\t\tif (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {\n\t\t\tconst attr = domNode.getAttribute(KEYBINDING_CONTEXT_ATTR);\n\t\t\tif (attr) {\n\t\t\t\treturn parseInt(attr, 10);\n\t\t\t}\n\t\t\treturn NaN;\n\t\t}\n\t\tdomNode = domNode.parentElement;\n\t}\n\treturn 0;\n}\n\nexport function setContext(accessor: ServicesAccessor, contextKey: any, contextValue: any) {\n\tconst contextKeyService = accessor.get(IContextKeyService);\n\tcontextKeyService.createKey(String(contextKey), stringifyURIs(contextValue));\n}\n\nfunction stringifyURIs(contextValue: any): any {\n\treturn cloneAndChange(contextValue, (obj) => {\n\t\tif (typeof obj === 'object' && (<MarshalledObject>obj).$mid === MarshalledId.Uri) {\n\t\t\treturn URI.revive(obj).toString();\n\t\t}\n\t\tif (obj instanceof URI) {\n\t\t\treturn obj.toString();\n\t\t}\n\t\treturn undefined;\n\t});\n}\n\nCommandsRegistry.registerCommand('_setContext', setContext);\n\nCommandsRegistry.registerCommand({\n\tid: 'getContextKeyInfo',\n\thandler() {\n\t\treturn [...RawContextKey.all()].sort((a, b) => a.key.localeCompare(b.key));\n\t},\n\tmetadata: {\n\t\tdescription: localize('getContextKeyInfo', \"A command that returns information about context keys\"),\n\t\targs: []\n\t}\n});\n\nCommandsRegistry.registerCommand('_generateContextKeyInfo', function () {\n\tconst result: ContextKeyInfo[] = [];\n\tconst seen = new Set<string>();\n\tfor (const info of RawContextKey.all()) {\n\t\tif (!seen.has(info.key)) {\n\t\t\tseen.add(info.key);\n\t\t\tresult.push(info);\n\t\t}\n\t}\n\tresult.sort((a, b) => a.key.localeCompare(b.key));\n\tconsole.log(JSON.stringify(result, undefined, 2));\n});\n"]}
1
+ {"version":3,"sources":["vs/platform/contextkey/browser/contextKeyService.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAW,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGhH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAuB,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAwG,kBAAkB,EAAoE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEpP,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAErJ,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAE1D,MAAM,OAAO,OAAO;IAMnB,YAAY,EAAU,EAAE,MAAsB;QAC7C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC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YACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC","file":"contextKeyService.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event, PauseableEmitter } from '../../../base/common/event.js';\nimport { Iterable } from '../../../base/common/iterator.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../base/common/lifecycle.js';\nimport { MarshalledObject } from '../../../base/common/marshalling.js';\nimport { MarshalledId } from '../../../base/common/marshallingIds.js';\nimport { cloneAndChange } from '../../../base/common/objects.js';\nimport { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { localize } from '../../../nls.js';\nimport { CommandsRegistry } from '../../commands/common/commands.js';\nimport { ConfigurationTarget, IConfigurationService } from '../../configuration/common/configuration.js';\nimport { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, IScopedContextKeyService, RawContextKey } from '../common/contextkey.js';\nimport { ServicesAccessor } from '../../instantiation/common/instantiation.js';\nimport { InputFocusedContext } from '../common/contextkeys.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { addDisposableListener, EventType, getActiveWindow, isEditableElement, onDidRegisterWindow, trackFocus } from '../../../base/browser/dom.js';\n\nconst KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';\n\nexport class Context implements IContext {\n\n\tprotected _parent: Context | null;\n\tprotected _value: Record<string, any>;\n\tprotected _id: number;\n\n\tconstructor(id: number, parent: Context | null) {\n\t\tthis._id = id;\n\t\tthis._parent = parent;\n\t\tthis._value = Object.create(null);\n\t\tthis._value['_contextId'] = id;\n\t}\n\n\tpublic get value(): Record<string, any> {\n\t\treturn { ...this._value };\n\t}\n\n\tpublic setValue(key: string, value: any): boolean {\n\t\t// console.log('SET ' + key + ' = ' + value + ' ON ' + this._id);\n\t\tif (this._value[key] !== value) {\n\t\t\tthis._value[key] = value;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic removeValue(key: string): boolean {\n\t\t// console.log('REMOVE ' + key + ' FROM ' + this._id);\n\t\tif (key in this._value) {\n\t\t\tdelete this._value[key];\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic getValue<T>(key: string): T | undefined {\n\t\tconst ret = this._value[key];\n\t\tif (typeof ret === 'undefined' && this._parent) {\n\t\t\treturn this._parent.getValue<T>(key);\n\t\t}\n\t\treturn ret;\n\t}\n}\n\nclass NullContext extends Context {\n\n\tstatic readonly INSTANCE = new NullContext();\n\n\tconstructor() {\n\t\tsuper(-1, null);\n\t}\n\n\tpublic override setValue(key: string, value: any): boolean {\n\t\treturn false;\n\t}\n\n\tpublic override removeValue(key: string): boolean {\n\t\treturn false;\n\t}\n\n\tpublic override getValue<T>(key: string): T | undefined {\n\t\treturn undefined;\n\t}\n}\n\nclass ConfigAwareContextValuesContainer extends Context {\n\tprivate static readonly _keyPrefix = 'config.';\n\n\tprivate readonly _values = TernarySearchTree.forConfigKeys<any>();\n\tprivate readonly _listener: IDisposable;\n\n\tconstructor(\n\t\tid: number,\n\t\tprivate readonly _configurationService: IConfigurationService,\n\t\temitter: Emitter<IContextKeyChangeEvent>\n\t) {\n\t\tsuper(id, null);\n\n\t\tthis._listener = this._configurationService.onDidChangeConfiguration(event => {\n\t\t\tif (event.source === ConfigurationTarget.DEFAULT) {\n\t\t\t\t// new setting, reset everything\n\t\t\t\tconst allKeys = Array.from(this._values, ([k]) => k);\n\t\t\t\tthis._values.clear();\n\t\t\t\temitter.fire(new ArrayContextKeyChangeEvent(allKeys));\n\t\t\t} else {\n\t\t\t\tconst changedKeys: string[] = [];\n\t\t\t\tfor (const configKey of event.affectedKeys) {\n\t\t\t\t\tconst contextKey = `config.${configKey}`;\n\n\t\t\t\t\tconst cachedItems = this._values.findSuperstr(contextKey);\n\t\t\t\t\tif (cachedItems !== undefined) {\n\t\t\t\t\t\tchangedKeys.push(...Iterable.map(cachedItems, ([key]) => key));\n\t\t\t\t\t\tthis._values.deleteSuperstr(contextKey);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this._values.has(contextKey)) {\n\t\t\t\t\t\tchangedKeys.push(contextKey);\n\t\t\t\t\t\tthis._values.delete(contextKey);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\temitter.fire(new ArrayContextKeyChangeEvent(changedKeys));\n\t\t\t}\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis._listener.dispose();\n\t}\n\n\toverride getValue(key: string): any {\n\n\t\tif (key.indexOf(ConfigAwareContextValuesContainer._keyPrefix) !== 0) {\n\t\t\treturn super.getValue(key);\n\t\t}\n\n\t\tif (this._values.has(key)) {\n\t\t\treturn this._values.get(key);\n\t\t}\n\n\t\tconst configKey = key.substr(ConfigAwareContextValuesContainer._keyPrefix.length);\n\t\tconst configValue = this._configurationService.getValue(configKey);\n\t\tlet value: any = undefined;\n\t\tswitch (typeof configValue) {\n\t\t\tcase 'number':\n\t\t\tcase 'boolean':\n\t\t\tcase 'string':\n\t\t\t\tvalue = configValue;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (Array.isArray(configValue)) {\n\t\t\t\t\tvalue = JSON.stringify(configValue);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = configValue;\n\t\t\t\t}\n\t\t}\n\n\t\tthis._values.set(key, value);\n\t\treturn value;\n\t}\n\n\toverride setValue(key: string, value: any): boolean {\n\t\treturn super.setValue(key, value);\n\t}\n\n\toverride removeValue(key: string): boolean {\n\t\treturn super.removeValue(key);\n\t}\n}\n\nclass ContextKey<T extends ContextKeyValue> implements IContextKey<T> {\n\n\tprivate _service: AbstractContextKeyService;\n\tprivate _key: string;\n\tprivate _defaultValue: T | undefined;\n\n\tconstructor(service: AbstractContextKeyService, key: string, defaultValue: T | undefined) {\n\t\tthis._service = service;\n\t\tthis._key = key;\n\t\tthis._defaultValue = defaultValue;\n\t\tthis.reset();\n\t}\n\n\tpublic set(value: T): void {\n\t\tthis._service.setContext(this._key, value);\n\t}\n\n\tpublic reset(): void {\n\t\tif (typeof this._defaultValue === 'undefined') {\n\t\t\tthis._service.removeContext(this._key);\n\t\t} else {\n\t\t\tthis._service.setContext(this._key, this._defaultValue);\n\t\t}\n\t}\n\n\tpublic get(): T | undefined {\n\t\treturn this._service.getContextKeyValue<T>(this._key);\n\t}\n}\n\nclass SimpleContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly key: string) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\treturn keys.has(this.key);\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.affectsSome(keys);\n\t}\n}\n\nclass ArrayContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly keys: string[]) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\tfor (const key of this.keys) {\n\t\t\tif (keys.has(key)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.keys.every(key => keys.has(key));\n\t}\n}\n\nclass CompositeContextKeyChangeEvent implements IContextKeyChangeEvent {\n\tconstructor(readonly events: IContextKeyChangeEvent[]) { }\n\taffectsSome(keys: IReadableSet<string>): boolean {\n\t\tfor (const e of this.events) {\n\t\t\tif (e.affectsSome(keys)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tallKeysContainedIn(keys: IReadableSet<string>): boolean {\n\t\treturn this.events.every(evt => evt.allKeysContainedIn(keys));\n\t}\n}\n\nfunction allEventKeysInContext(event: IContextKeyChangeEvent, context: Record<string, any>): boolean {\n\treturn event.allKeysContainedIn(new Set(Object.keys(context)));\n}\n\nexport abstract class AbstractContextKeyService extends Disposable implements IContextKeyService {\n\tdeclare _serviceBrand: undefined;\n\n\tprotected _isDisposed: boolean;\n\tprotected _myContextId: number;\n\n\tprotected _onDidChangeContext = this._register(new PauseableEmitter<IContextKeyChangeEvent>({ merge: input => new CompositeContextKeyChangeEvent(input) }));\n\tget onDidChangeContext() { return this._onDidChangeContext.event; }\n\n\tconstructor(myContextId: number) {\n\t\tsuper();\n\t\tthis._isDisposed = false;\n\t\tthis._myContextId = myContextId;\n\t}\n\n\tpublic createKey<T extends ContextKeyValue>(key: string, defaultValue: T | undefined): IContextKey<T> {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\treturn new ContextKey(this, key, defaultValue);\n\t}\n\n\n\tbufferChangeEvents(callback: Function): void {\n\t\tthis._onDidChangeContext.pause();\n\t\ttry {\n\t\t\tcallback();\n\t\t} finally {\n\t\t\tthis._onDidChangeContext.resume();\n\t\t}\n\t}\n\n\tpublic createScoped(domNode: IContextKeyServiceTarget): IScopedContextKeyService {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\treturn new ScopedContextKeyService(this, domNode);\n\t}\n\n\tpublic contextMatchesRules(rules: ContextKeyExpression | undefined): boolean {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`AbstractContextKeyService has been disposed`);\n\t\t}\n\t\tconst context = this.getContextValuesContainer(this._myContextId);\n\t\tconst result = (rules ? rules.evaluate(context) : true);\n\t\t// console.group(rules.serialize() + ' -> ' + result);\n\t\t// rules.keys().forEach(key => { console.log(key, ctx[key]); });\n\t\t// console.groupEnd();\n\t\treturn result;\n\t}\n\n\tpublic getContextKeyValue<T>(key: string): T | undefined {\n\t\tif (this._isDisposed) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.getContextValuesContainer(this._myContextId).getValue<T>(key);\n\t}\n\n\tpublic setContext(key: string, value: any): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst myContext = this.getContextValuesContainer(this._myContextId);\n\t\tif (!myContext) {\n\t\t\treturn;\n\t\t}\n\t\tif (myContext.setValue(key, value)) {\n\t\t\tthis._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));\n\t\t}\n\t}\n\n\tpublic removeContext(key: string): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.getContextValuesContainer(this._myContextId).removeValue(key)) {\n\t\t\tthis._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));\n\t\t}\n\t}\n\n\tpublic getContext(target: IContextKeyServiceTarget | null): IContext {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this.getContextValuesContainer(findContextAttr(target));\n\t}\n\n\tpublic abstract getContextValuesContainer(contextId: number): Context;\n\tpublic abstract createChildContext(parentContextId?: number): number;\n\tpublic abstract disposeContext(contextId: number): void;\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._isDisposed = true;\n\t}\n}\n\nexport class ContextKeyService extends AbstractContextKeyService implements IContextKeyService {\n\n\tprivate _lastContextId: number;\n\tprivate readonly _contexts = new Map<number, Context>();\n\n\tprivate inputFocusedContext: IContextKey<boolean>;\n\n\tconstructor(@IConfigurationService configurationService: IConfigurationService) {\n\t\tsuper(0);\n\t\tthis._lastContextId = 0;\n\t\tthis.inputFocusedContext = InputFocusedContext.bindTo(this);\n\n\t\tconst myContext = this._register(new ConfigAwareContextValuesContainer(this._myContextId, configurationService, this._onDidChangeContext));\n\t\tthis._contexts.set(this._myContextId, myContext);\n\n\t\t// Uncomment this to see the contexts continuously logged\n\t\t// let lastLoggedValue: string | null = null;\n\t\t// setInterval(() => {\n\t\t// \tlet values = Object.keys(this._contexts).map((key) => this._contexts[key]);\n\t\t// \tlet logValue = values.map(v => JSON.stringify(v._value, null, '\\t')).join('\\n');\n\t\t// \tif (lastLoggedValue !== logValue) {\n\t\t// \t\tlastLoggedValue = logValue;\n\t\t// \t\tconsole.log(lastLoggedValue);\n\t\t// \t}\n\t\t// }, 2000);\n\n\t\tthis._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => {\n\t\t\tconst onFocusDisposables = disposables.add(new MutableDisposable<DisposableStore>());\n\t\t\tdisposables.add(addDisposableListener(window, EventType.FOCUS_IN, () => {\n\t\t\t\tonFocusDisposables.value = new DisposableStore();\n\t\t\t\tthis.updateInputContextKeys(window.document, onFocusDisposables.value);\n\t\t\t}, true));\n\t\t}, { window: mainWindow, disposables: this._store }));\n\t}\n\n\tprivate updateInputContextKeys(ownerDocument: Document, disposables: DisposableStore): void {\n\n\t\tfunction activeElementIsInput(): boolean {\n\t\t\treturn !!ownerDocument.activeElement && isEditableElement(ownerDocument.activeElement);\n\t\t}\n\n\t\tconst isInputFocused = activeElementIsInput();\n\t\tthis.inputFocusedContext.set(isInputFocused);\n\n\t\tif (isInputFocused) {\n\t\t\tconst tracker = disposables.add(trackFocus(ownerDocument.activeElement as HTMLElement));\n\t\t\tEvent.once(tracker.onDidBlur)(() => {\n\n\t\t\t\t// Ensure we are only updating the context key if we are\n\t\t\t\t// still in the same document that we are tracking. This\n\t\t\t\t// fixes a race condition in multi-window setups where\n\t\t\t\t// the blur event arrives in the inactive window overwriting\n\t\t\t\t// the context key of the active window. This is because\n\t\t\t\t// blur events from the focus tracker are emitted with a\n\t\t\t\t// timeout of 0.\n\n\t\t\t\tif (getActiveWindow().document === ownerDocument) {\n\t\t\t\t\tthis.inputFocusedContext.set(activeElementIsInput());\n\t\t\t\t}\n\n\t\t\t\ttracker.dispose();\n\t\t\t}, undefined, disposables);\n\t\t}\n\t}\n\n\tpublic getContextValuesContainer(contextId: number): Context {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this._contexts.get(contextId) || NullContext.INSTANCE;\n\t}\n\n\tpublic createChildContext(parentContextId: number = this._myContextId): number {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`ContextKeyService has been disposed`);\n\t\t}\n\t\tconst id = (++this._lastContextId);\n\t\tthis._contexts.set(id, new Context(id, this.getContextValuesContainer(parentContextId)));\n\t\treturn id;\n\t}\n\n\tpublic disposeContext(contextId: number): void {\n\t\tif (!this._isDisposed) {\n\t\t\tthis._contexts.delete(contextId);\n\t\t}\n\t}\n}\n\nclass ScopedContextKeyService extends AbstractContextKeyService {\n\n\tprivate _parent: AbstractContextKeyService;\n\tprivate _domNode: IContextKeyServiceTarget;\n\n\tprivate readonly _parentChangeListener = this._register(new MutableDisposable());\n\n\tconstructor(parent: AbstractContextKeyService, domNode: IContextKeyServiceTarget) {\n\t\tsuper(parent.createChildContext());\n\t\tthis._parent = parent;\n\t\tthis._updateParentChangeListener();\n\n\t\tthis._domNode = domNode;\n\t\tif (this._domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {\n\t\t\tlet extraInfo = '';\n\t\t\tif ((this._domNode as HTMLElement).classList) {\n\t\t\t\textraInfo = Array.from((this._domNode as HTMLElement).classList.values()).join(', ');\n\t\t\t}\n\n\t\t\tconsole.error(`Element already has context attribute${extraInfo ? ': ' + extraInfo : ''}`);\n\t\t}\n\t\tthis._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(this._myContextId));\n\t}\n\n\tprivate _updateParentChangeListener(): void {\n\t\t// Forward parent events to this listener. Parent will change.\n\t\tthis._parentChangeListener.value = this._parent.onDidChangeContext(e => {\n\t\t\tconst thisContainer = this._parent.getContextValuesContainer(this._myContextId);\n\t\t\tconst thisContextValues = thisContainer.value;\n\n\t\t\tif (!allEventKeysInContext(e, thisContextValues)) {\n\t\t\t\tthis._onDidChangeContext.fire(e);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._parent.disposeContext(this._myContextId);\n\t\tthis._domNode.removeAttribute(KEYBINDING_CONTEXT_ATTR);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getContextValuesContainer(contextId: number): Context {\n\t\tif (this._isDisposed) {\n\t\t\treturn NullContext.INSTANCE;\n\t\t}\n\t\treturn this._parent.getContextValuesContainer(contextId);\n\t}\n\n\tpublic createChildContext(parentContextId: number = this._myContextId): number {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error(`ScopedContextKeyService has been disposed`);\n\t\t}\n\t\treturn this._parent.createChildContext(parentContextId);\n\t}\n\n\tpublic disposeContext(contextId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._parent.disposeContext(contextId);\n\t}\n}\n\nfunction findContextAttr(domNode: IContextKeyServiceTarget | null): number {\n\twhile (domNode) {\n\t\tif (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {\n\t\t\tconst attr = domNode.getAttribute(KEYBINDING_CONTEXT_ATTR);\n\t\t\tif (attr) {\n\t\t\t\treturn parseInt(attr, 10);\n\t\t\t}\n\t\t\treturn NaN;\n\t\t}\n\t\tdomNode = domNode.parentElement;\n\t}\n\treturn 0;\n}\n\nexport function setContext(accessor: ServicesAccessor, contextKey: any, contextValue: any) {\n\tconst contextKeyService = accessor.get(IContextKeyService);\n\tcontextKeyService.createKey(String(contextKey), stringifyURIs(contextValue));\n}\n\nfunction stringifyURIs(contextValue: any): any {\n\treturn cloneAndChange(contextValue, (obj) => {\n\t\tif (typeof obj === 'object' && (<MarshalledObject>obj).$mid === MarshalledId.Uri) {\n\t\t\treturn URI.revive(obj).toString();\n\t\t}\n\t\tif (obj instanceof URI) {\n\t\t\treturn obj.toString();\n\t\t}\n\t\treturn undefined;\n\t});\n}\n\nCommandsRegistry.registerCommand('_setContext', setContext);\n\nCommandsRegistry.registerCommand({\n\tid: 'getContextKeyInfo',\n\thandler() {\n\t\treturn [...RawContextKey.all()].sort((a, b) => a.key.localeCompare(b.key));\n\t},\n\tmetadata: {\n\t\tdescription: localize('getContextKeyInfo', \"A command that returns information about context keys\"),\n\t\targs: []\n\t}\n});\n\nCommandsRegistry.registerCommand('_generateContextKeyInfo', function () {\n\tconst result: ContextKeyInfo[] = [];\n\tconst seen = new Set<string>();\n\tfor (const info of RawContextKey.all()) {\n\t\tif (!seen.has(info.key)) {\n\t\t\tseen.add(info.key);\n\t\t\tresult.push(info);\n\t\t}\n\t}\n\tresult.sort((a, b) => a.key.localeCompare(b.key));\n\tconsole.log(JSON.stringify(result, undefined, 2));\n});\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "monaco-editor-core",
3
3
  "private": false,
4
- "version": "0.54.0-dev-20250923",
4
+ "version": "0.54.0-dev-20250924",
5
5
  "description": "A browser based code editor",
6
6
  "author": "Microsoft Corporation",
7
7
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "bugs": {
15
15
  "url": "https://github.com/microsoft/vscode/issues"
16
16
  },
17
- "vscodeCommitId": "a4fc751b40251389573c97ae2c190474b1560cc0",
17
+ "vscodeCommitId": "29af21589ee9a7a9fdb5d4d6277fef51923aaa99",
18
18
  "dependencies": {
19
19
  "marked": "14.0.0",
20
20
  "dompurify": "3.1.7"