monaco-editor-core 0.55.0-dev-20251029 → 0.55.0-dev-20251030
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.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +14 -0
- package/esm/vs/base/browser/markdownRenderer.js +52 -1
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/common/glob.js +41 -31
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/htmlContent.js +5 -1
- package/esm/vs/base/common/htmlContent.js.map +1 -1
- package/esm/vs/base/common/network.js +2 -6
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/strings.js +7 -5
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +1 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +4 -0
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +16 -16
- package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js +17 -6
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js +6 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +36 -0
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +51 -0
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js.map +1 -0
- package/esm/vs/editor/contrib/hover/browser/hoverTypes.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +25 -9
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +8 -5
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +20 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +4 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +8 -8
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +27 -24
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +2 -0
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/package.json +2 -2
|
@@ -91,6 +91,7 @@ export const EditSources = {
|
|
|
91
91
|
$modelId: avoidPathRedaction(data.modelId),
|
|
92
92
|
$extensionId: data.extensionId?.extensionId,
|
|
93
93
|
$extensionVersion: data.extensionId?.version,
|
|
94
|
+
$$sessionId: data.sessionId,
|
|
94
95
|
$$requestId: data.requestId,
|
|
95
96
|
$$languageId: data.languageId,
|
|
96
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/textModelEditSource.ts","vs/editor/common/textModelEditSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEpD,MAAM,OAAO,mBAAmB;IAC/B,YACiB,QAAsC,EACtD,iBAAuC;QADvB,aAAQ,GAAR,QAAQ,CAA8B;IAEnD,CAAC;IAEE,QAAQ;QACd,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;IAEM,OAAO;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;YACzB,KAAK,QAAQ;gBACZ,OAAO,QAAQ,CAAC,IAAI,CAAC;YACtB,KAAK,wBAAwB;gBAC5B,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACxD,KAAK,SAAS;gBACb,OAAO,QAAQ,CAAC,IAAI,IAAI,SAAS,CAAC;YACnC;gBACC,OAAO,QAAQ,CAAC,MAAM,CAAC;QACzB,CAAC;IACF,CAAC;IAED;;;MAGE;IACK,KAAK,CAAC,KAAa,EAAE,SAAmE,EAAE;QAChG,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC7D,MAAM,SAAS,GAAI,MA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AACF,CAAC,EARgB,gBAAgB,KAAhB,gBAAgB,QAQhC;AAED,SAAS,cAAc,CAAC,EAAU;IACjC,OAAO,EAAiC,CAAC;AAC1C,CAAC","file":"textModelEditSource.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { prefixedUuid } from '../../base/common/uuid.js';\nimport { TextLength } from './core/text/textLength.js';\nimport { ProviderId, VersionedExtensionId } from './languages.js';\n\nconst privateSymbol = Symbol('TextModelEditSource');\n\nexport class TextModelEditSource {\n\tconstructor(\n\t\tpublic readonly metadata: ITextModelEditSourceMetadata,\n\t\t_privateCtorGuard: typeof privateSymbol,\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `${this.metadata.source}`;\n\t}\n\n\tpublic getType(): string {\n\t\tconst metadata = this.metadata;\n\t\tswitch (metadata.source) {\n\t\t\tcase 'cursor':\n\t\t\t\treturn metadata.kind;\n\t\t\tcase 'inlineCompletionAccept':\n\t\t\t\treturn metadata.source + (metadata.$nes ? ':nes' : '');\n\t\t\tcase 'unknown':\n\t\t\t\treturn metadata.name || 'unknown';\n\t\t\tdefault:\n\t\t\t\treturn metadata.source;\n\t\t}\n\t}\n\n\t/**\n\t * Converts the metadata to a key string.\n\t * Only includes properties/values that have `level` many `$` prefixes or less.\n\t*/\n\tpublic toKey(level: number, filter: { [TKey in ITextModelEditSourceMetadataKeys]?: boolean } = {}): string {\n\t\tconst metadata = this.metadata;\n\t\tconst keys = Object.entries(metadata).filter(([key, value]) => {\n\t\t\tconst filterVal = (filter as Record<string, boolean>)[key];\n\t\t\tif (filterVal !== undefined) {\n\t\t\t\treturn filterVal;\n\t\t\t}\n\n\t\t\tconst prefixCount = (key.match(/\\$/g) || []).length;\n\t\t\treturn prefixCount <= level && value !== undefined && value !== null && value !== '';\n\t\t}).map(([key, value]) => `${key}:${value}`);\n\t\treturn keys.join('-');\n\t}\n}\n\ntype TextModelEditSourceT<T> = TextModelEditSource & {\n\tmetadataT: T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction createEditSource<T extends Record<string, any>>(metadata: T): TextModelEditSourceT<T> {\n\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\treturn new TextModelEditSource(metadata as any, privateSymbol) as any;\n}\n\nexport const EditSources = {\n\tunknown(data: { name?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'unknown',\n\t\t\tname: data.name,\n\t\t} as const);\n\t},\n\n\trename: () => createEditSource({ source: 'rename' } as const),\n\n\tchatApplyEdits(data: {\n\t\tmodelId: string | undefined;\n\t\tsessionId: string | undefined;\n\t\trequestId: string | undefined;\n\t\tlanguageId: string;\n\t\tmode: string | undefined;\n\t\textensionId: VersionedExtensionId | undefined;\n\t\tcodeBlockSuggestionId: EditSuggestionId | undefined;\n\t}) {\n\t\treturn createEditSource({\n\t\t\tsource: 'Chat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$languageId: data.languageId,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$mode: data.mode,\n\t\t\t$$codeBlockSuggestionId: data.codeBlockSuggestionId,\n\t\t} as const);\n\t},\n\n\tchatUndoEdits: () => createEditSource({ source: 'Chat.undoEdits' } as const),\n\tchatReset: () => createEditSource({ source: 'Chat.reset' } as const),\n\n\tinlineCompletionAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionAccept',\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineCompletionPartialAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId; type: 'word' | 'line' }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionPartialAccept',\n\t\t\ttype: data.type,\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineChatApplyEdit(data: { modelId: string | undefined; requestId: string | undefined; languageId: string; extensionId: VersionedExtensionId | undefined }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineChat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\treloadFromDisk: () => createEditSource({ source: 'reloadFromDisk' } as const),\n\n\tcursor(data: { kind: 'compositionType' | 'compositionEnd' | 'type' | 'paste' | 'cut' | 'executeCommands' | 'executeCommand'; detailedSource?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'cursor',\n\t\t\tkind: data.kind,\n\t\t\tdetailedSource: data.detailedSource,\n\t\t} as const);\n\t},\n\n\tsetValue: () => createEditSource({ source: 'setValue' } as const),\n\teolChange: () => createEditSource({ source: 'eolChange' } as const),\n\tapplyEdits: () => createEditSource({ source: 'applyEdits' } as const),\n\tsnippet: () => createEditSource({ source: 'snippet' } as const),\n\tsuggest: (data: { providerId: ProviderId | undefined }) => createEditSource({ source: 'suggest', ...toProperties(data.providerId) } as const),\n\n\tcodeAction: (data: { kind: string | undefined; providerId: ProviderId | undefined }) => createEditSource({ source: 'codeAction', $kind: data.kind, ...toProperties(data.providerId) } as const)\n};\n\nfunction toProperties(version: ProviderId | undefined) {\n\tif (!version) {\n\t\treturn {};\n\t}\n\treturn {\n\t\t$extensionId: version.extensionId,\n\t\t$extensionVersion: version.extensionVersion,\n\t\t$providerId: version.providerId,\n\t};\n}\n\ntype Values<T> = T[keyof T];\nexport type ITextModelEditSourceMetadata = Values<{ [TKey in keyof typeof EditSources]: ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\ntype ITextModelEditSourceMetadataKeys = Values<{ [TKey in keyof typeof EditSources]: keyof ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\n\n\nfunction avoidPathRedaction(str: string | undefined): string | undefined {\n\tif (str === undefined) {\n\t\treturn undefined;\n\t}\n\t// To avoid false-positive file path redaction.\n\treturn str.replaceAll('/', '|');\n}\n\n\nexport class EditDeltaInfo {\n\tpublic static fromText(text: string): EditDeltaInfo {\n\t\tconst linesAdded = TextLength.ofText(text).lineCount;\n\t\tconst charsAdded = text.length;\n\t\treturn new EditDeltaInfo(linesAdded, 0, charsAdded, 0);\n\t}\n\n\tpublic static tryCreate(\n\t\tlinesAdded: number | undefined,\n\t\tlinesRemoved: number | undefined,\n\t\tcharsAdded: number | undefined,\n\t\tcharsRemoved: number | undefined\n\t): EditDeltaInfo | undefined {\n\t\tif (linesAdded === undefined || linesRemoved === undefined || charsAdded === undefined || charsRemoved === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new EditDeltaInfo(linesAdded, linesRemoved, charsAdded, charsRemoved);\n\t}\n\n\tconstructor(\n\t\tpublic readonly linesAdded: number,\n\t\tpublic readonly linesRemoved: number,\n\t\tpublic readonly charsAdded: number,\n\t\tpublic readonly charsRemoved: number\n\t) { }\n}\n\n\n/**\n * This is an opaque serializable type that represents a unique identity for an edit.\n */\nexport interface EditSuggestionId {\n}\n\nexport namespace EditSuggestionId {\n\t/**\n\t * Use AiEditTelemetryServiceImpl to create a new id!\n\t*/\n\texport function newId(): EditSuggestionId {\n\t\tconst id = prefixedUuid('sgt');\n\t\treturn toEditIdentity(id);\n\t}\n}\n\nfunction toEditIdentity(id: string): EditSuggestionId {\n\treturn id as unknown as EditSuggestionId;\n}\n","\nimport { prefixedUuid } from '../../base/common/uuid.js';\nimport { TextLength } from './core/text/textLength.js';\nimport { ProviderId, VersionedExtensionId } from './languages.js';\n\nconst privateSymbol = Symbol('TextModelEditSource');\n\nexport class TextModelEditSource {\n\tconstructor(\n\t\tpublic readonly metadata: ITextModelEditSourceMetadata,\n\t\t_privateCtorGuard: typeof privateSymbol,\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `${this.metadata.source}`;\n\t}\n\n\tpublic getType(): string {\n\t\tconst metadata = this.metadata;\n\t\tswitch (metadata.source) {\n\t\t\tcase 'cursor':\n\t\t\t\treturn metadata.kind;\n\t\t\tcase 'inlineCompletionAccept':\n\t\t\t\treturn metadata.source + (metadata.$nes ? ':nes' : '');\n\t\t\tcase 'unknown':\n\t\t\t\treturn metadata.name || 'unknown';\n\t\t\tdefault:\n\t\t\t\treturn metadata.source;\n\t\t}\n\t}\n\n\t/**\n\t * Converts the metadata to a key string.\n\t * Only includes properties/values that have `level` many `$` prefixes or less.\n\t*/\n\tpublic toKey(level: number, filter: { [TKey in ITextModelEditSourceMetadataKeys]?: boolean } = {}): string {\n\t\tconst metadata = this.metadata;\n\t\tconst keys = Object.entries(metadata).filter(([key, value]) => {\n\t\t\tconst filterVal = (filter as Record<string, boolean>)[key];\n\t\t\tif (filterVal !== undefined) {\n\t\t\t\treturn filterVal;\n\t\t\t}\n\n\t\t\tconst prefixCount = (key.match(/\\$/g) || []).length;\n\t\t\treturn prefixCount <= level && value !== undefined && value !== null && value !== '';\n\t\t}).map(([key, value]) => `${key}:${value}`);\n\t\treturn keys.join('-');\n\t}\n}\n\ntype TextModelEditSourceT<T> = TextModelEditSource & {\n\tmetadataT: T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction createEditSource<T extends Record<string, any>>(metadata: T): TextModelEditSourceT<T> {\n\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\treturn new TextModelEditSource(metadata as any, privateSymbol) as any;\n}\n\nexport const EditSources = {\n\tunknown(data: { name?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'unknown',\n\t\t\tname: data.name,\n\t\t} as const);\n\t},\n\n\trename: () => createEditSource({ source: 'rename' } as const),\n\n\tchatApplyEdits(data: {\n\t\tmodelId: string | undefined;\n\t\tsessionId: string | undefined;\n\t\trequestId: string | undefined;\n\t\tlanguageId: string;\n\t\tmode: string | undefined;\n\t\textensionId: VersionedExtensionId | undefined;\n\t\tcodeBlockSuggestionId: EditSuggestionId | undefined;\n\t}) {\n\t\treturn createEditSource({\n\t\t\tsource: 'Chat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$languageId: data.languageId,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$mode: data.mode,\n\t\t\t$$codeBlockSuggestionId: data.codeBlockSuggestionId,\n\t\t} as const);\n\t},\n\n\tchatUndoEdits: () => createEditSource({ source: 'Chat.undoEdits' } as const),\n\tchatReset: () => createEditSource({ source: 'Chat.reset' } as const),\n\n\tinlineCompletionAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionAccept',\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineCompletionPartialAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId; type: 'word' | 'line' }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionPartialAccept',\n\t\t\ttype: data.type,\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineChatApplyEdit(data: { modelId: string | undefined; requestId: string | undefined; languageId: string; extensionId: VersionedExtensionId | undefined }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineChat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\treloadFromDisk: () => createEditSource({ source: 'reloadFromDisk' } as const),\n\n\tcursor(data: { kind: 'compositionType' | 'compositionEnd' | 'type' | 'paste' | 'cut' | 'executeCommands' | 'executeCommand'; detailedSource?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'cursor',\n\t\t\tkind: data.kind,\n\t\t\tdetailedSource: data.detailedSource,\n\t\t} as const);\n\t},\n\n\tsetValue: () => createEditSource({ source: 'setValue' } as const),\n\teolChange: () => createEditSource({ source: 'eolChange' } as const),\n\tapplyEdits: () => createEditSource({ source: 'applyEdits' } as const),\n\tsnippet: () => createEditSource({ source: 'snippet' } as const),\n\tsuggest: (data: { providerId: ProviderId | undefined }) => createEditSource({ source: 'suggest', ...toProperties(data.providerId) } as const),\n\n\tcodeAction: (data: { kind: string | undefined; providerId: ProviderId | undefined }) => createEditSource({ source: 'codeAction', $kind: data.kind, ...toProperties(data.providerId) } as const)\n};\n\nfunction toProperties(version: ProviderId | undefined) {\n\tif (!version) {\n\t\treturn {};\n\t}\n\treturn {\n\t\t$extensionId: version.extensionId,\n\t\t$extensionVersion: version.extensionVersion,\n\t\t$providerId: version.providerId,\n\t};\n}\n\ntype Values<T> = T[keyof T];\nexport type ITextModelEditSourceMetadata = Values<{ [TKey in keyof typeof EditSources]: ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\ntype ITextModelEditSourceMetadataKeys = Values<{ [TKey in keyof typeof EditSources]: keyof ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\n\n\nfunction avoidPathRedaction(str: string | undefined): string | undefined {\n\tif (str === undefined) {\n\t\treturn undefined;\n\t}\n\t// To avoid false-positive file path redaction.\n\treturn str.replaceAll('/', '|');\n}\n\n\nexport class EditDeltaInfo {\n\tpublic static fromText(text: string): EditDeltaInfo {\n\t\tconst linesAdded = TextLength.ofText(text).lineCount;\n\t\tconst charsAdded = text.length;\n\t\treturn new EditDeltaInfo(linesAdded, 0, charsAdded, 0);\n\t}\n\n\tpublic static tryCreate(\n\t\tlinesAdded: number | undefined,\n\t\tlinesRemoved: number | undefined,\n\t\tcharsAdded: number | undefined,\n\t\tcharsRemoved: number | undefined\n\t): EditDeltaInfo | undefined {\n\t\tif (linesAdded === undefined || linesRemoved === undefined || charsAdded === undefined || charsRemoved === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new EditDeltaInfo(linesAdded, linesRemoved, charsAdded, charsRemoved);\n\t}\n\n\tconstructor(\n\t\tpublic readonly linesAdded: number,\n\t\tpublic readonly linesRemoved: number,\n\t\tpublic readonly charsAdded: number,\n\t\tpublic readonly charsRemoved: number\n\t) { }\n}\n\n\n/**\n * This is an opaque serializable type that represents a unique identity for an edit.\n */\nexport interface EditSuggestionId {\n}\n\nexport namespace EditSuggestionId {\n\t/**\n\t * Use AiEditTelemetryServiceImpl to create a new id!\n\t*/\n\texport function newId(): EditSuggestionId {\n\t\tconst id = prefixedUuid('sgt');\n\t\treturn toEditIdentity(id);\n\t}\n}\n\nfunction toEditIdentity(id: string): EditSuggestionId {\n\treturn id as unknown as EditSuggestionId;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/textModelEditSource.ts","vs/editor/common/textModelEditSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEpD,MAAM,OAAO,mBAAmB;IAC/B,YACiB,QAAsC,EACtD,iBAAuC;QADvB,aAAQ,GAAR,QAAQ,CAA8B;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O,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAEM,MAAM,CAAC,SAAS,CACtB,UAA8B,EAC9B,YAAgC,EAChC,UAA8B,EAC9B,YAAgC;QAEhC,IAAI,UAAU,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YACtH,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC;IAED,YACiB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,YAAoB;QAHpB,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAQ;IACjC,CAAC;CACL;AASD,MAAM,KAAW,gBAAgB,CAQhC;AARD,WAAiB,gBAAgB;IAChC;;MAEE;IACF,SAAgB,KAAK;QACpB,MAAM,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAHe,sBAAK,QAGpB,CAAA;AACF,CAAC,EARgB,gBAAgB,KAAhB,gBAAgB,QAQhC;AAED,SAAS,cAAc,CAAC,EAAU;IACjC,OAAO,EAAiC,CAAC;AAC1C,CAAC","file":"textModelEditSource.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { prefixedUuid } from '../../base/common/uuid.js';\nimport { TextLength } from './core/text/textLength.js';\nimport { ProviderId, VersionedExtensionId } from './languages.js';\n\nconst privateSymbol = Symbol('TextModelEditSource');\n\nexport class TextModelEditSource {\n\tconstructor(\n\t\tpublic readonly metadata: ITextModelEditSourceMetadata,\n\t\t_privateCtorGuard: typeof privateSymbol,\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `${this.metadata.source}`;\n\t}\n\n\tpublic getType(): string {\n\t\tconst metadata = this.metadata;\n\t\tswitch (metadata.source) {\n\t\t\tcase 'cursor':\n\t\t\t\treturn metadata.kind;\n\t\t\tcase 'inlineCompletionAccept':\n\t\t\t\treturn metadata.source + (metadata.$nes ? ':nes' : '');\n\t\t\tcase 'unknown':\n\t\t\t\treturn metadata.name || 'unknown';\n\t\t\tdefault:\n\t\t\t\treturn metadata.source;\n\t\t}\n\t}\n\n\t/**\n\t * Converts the metadata to a key string.\n\t * Only includes properties/values that have `level` many `$` prefixes or less.\n\t*/\n\tpublic toKey(level: number, filter: { [TKey in ITextModelEditSourceMetadataKeys]?: boolean } = {}): string {\n\t\tconst metadata = this.metadata;\n\t\tconst keys = Object.entries(metadata).filter(([key, value]) => {\n\t\t\tconst filterVal = (filter as Record<string, boolean>)[key];\n\t\t\tif (filterVal !== undefined) {\n\t\t\t\treturn filterVal;\n\t\t\t}\n\n\t\t\tconst prefixCount = (key.match(/\\$/g) || []).length;\n\t\t\treturn prefixCount <= level && value !== undefined && value !== null && value !== '';\n\t\t}).map(([key, value]) => `${key}:${value}`);\n\t\treturn keys.join('-');\n\t}\n}\n\ntype TextModelEditSourceT<T> = TextModelEditSource & {\n\tmetadataT: T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction createEditSource<T extends Record<string, any>>(metadata: T): TextModelEditSourceT<T> {\n\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\treturn new TextModelEditSource(metadata as any, privateSymbol) as any;\n}\n\nexport const EditSources = {\n\tunknown(data: { name?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'unknown',\n\t\t\tname: data.name,\n\t\t} as const);\n\t},\n\n\trename: () => createEditSource({ source: 'rename' } as const),\n\n\tchatApplyEdits(data: {\n\t\tmodelId: string | undefined;\n\t\tsessionId: string | undefined;\n\t\trequestId: string | undefined;\n\t\tlanguageId: string;\n\t\tmode: string | undefined;\n\t\textensionId: VersionedExtensionId | undefined;\n\t\tcodeBlockSuggestionId: EditSuggestionId | undefined;\n\t}) {\n\t\treturn createEditSource({\n\t\t\tsource: 'Chat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$languageId: data.languageId,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$mode: data.mode,\n\t\t\t$$codeBlockSuggestionId: data.codeBlockSuggestionId,\n\t\t} as const);\n\t},\n\n\tchatUndoEdits: () => createEditSource({ source: 'Chat.undoEdits' } as const),\n\tchatReset: () => createEditSource({ source: 'Chat.reset' } as const),\n\n\tinlineCompletionAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionAccept',\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineCompletionPartialAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId; type: 'word' | 'line' }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionPartialAccept',\n\t\t\ttype: data.type,\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineChatApplyEdit(data: { modelId: string | undefined; requestId: string | undefined; sessionId: string | undefined; languageId: string; extensionId: VersionedExtensionId | undefined }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineChat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\treloadFromDisk: () => createEditSource({ source: 'reloadFromDisk' } as const),\n\n\tcursor(data: { kind: 'compositionType' | 'compositionEnd' | 'type' | 'paste' | 'cut' | 'executeCommands' | 'executeCommand'; detailedSource?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'cursor',\n\t\t\tkind: data.kind,\n\t\t\tdetailedSource: data.detailedSource,\n\t\t} as const);\n\t},\n\n\tsetValue: () => createEditSource({ source: 'setValue' } as const),\n\teolChange: () => createEditSource({ source: 'eolChange' } as const),\n\tapplyEdits: () => createEditSource({ source: 'applyEdits' } as const),\n\tsnippet: () => createEditSource({ source: 'snippet' } as const),\n\tsuggest: (data: { providerId: ProviderId | undefined }) => createEditSource({ source: 'suggest', ...toProperties(data.providerId) } as const),\n\n\tcodeAction: (data: { kind: string | undefined; providerId: ProviderId | undefined }) => createEditSource({ source: 'codeAction', $kind: data.kind, ...toProperties(data.providerId) } as const)\n};\n\nfunction toProperties(version: ProviderId | undefined) {\n\tif (!version) {\n\t\treturn {};\n\t}\n\treturn {\n\t\t$extensionId: version.extensionId,\n\t\t$extensionVersion: version.extensionVersion,\n\t\t$providerId: version.providerId,\n\t};\n}\n\ntype Values<T> = T[keyof T];\nexport type ITextModelEditSourceMetadata = Values<{ [TKey in keyof typeof EditSources]: ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\ntype ITextModelEditSourceMetadataKeys = Values<{ [TKey in keyof typeof EditSources]: keyof ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\n\n\nfunction avoidPathRedaction(str: string | undefined): string | undefined {\n\tif (str === undefined) {\n\t\treturn undefined;\n\t}\n\t// To avoid false-positive file path redaction.\n\treturn str.replaceAll('/', '|');\n}\n\n\nexport class EditDeltaInfo {\n\tpublic static fromText(text: string): EditDeltaInfo {\n\t\tconst linesAdded = TextLength.ofText(text).lineCount;\n\t\tconst charsAdded = text.length;\n\t\treturn new EditDeltaInfo(linesAdded, 0, charsAdded, 0);\n\t}\n\n\tpublic static tryCreate(\n\t\tlinesAdded: number | undefined,\n\t\tlinesRemoved: number | undefined,\n\t\tcharsAdded: number | undefined,\n\t\tcharsRemoved: number | undefined\n\t): EditDeltaInfo | undefined {\n\t\tif (linesAdded === undefined || linesRemoved === undefined || charsAdded === undefined || charsRemoved === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new EditDeltaInfo(linesAdded, linesRemoved, charsAdded, charsRemoved);\n\t}\n\n\tconstructor(\n\t\tpublic readonly linesAdded: number,\n\t\tpublic readonly linesRemoved: number,\n\t\tpublic readonly charsAdded: number,\n\t\tpublic readonly charsRemoved: number\n\t) { }\n}\n\n\n/**\n * This is an opaque serializable type that represents a unique identity for an edit.\n */\nexport interface EditSuggestionId {\n}\n\nexport namespace EditSuggestionId {\n\t/**\n\t * Use AiEditTelemetryServiceImpl to create a new id!\n\t*/\n\texport function newId(): EditSuggestionId {\n\t\tconst id = prefixedUuid('sgt');\n\t\treturn toEditIdentity(id);\n\t}\n}\n\nfunction toEditIdentity(id: string): EditSuggestionId {\n\treturn id as unknown as EditSuggestionId;\n}\n","\nimport { prefixedUuid } from '../../base/common/uuid.js';\nimport { TextLength } from './core/text/textLength.js';\nimport { ProviderId, VersionedExtensionId } from './languages.js';\n\nconst privateSymbol = Symbol('TextModelEditSource');\n\nexport class TextModelEditSource {\n\tconstructor(\n\t\tpublic readonly metadata: ITextModelEditSourceMetadata,\n\t\t_privateCtorGuard: typeof privateSymbol,\n\t) { }\n\n\tpublic toString(): string {\n\t\treturn `${this.metadata.source}`;\n\t}\n\n\tpublic getType(): string {\n\t\tconst metadata = this.metadata;\n\t\tswitch (metadata.source) {\n\t\t\tcase 'cursor':\n\t\t\t\treturn metadata.kind;\n\t\t\tcase 'inlineCompletionAccept':\n\t\t\t\treturn metadata.source + (metadata.$nes ? ':nes' : '');\n\t\t\tcase 'unknown':\n\t\t\t\treturn metadata.name || 'unknown';\n\t\t\tdefault:\n\t\t\t\treturn metadata.source;\n\t\t}\n\t}\n\n\t/**\n\t * Converts the metadata to a key string.\n\t * Only includes properties/values that have `level` many `$` prefixes or less.\n\t*/\n\tpublic toKey(level: number, filter: { [TKey in ITextModelEditSourceMetadataKeys]?: boolean } = {}): string {\n\t\tconst metadata = this.metadata;\n\t\tconst keys = Object.entries(metadata).filter(([key, value]) => {\n\t\t\tconst filterVal = (filter as Record<string, boolean>)[key];\n\t\t\tif (filterVal !== undefined) {\n\t\t\t\treturn filterVal;\n\t\t\t}\n\n\t\t\tconst prefixCount = (key.match(/\\$/g) || []).length;\n\t\t\treturn prefixCount <= level && value !== undefined && value !== null && value !== '';\n\t\t}).map(([key, value]) => `${key}:${value}`);\n\t\treturn keys.join('-');\n\t}\n}\n\ntype TextModelEditSourceT<T> = TextModelEditSource & {\n\tmetadataT: T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction createEditSource<T extends Record<string, any>>(metadata: T): TextModelEditSourceT<T> {\n\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\treturn new TextModelEditSource(metadata as any, privateSymbol) as any;\n}\n\nexport const EditSources = {\n\tunknown(data: { name?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'unknown',\n\t\t\tname: data.name,\n\t\t} as const);\n\t},\n\n\trename: () => createEditSource({ source: 'rename' } as const),\n\n\tchatApplyEdits(data: {\n\t\tmodelId: string | undefined;\n\t\tsessionId: string | undefined;\n\t\trequestId: string | undefined;\n\t\tlanguageId: string;\n\t\tmode: string | undefined;\n\t\textensionId: VersionedExtensionId | undefined;\n\t\tcodeBlockSuggestionId: EditSuggestionId | undefined;\n\t}) {\n\t\treturn createEditSource({\n\t\t\tsource: 'Chat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$languageId: data.languageId,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$mode: data.mode,\n\t\t\t$$codeBlockSuggestionId: data.codeBlockSuggestionId,\n\t\t} as const);\n\t},\n\n\tchatUndoEdits: () => createEditSource({ source: 'Chat.undoEdits' } as const),\n\tchatReset: () => createEditSource({ source: 'Chat.reset' } as const),\n\n\tinlineCompletionAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionAccept',\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineCompletionPartialAccept(data: { nes: boolean; requestUuid: string; languageId: string; providerId?: ProviderId; type: 'word' | 'line' }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineCompletionPartialAccept',\n\t\t\ttype: data.type,\n\t\t\t$nes: data.nes,\n\t\t\t...toProperties(data.providerId),\n\t\t\t$$requestUuid: data.requestUuid,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\tinlineChatApplyEdit(data: { modelId: string | undefined; requestId: string | undefined; sessionId: string | undefined; languageId: string; extensionId: VersionedExtensionId | undefined }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'inlineChat.applyEdits',\n\t\t\t$modelId: avoidPathRedaction(data.modelId),\n\t\t\t$extensionId: data.extensionId?.extensionId,\n\t\t\t$extensionVersion: data.extensionId?.version,\n\t\t\t$$sessionId: data.sessionId,\n\t\t\t$$requestId: data.requestId,\n\t\t\t$$languageId: data.languageId,\n\t\t} as const);\n\t},\n\n\treloadFromDisk: () => createEditSource({ source: 'reloadFromDisk' } as const),\n\n\tcursor(data: { kind: 'compositionType' | 'compositionEnd' | 'type' | 'paste' | 'cut' | 'executeCommands' | 'executeCommand'; detailedSource?: string | null }) {\n\t\treturn createEditSource({\n\t\t\tsource: 'cursor',\n\t\t\tkind: data.kind,\n\t\t\tdetailedSource: data.detailedSource,\n\t\t} as const);\n\t},\n\n\tsetValue: () => createEditSource({ source: 'setValue' } as const),\n\teolChange: () => createEditSource({ source: 'eolChange' } as const),\n\tapplyEdits: () => createEditSource({ source: 'applyEdits' } as const),\n\tsnippet: () => createEditSource({ source: 'snippet' } as const),\n\tsuggest: (data: { providerId: ProviderId | undefined }) => createEditSource({ source: 'suggest', ...toProperties(data.providerId) } as const),\n\n\tcodeAction: (data: { kind: string | undefined; providerId: ProviderId | undefined }) => createEditSource({ source: 'codeAction', $kind: data.kind, ...toProperties(data.providerId) } as const)\n};\n\nfunction toProperties(version: ProviderId | undefined) {\n\tif (!version) {\n\t\treturn {};\n\t}\n\treturn {\n\t\t$extensionId: version.extensionId,\n\t\t$extensionVersion: version.extensionVersion,\n\t\t$providerId: version.providerId,\n\t};\n}\n\ntype Values<T> = T[keyof T];\nexport type ITextModelEditSourceMetadata = Values<{ [TKey in keyof typeof EditSources]: ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\ntype ITextModelEditSourceMetadataKeys = Values<{ [TKey in keyof typeof EditSources]: keyof ReturnType<typeof EditSources[TKey]>['metadataT'] }>;\n\n\nfunction avoidPathRedaction(str: string | undefined): string | undefined {\n\tif (str === undefined) {\n\t\treturn undefined;\n\t}\n\t// To avoid false-positive file path redaction.\n\treturn str.replaceAll('/', '|');\n}\n\n\nexport class EditDeltaInfo {\n\tpublic static fromText(text: string): EditDeltaInfo {\n\t\tconst linesAdded = TextLength.ofText(text).lineCount;\n\t\tconst charsAdded = text.length;\n\t\treturn new EditDeltaInfo(linesAdded, 0, charsAdded, 0);\n\t}\n\n\tpublic static tryCreate(\n\t\tlinesAdded: number | undefined,\n\t\tlinesRemoved: number | undefined,\n\t\tcharsAdded: number | undefined,\n\t\tcharsRemoved: number | undefined\n\t): EditDeltaInfo | undefined {\n\t\tif (linesAdded === undefined || linesRemoved === undefined || charsAdded === undefined || charsRemoved === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new EditDeltaInfo(linesAdded, linesRemoved, charsAdded, charsRemoved);\n\t}\n\n\tconstructor(\n\t\tpublic readonly linesAdded: number,\n\t\tpublic readonly linesRemoved: number,\n\t\tpublic readonly charsAdded: number,\n\t\tpublic readonly charsRemoved: number\n\t) { }\n}\n\n\n/**\n * This is an opaque serializable type that represents a unique identity for an edit.\n */\nexport interface EditSuggestionId {\n}\n\nexport namespace EditSuggestionId {\n\t/**\n\t * Use AiEditTelemetryServiceImpl to create a new id!\n\t*/\n\texport function newId(): EditSuggestionId {\n\t\tconst id = prefixedUuid('sgt');\n\t\treturn toEditIdentity(id);\n\t}\n}\n\nfunction toEditIdentity(id: string): EditSuggestionId {\n\treturn id as unknown as EditSuggestionId;\n}\n"]}
|
package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js
CHANGED
|
@@ -17,6 +17,7 @@ import { ColorDetector } from '../colorDetector.js';
|
|
|
17
17
|
import { ColorPickerWidget } from '../colorPickerWidget.js';
|
|
18
18
|
import { RenderedHoverParts } from '../../../hover/browser/hoverTypes.js';
|
|
19
19
|
import { IThemeService } from '../../../../../platform/theme/common/themeService.js';
|
|
20
|
+
import * as nls from '../../../../../nls.js';
|
|
20
21
|
import { createColorHover, updateColorPresentations, updateEditorModel } from '../colorPickerParticipantUtils.js';
|
|
21
22
|
import { Dimension } from '../../../../../base/browser/dom.js';
|
|
22
23
|
import { DisposableStore } from '../../../../../base/common/lifecycle.js';
|
|
@@ -125,6 +126,9 @@ let HoverColorPickerParticipant = class HoverColorPickerParticipant {
|
|
|
125
126
|
};
|
|
126
127
|
return new RenderedHoverParts([renderedHoverPart]);
|
|
127
128
|
}
|
|
129
|
+
getAccessibleContent(hoverPart) {
|
|
130
|
+
return nls.localize(887, 'There is a color picker here.');
|
|
131
|
+
}
|
|
128
132
|
handleResize() {
|
|
129
133
|
this._colorPicker?.layout();
|
|
130
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.ts","vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAG5E,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAyI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACjN,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAoC,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEpJ,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI1E,MAAM,OAAO,UAAU;IAQtB,YACiB,KAA0C,EAC1C,KAAY,EACZ,KAAuB,EACvB,QAA+B;QAH/B,UAAK,GAAL,KAAK,CAAqC;QAC1C,UAAK,GAAL,KAAK,CAAO;QACZ,UAAK,GAAL,KAAK,CAAkB;QACvB,aAAQ,GAAR,QAAQ,CAAuB;QAVhD;;;WAGG;QACa,qBAAgB,GAAY,IAAI,CAAC;IAO7C,CAAC;IAEE,qBAAqB,CAAC,MAAmB;QAC/C,OAAO,CACN,MAAM,CAAC,IAAI,kCAA0B;eAClC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW;eAClD,IAAI,CAAC,KAAK,CAAC,SAAS,IA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M,CAAC;gBACP,OAAO,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,EAAE,CAAC;YAChB,CAAC;QACF,CAAC,CAAC,CAAC,CAAC;QACJ,MAAM,iBAAiB,GAAmC;YACzD,SAAS,EAAE,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC;YACrD,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YACvC,OAAO,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;SACpC,CAAC;QACF,OAAO,IAAI,kBAAkB,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;IAEM,qBAAqB;QAC3B,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAC/B,CAAC;IAEM,oBAAoB;QAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5B,CAAC;CACD,CAAA;AAlHY,2BAA2B;IAQrC,WAAA,aAAa,CAAA;GARH,2BAA2B,CAkHvC","file":"hoverColorPickerParticipant.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 { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken } from '../../../../../base/common/cancellation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { IModelDecoration } from '../../../../common/model.js';\nimport { DocumentColorProvider } from '../../../../common/languages.js';\nimport { ColorDetector } from '../colorDetector.js';\nimport { ColorPickerModel } from '../colorPickerModel.js';\nimport { ColorPickerWidget } from '../colorPickerWidget.js';\nimport { HoverAnchor, HoverAnchorType, IEditorHoverParticipant, IEditorHoverRenderContext, IHoverPart, IRenderedHoverPart, IRenderedHoverParts, RenderedHoverParts } from '../../../hover/browser/hoverTypes.js';\nimport { IThemeService } from '../../../../../platform/theme/common/themeService.js';\nimport { BaseColor, ColorPickerWidgetType, createColorHover, updateColorPresentations, updateEditorModel } from '../colorPickerParticipantUtils.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { Dimension } from '../../../../../base/browser/dom.js';\nimport { DisposableStore } from '../../../../../base/common/lifecycle.js';\nimport { Color } from '../../../../../base/common/color.js';\nimport { HoverStartSource } from '../../../hover/browser/hoverOperation.js';\n\nexport class ColorHover implements IHoverPart, BaseColor {\n\n\t/**\n\t * Force the hover to always be rendered at this specific range,\n\t * even in the case of multiple hover parts.\n\t */\n\tpublic readonly forceShowAtRange: boolean = true;\n\n\tconstructor(\n\t\tpublic readonly owner: IEditorHoverParticipant<ColorHover>,\n\t\tpublic readonly range: Range,\n\t\tpublic readonly model: ColorPickerModel,\n\t\tpublic readonly provider: DocumentColorProvider\n\t) { }\n\n\tpublic isValidForHoverAnchor(anchor: HoverAnchor): boolean {\n\t\treturn (\n\t\t\tanchor.type === HoverAnchorType.Range\n\t\t\t&& this.range.startColumn <= anchor.range.startColumn\n\t\t\t&& this.range.endColumn >= anchor.range.endColumn\n\t\t);\n\t}\n\n\tpublic static fromBaseColor(owner: IEditorHoverParticipant<ColorHover>, color: BaseColor): ColorHover {\n\t\treturn new ColorHover(owner, color.range, color.model, color.provider);\n\t}\n}\n\nexport class HoverColorPickerParticipant implements IEditorHoverParticipant<ColorHover> {\n\n\tpublic readonly hoverOrdinal: number = 2;\n\n\tprivate _colorPicker: ColorPickerWidget | undefined;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) { }\n\n\tpublic computeSync(_anchor: HoverAnchor, _lineDecorations: IModelDecoration[], source: HoverStartSource): ColorHover[] {\n\t\treturn [];\n\t}\n\n\tpublic computeAsync(anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource, token: CancellationToken): AsyncIterableProducer<ColorHover> {\n\t\treturn AsyncIterableProducer.fromPromise(this._computeAsync(anchor, lineDecorations, source));\n\t}\n\n\tprivate async _computeAsync(_anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource): Promise<ColorHover[]> {\n\t\tif (!this._editor.hasModel()) {\n\t\t\treturn [];\n\t\t}\n\t\tif (!this._isValidRequest(source)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst colorDetector = ColorDetector.get(this._editor);\n\t\tif (!colorDetector) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const d of lineDecorations) {\n\t\t\tif (!colorDetector.isColorDecoration(d)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst colorData = colorDetector.getColorData(d.range.getStartPosition());\n\t\t\tif (colorData) {\n\t\t\t\tconst colorHover = ColorHover.fromBaseColor(this, await createColorHover(this._editor.getModel(), colorData.colorInfo, colorData.provider));\n\t\t\t\treturn [colorHover];\n\t\t\t}\n\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate _isValidRequest(source: HoverStartSource): boolean {\n\t\tconst decoratorActivatedOn = this._editor.getOption(EditorOption.colorDecoratorsActivatedOn);\n\t\tswitch (source) {\n\t\t\tcase HoverStartSource.Mouse:\n\t\t\t\treturn decoratorActivatedOn === 'hover' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Click:\n\t\t\t\treturn decoratorActivatedOn === 'click' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Keyboard:\n\t\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic renderHoverParts(context: IEditorHoverRenderContext, hoverParts: ColorHover[]): IRenderedHoverParts<ColorHover> {\n\t\tconst editor = this._editor;\n\t\tif (hoverParts.length === 0 || !editor.hasModel()) {\n\t\t\treturn new RenderedHoverParts([]);\n\t\t}\n\t\tconst minimumHeight = editor.getOption(EditorOption.lineHeight) + 8;\n\t\tcontext.setMinimumDimensions(new Dimension(302, minimumHeight));\n\n\t\tconst disposables = new DisposableStore();\n\t\tconst colorHover = hoverParts[0];\n\t\tconst editorModel = editor.getModel();\n\t\tconst model = colorHover.model;\n\t\tthis._colorPicker = disposables.add(new ColorPickerWidget(context.fragment, model, editor.getOption(EditorOption.pixelRatio), this._themeService, ColorPickerWidgetType.Hover));\n\n\t\tlet editorUpdatedByColorPicker = false;\n\t\tlet range = new Range(colorHover.range.startLineNumber, colorHover.range.startColumn, colorHover.range.endLineNumber, colorHover.range.endColumn);\n\n\t\tdisposables.add(model.onColorFlushed(async (color: Color) => {\n\t\t\tawait updateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t\teditorUpdatedByColorPicker = true;\n\t\t\trange = updateEditorModel(editor, range, model);\n\t\t}));\n\t\tdisposables.add(model.onDidChangeColor((color: Color) => {\n\t\t\tupdateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t}));\n\t\tdisposables.add(editor.onDidChangeModelContent((e) => {\n\t\t\tif (editorUpdatedByColorPicker) {\n\t\t\t\teditorUpdatedByColorPicker = false;\n\t\t\t} else {\n\t\t\t\tcontext.hide();\n\t\t\t\teditor.focus();\n\t\t\t}\n\t\t}));\n\t\tconst renderedHoverPart: IRenderedHoverPart<ColorHover> = {\n\t\t\thoverPart: ColorHover.fromBaseColor(this, colorHover),\n\t\t\thoverElement: this._colorPicker.domNode,\n\t\t\tdispose() { disposables.dispose(); }\n\t\t};\n\t\treturn new RenderedHoverParts([renderedHoverPart]);\n\t}\n\n\tpublic handleResize(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleContentsChanged(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleHide(): void {\n\t\tthis._colorPicker?.dispose();\n\t\tthis._colorPicker = undefined;\n\t}\n\n\tpublic isColorPickerVisible(): boolean {\n\t\treturn !!this._colorPicker;\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 { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken } from '../../../../../base/common/cancellation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { IModelDecoration } from '../../../../common/model.js';\nimport { DocumentColorProvider } from '../../../../common/languages.js';\nimport { ColorDetector } from '../colorDetector.js';\nimport { ColorPickerModel } from '../colorPickerModel.js';\nimport { ColorPickerWidget } from '../colorPickerWidget.js';\nimport { HoverAnchor, HoverAnchorType, IEditorHoverParticipant, IEditorHoverRenderContext, IHoverPart, IRenderedHoverPart, IRenderedHoverParts, RenderedHoverParts } from '../../../hover/browser/hoverTypes.js';\nimport { IThemeService } from '../../../../../platform/theme/common/themeService.js';\nimport { BaseColor, ColorPickerWidgetType, createColorHover, updateColorPresentations, updateEditorModel } from '../colorPickerParticipantUtils.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { Dimension } from '../../../../../base/browser/dom.js';\nimport { DisposableStore } from '../../../../../base/common/lifecycle.js';\nimport { Color } from '../../../../../base/common/color.js';\nimport { HoverStartSource } from '../../../hover/browser/hoverOperation.js';\n\nexport class ColorHover implements IHoverPart, BaseColor {\n\n\t/**\n\t * Force the hover to always be rendered at this specific range,\n\t * even in the case of multiple hover parts.\n\t */\n\tpublic readonly forceShowAtRange: boolean = true;\n\n\tconstructor(\n\t\tpublic readonly owner: IEditorHoverParticipant<ColorHover>,\n\t\tpublic readonly range: Range,\n\t\tpublic readonly model: ColorPickerModel,\n\t\tpublic readonly provider: DocumentColorProvider\n\t) { }\n\n\tpublic isValidForHoverAnchor(anchor: HoverAnchor): boolean {\n\t\treturn (\n\t\t\tanchor.type === HoverAnchorType.Range\n\t\t\t&& this.range.startColumn <= anchor.range.startColumn\n\t\t\t&& this.range.endColumn >= anchor.range.endColumn\n\t\t);\n\t}\n\n\tpublic static fromBaseColor(owner: IEditorHoverParticipant<ColorHover>, color: BaseColor): ColorHover {\n\t\treturn new ColorHover(owner, color.range, color.model, color.provider);\n\t}\n}\n\nexport class HoverColorPickerParticipant implements IEditorHoverParticipant<ColorHover> {\n\n\tpublic readonly hoverOrdinal: number = 2;\n\n\tprivate _colorPicker: ColorPickerWidget | undefined;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) { }\n\n\tpublic computeSync(_anchor: HoverAnchor, _lineDecorations: IModelDecoration[], source: HoverStartSource): ColorHover[] {\n\t\treturn [];\n\t}\n\n\tpublic computeAsync(anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource, token: CancellationToken): AsyncIterableProducer<ColorHover> {\n\t\treturn AsyncIterableProducer.fromPromise(this._computeAsync(anchor, lineDecorations, source));\n\t}\n\n\tprivate async _computeAsync(_anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource): Promise<ColorHover[]> {\n\t\tif (!this._editor.hasModel()) {\n\t\t\treturn [];\n\t\t}\n\t\tif (!this._isValidRequest(source)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst colorDetector = ColorDetector.get(this._editor);\n\t\tif (!colorDetector) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const d of lineDecorations) {\n\t\t\tif (!colorDetector.isColorDecoration(d)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst colorData = colorDetector.getColorData(d.range.getStartPosition());\n\t\t\tif (colorData) {\n\t\t\t\tconst colorHover = ColorHover.fromBaseColor(this, await createColorHover(this._editor.getModel(), colorData.colorInfo, colorData.provider));\n\t\t\t\treturn [colorHover];\n\t\t\t}\n\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate _isValidRequest(source: HoverStartSource): boolean {\n\t\tconst decoratorActivatedOn = this._editor.getOption(EditorOption.colorDecoratorsActivatedOn);\n\t\tswitch (source) {\n\t\t\tcase HoverStartSource.Mouse:\n\t\t\t\treturn decoratorActivatedOn === 'hover' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Click:\n\t\t\t\treturn decoratorActivatedOn === 'click' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Keyboard:\n\t\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic renderHoverParts(context: IEditorHoverRenderContext, hoverParts: ColorHover[]): IRenderedHoverParts<ColorHover> {\n\t\tconst editor = this._editor;\n\t\tif (hoverParts.length === 0 || !editor.hasModel()) {\n\t\t\treturn new RenderedHoverParts([]);\n\t\t}\n\t\tconst minimumHeight = editor.getOption(EditorOption.lineHeight) + 8;\n\t\tcontext.setMinimumDimensions(new Dimension(302, minimumHeight));\n\n\t\tconst disposables = new DisposableStore();\n\t\tconst colorHover = hoverParts[0];\n\t\tconst editorModel = editor.getModel();\n\t\tconst model = colorHover.model;\n\t\tthis._colorPicker = disposables.add(new ColorPickerWidget(context.fragment, model, editor.getOption(EditorOption.pixelRatio), this._themeService, ColorPickerWidgetType.Hover));\n\n\t\tlet editorUpdatedByColorPicker = false;\n\t\tlet range = new Range(colorHover.range.startLineNumber, colorHover.range.startColumn, colorHover.range.endLineNumber, colorHover.range.endColumn);\n\n\t\tdisposables.add(model.onColorFlushed(async (color: Color) => {\n\t\t\tawait updateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t\teditorUpdatedByColorPicker = true;\n\t\t\trange = updateEditorModel(editor, range, model);\n\t\t}));\n\t\tdisposables.add(model.onDidChangeColor((color: Color) => {\n\t\t\tupdateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t}));\n\t\tdisposables.add(editor.onDidChangeModelContent((e) => {\n\t\t\tif (editorUpdatedByColorPicker) {\n\t\t\t\teditorUpdatedByColorPicker = false;\n\t\t\t} else {\n\t\t\t\tcontext.hide();\n\t\t\t\teditor.focus();\n\t\t\t}\n\t\t}));\n\t\tconst renderedHoverPart: IRenderedHoverPart<ColorHover> = {\n\t\t\thoverPart: ColorHover.fromBaseColor(this, colorHover),\n\t\t\thoverElement: this._colorPicker.domNode,\n\t\t\tdispose() { disposables.dispose(); }\n\t\t};\n\t\treturn new RenderedHoverParts([renderedHoverPart]);\n\t}\n\n\tpublic handleResize(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleContentsChanged(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleHide(): void {\n\t\tthis._colorPicker?.dispose();\n\t\tthis._colorPicker = undefined;\n\t}\n\n\tpublic isColorPickerVisible(): boolean {\n\t\treturn !!this._colorPicker;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAG5E,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAyI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACjN,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAoC,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEpJ,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI1E,MAAM,OAAO,UAAU;IA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B;QAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5B,CAAC;CACD,CAAA;AAtHY,2BAA2B;IAQrC,WAAA,aAAa,CAAA;GARH,2BAA2B,CAsHvC","file":"hoverColorPickerParticipant.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 { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken } from '../../../../../base/common/cancellation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { IModelDecoration } from '../../../../common/model.js';\nimport { DocumentColorProvider } from '../../../../common/languages.js';\nimport { ColorDetector } from '../colorDetector.js';\nimport { ColorPickerModel } from '../colorPickerModel.js';\nimport { ColorPickerWidget } from '../colorPickerWidget.js';\nimport { HoverAnchor, HoverAnchorType, IEditorHoverParticipant, IEditorHoverRenderContext, IHoverPart, IRenderedHoverPart, IRenderedHoverParts, RenderedHoverParts } from '../../../hover/browser/hoverTypes.js';\nimport { IThemeService } from '../../../../../platform/theme/common/themeService.js';\nimport * as nls from '../../../../../nls.js';\nimport { BaseColor, ColorPickerWidgetType, createColorHover, updateColorPresentations, updateEditorModel } from '../colorPickerParticipantUtils.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { Dimension } from '../../../../../base/browser/dom.js';\nimport { DisposableStore } from '../../../../../base/common/lifecycle.js';\nimport { Color } from '../../../../../base/common/color.js';\nimport { HoverStartSource } from '../../../hover/browser/hoverOperation.js';\n\nexport class ColorHover implements IHoverPart, BaseColor {\n\n\t/**\n\t * Force the hover to always be rendered at this specific range,\n\t * even in the case of multiple hover parts.\n\t */\n\tpublic readonly forceShowAtRange: boolean = true;\n\n\tconstructor(\n\t\tpublic readonly owner: IEditorHoverParticipant<ColorHover>,\n\t\tpublic readonly range: Range,\n\t\tpublic readonly model: ColorPickerModel,\n\t\tpublic readonly provider: DocumentColorProvider\n\t) { }\n\n\tpublic isValidForHoverAnchor(anchor: HoverAnchor): boolean {\n\t\treturn (\n\t\t\tanchor.type === HoverAnchorType.Range\n\t\t\t&& this.range.startColumn <= anchor.range.startColumn\n\t\t\t&& this.range.endColumn >= anchor.range.endColumn\n\t\t);\n\t}\n\n\tpublic static fromBaseColor(owner: IEditorHoverParticipant<ColorHover>, color: BaseColor): ColorHover {\n\t\treturn new ColorHover(owner, color.range, color.model, color.provider);\n\t}\n}\n\nexport class HoverColorPickerParticipant implements IEditorHoverParticipant<ColorHover> {\n\n\tpublic readonly hoverOrdinal: number = 2;\n\n\tprivate _colorPicker: ColorPickerWidget | undefined;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) { }\n\n\tpublic computeSync(_anchor: HoverAnchor, _lineDecorations: IModelDecoration[], source: HoverStartSource): ColorHover[] {\n\t\treturn [];\n\t}\n\n\tpublic computeAsync(anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource, token: CancellationToken): AsyncIterableProducer<ColorHover> {\n\t\treturn AsyncIterableProducer.fromPromise(this._computeAsync(anchor, lineDecorations, source));\n\t}\n\n\tprivate async _computeAsync(_anchor: HoverAnchor, lineDecorations: IModelDecoration[], source: HoverStartSource): Promise<ColorHover[]> {\n\t\tif (!this._editor.hasModel()) {\n\t\t\treturn [];\n\t\t}\n\t\tif (!this._isValidRequest(source)) {\n\t\t\treturn [];\n\t\t}\n\t\tconst colorDetector = ColorDetector.get(this._editor);\n\t\tif (!colorDetector) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const d of lineDecorations) {\n\t\t\tif (!colorDetector.isColorDecoration(d)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst colorData = colorDetector.getColorData(d.range.getStartPosition());\n\t\t\tif (colorData) {\n\t\t\t\tconst colorHover = ColorHover.fromBaseColor(this, await createColorHover(this._editor.getModel(), colorData.colorInfo, colorData.provider));\n\t\t\t\treturn [colorHover];\n\t\t\t}\n\n\t\t}\n\t\treturn [];\n\t}\n\n\tprivate _isValidRequest(source: HoverStartSource): boolean {\n\t\tconst decoratorActivatedOn = this._editor.getOption(EditorOption.colorDecoratorsActivatedOn);\n\t\tswitch (source) {\n\t\t\tcase HoverStartSource.Mouse:\n\t\t\t\treturn decoratorActivatedOn === 'hover' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Click:\n\t\t\t\treturn decoratorActivatedOn === 'click' || decoratorActivatedOn === 'clickAndHover';\n\t\t\tcase HoverStartSource.Keyboard:\n\t\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic renderHoverParts(context: IEditorHoverRenderContext, hoverParts: ColorHover[]): IRenderedHoverParts<ColorHover> {\n\t\tconst editor = this._editor;\n\t\tif (hoverParts.length === 0 || !editor.hasModel()) {\n\t\t\treturn new RenderedHoverParts([]);\n\t\t}\n\t\tconst minimumHeight = editor.getOption(EditorOption.lineHeight) + 8;\n\t\tcontext.setMinimumDimensions(new Dimension(302, minimumHeight));\n\n\t\tconst disposables = new DisposableStore();\n\t\tconst colorHover = hoverParts[0];\n\t\tconst editorModel = editor.getModel();\n\t\tconst model = colorHover.model;\n\t\tthis._colorPicker = disposables.add(new ColorPickerWidget(context.fragment, model, editor.getOption(EditorOption.pixelRatio), this._themeService, ColorPickerWidgetType.Hover));\n\n\t\tlet editorUpdatedByColorPicker = false;\n\t\tlet range = new Range(colorHover.range.startLineNumber, colorHover.range.startColumn, colorHover.range.endLineNumber, colorHover.range.endColumn);\n\n\t\tdisposables.add(model.onColorFlushed(async (color: Color) => {\n\t\t\tawait updateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t\teditorUpdatedByColorPicker = true;\n\t\t\trange = updateEditorModel(editor, range, model);\n\t\t}));\n\t\tdisposables.add(model.onDidChangeColor((color: Color) => {\n\t\t\tupdateColorPresentations(editorModel, model, color, range, colorHover);\n\t\t}));\n\t\tdisposables.add(editor.onDidChangeModelContent((e) => {\n\t\t\tif (editorUpdatedByColorPicker) {\n\t\t\t\teditorUpdatedByColorPicker = false;\n\t\t\t} else {\n\t\t\t\tcontext.hide();\n\t\t\t\teditor.focus();\n\t\t\t}\n\t\t}));\n\t\tconst renderedHoverPart: IRenderedHoverPart<ColorHover> = {\n\t\t\thoverPart: ColorHover.fromBaseColor(this, colorHover),\n\t\t\thoverElement: this._colorPicker.domNode,\n\t\t\tdispose() { disposables.dispose(); }\n\t\t};\n\t\treturn new RenderedHoverParts([renderedHoverPart]);\n\t}\n\n\tpublic getAccessibleContent(hoverPart: ColorHover): string {\n\t\treturn nls.localize('hoverAccessibilityColorParticipant', 'There is a color picker here.');\n\t}\n\n\tpublic handleResize(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleContentsChanged(): void {\n\t\tthis._colorPicker?.layout();\n\t}\n\n\tpublic handleHide(): void {\n\t\tthis._colorPicker?.dispose();\n\t\tthis._colorPicker = undefined;\n\t}\n\n\tpublic isColorPickerVisible(): boolean {\n\t\treturn !!this._colorPicker;\n\t}\n}\n"]}
|
|
@@ -12,15 +12,15 @@ export class ShowOrFocusStandaloneColorPicker extends EditorAction2 {
|
|
|
12
12
|
super({
|
|
13
13
|
id: 'editor.action.showOrFocusStandaloneColorPicker',
|
|
14
14
|
title: {
|
|
15
|
-
...localize2(
|
|
16
|
-
mnemonicTitle: localize(
|
|
15
|
+
...localize2(889, "Show or Focus Standalone Color Picker"),
|
|
16
|
+
mnemonicTitle: localize(888, "&&Show or Focus Standalone Color Picker"),
|
|
17
17
|
},
|
|
18
18
|
precondition: undefined,
|
|
19
19
|
menu: [
|
|
20
20
|
{ id: MenuId.CommandPalette },
|
|
21
21
|
],
|
|
22
22
|
metadata: {
|
|
23
|
-
description: localize2(
|
|
23
|
+
description: localize2(890, "Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors."),
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -32,7 +32,7 @@ export class HideStandaloneColorPicker extends EditorAction {
|
|
|
32
32
|
constructor() {
|
|
33
33
|
super({
|
|
34
34
|
id: 'editor.action.hideColorPicker',
|
|
35
|
-
label: localize2(
|
|
35
|
+
label: localize2(891, "Hide the Color Picker"),
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ export class HideStandaloneColorPicker extends EditorAction {
|
|
|
44
44
|
weight: 100 /* KeybindingWeight.EditorContrib */
|
|
45
45
|
},
|
|
46
46
|
metadata: {
|
|
47
|
-
description: localize2(
|
|
47
|
+
description: localize2(892, "Hide the standalone color picker."),
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -56,7 +56,7 @@ export class InsertColorWithStandaloneColorPicker extends EditorAction {
|
|
|
56
56
|
constructor() {
|
|
57
57
|
super({
|
|
58
58
|
id: 'editor.action.insertColorWithStandaloneColorPicker',
|
|
59
|
-
label: localize2(
|
|
59
|
+
label: localize2(893, "Insert Color with Standalone Color Picker"),
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -68,7 +68,7 @@ export class InsertColorWithStandaloneColorPicker extends EditorAction {
|
|
|
68
68
|
weight: 100 /* KeybindingWeight.EditorContrib */
|
|
69
69
|
},
|
|
70
70
|
metadata: {
|
|
71
|
-
description: localize2(
|
|
71
|
+
description: localize2(894, "Insert hex/rgb/hsl colors with the focused standalone color picker."),
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -56,7 +56,7 @@ class ToggleCommentLineAction extends CommentLineAction {
|
|
|
56
56
|
constructor() {
|
|
57
57
|
super(0 /* Type.Toggle */, {
|
|
58
58
|
id: 'editor.action.commentLine',
|
|
59
|
-
label: nls.localize2(
|
|
59
|
+
label: nls.localize2(897, "Toggle Line Comment"),
|
|
60
60
|
precondition: EditorContextKeys.writable,
|
|
61
61
|
kbOpts: {
|
|
62
62
|
kbExpr: EditorContextKeys.editorTextFocus,
|
|
@@ -66,7 +66,7 @@ class ToggleCommentLineAction extends CommentLineAction {
|
|
|
66
66
|
menuOpts: {
|
|
67
67
|
menuId: MenuId.MenubarEditMenu,
|
|
68
68
|
group: '5_insert',
|
|
69
|
-
title: nls.localize(
|
|
69
|
+
title: nls.localize(895, "&&Toggle Line Comment"),
|
|
70
70
|
order: 1
|
|
71
71
|
},
|
|
72
72
|
canTriggerInlineEdits: true,
|
|
@@ -77,7 +77,7 @@ class AddLineCommentAction extends CommentLineAction {
|
|
|
77
77
|
constructor() {
|
|
78
78
|
super(1 /* Type.ForceAdd */, {
|
|
79
79
|
id: 'editor.action.addCommentLine',
|
|
80
|
-
label: nls.localize2(
|
|
80
|
+
label: nls.localize2(898, "Add Line Comment"),
|
|
81
81
|
precondition: EditorContextKeys.writable,
|
|
82
82
|
kbOpts: {
|
|
83
83
|
kbExpr: EditorContextKeys.editorTextFocus,
|
|
@@ -92,7 +92,7 @@ class RemoveLineCommentAction extends CommentLineAction {
|
|
|
92
92
|
constructor() {
|
|
93
93
|
super(2 /* Type.ForceRemove */, {
|
|
94
94
|
id: 'editor.action.removeCommentLine',
|
|
95
|
-
label: nls.localize2(
|
|
95
|
+
label: nls.localize2(899, "Remove Line Comment"),
|
|
96
96
|
precondition: EditorContextKeys.writable,
|
|
97
97
|
kbOpts: {
|
|
98
98
|
kbExpr: EditorContextKeys.editorTextFocus,
|
|
@@ -107,7 +107,7 @@ class BlockCommentAction extends EditorAction {
|
|
|
107
107
|
constructor() {
|
|
108
108
|
super({
|
|
109
109
|
id: 'editor.action.blockComment',
|
|
110
|
-
label: nls.localize2(
|
|
110
|
+
label: nls.localize2(900, "Toggle Block Comment"),
|
|
111
111
|
precondition: EditorContextKeys.writable,
|
|
112
112
|
kbOpts: {
|
|
113
113
|
kbExpr: EditorContextKeys.editorTextFocus,
|
|
@@ -118,7 +118,7 @@ class BlockCommentAction extends EditorAction {
|
|
|
118
118
|
menuOpts: {
|
|
119
119
|
menuId: MenuId.MenubarEditMenu,
|
|
120
120
|
group: '5_insert',
|
|
121
|
-
title: nls.localize(
|
|
121
|
+
title: nls.localize(896, "Toggle &&Block Comment"),
|
|
122
122
|
order: 2
|
|
123
123
|
},
|
|
124
124
|
canTriggerInlineEdits: true,
|
|
@@ -247,7 +247,7 @@ let ContextMenuController = class ContextMenuController {
|
|
|
247
247
|
};
|
|
248
248
|
const actions = [];
|
|
249
249
|
actions.push(createAction({
|
|
250
|
-
label: nls.localize(
|
|
250
|
+
label: nls.localize(901, "Minimap"),
|
|
251
251
|
checked: minimapOptions.enabled,
|
|
252
252
|
run: () => {
|
|
253
253
|
this._configurationService.updateValue(`editor.minimap.enabled`, !minimapOptions.enabled);
|
|
@@ -255,28 +255,28 @@ let ContextMenuController = class ContextMenuController {
|
|
|
255
255
|
}));
|
|
256
256
|
actions.push(new Separator());
|
|
257
257
|
actions.push(createAction({
|
|
258
|
-
label: nls.localize(
|
|
258
|
+
label: nls.localize(902, "Render Characters"),
|
|
259
259
|
enabled: minimapOptions.enabled,
|
|
260
260
|
checked: minimapOptions.renderCharacters,
|
|
261
261
|
run: () => {
|
|
262
262
|
this._configurationService.updateValue(`editor.minimap.renderCharacters`, !minimapOptions.renderCharacters);
|
|
263
263
|
}
|
|
264
264
|
}));
|
|
265
|
-
actions.push(createEnumAction(nls.localize(
|
|
266
|
-
label: nls.localize(
|
|
265
|
+
actions.push(createEnumAction(nls.localize(903, "Vertical size"), minimapOptions.enabled, 'editor.minimap.size', minimapOptions.size, [{
|
|
266
|
+
label: nls.localize(904, "Proportional"),
|
|
267
267
|
value: 'proportional'
|
|
268
268
|
}, {
|
|
269
|
-
label: nls.localize(
|
|
269
|
+
label: nls.localize(905, "Fill"),
|
|
270
270
|
value: 'fill'
|
|
271
271
|
}, {
|
|
272
|
-
label: nls.localize(
|
|
272
|
+
label: nls.localize(906, "Fit"),
|
|
273
273
|
value: 'fit'
|
|
274
274
|
}]));
|
|
275
|
-
actions.push(createEnumAction(nls.localize(
|
|
276
|
-
label: nls.localize(
|
|
275
|
+
actions.push(createEnumAction(nls.localize(907, "Slider"), minimapOptions.enabled, 'editor.minimap.showSlider', minimapOptions.showSlider, [{
|
|
276
|
+
label: nls.localize(908, "Mouse Over"),
|
|
277
277
|
value: 'mouseover'
|
|
278
278
|
}, {
|
|
279
|
-
label: nls.localize(
|
|
279
|
+
label: nls.localize(909, "Always"),
|
|
280
280
|
value: 'always'
|
|
281
281
|
}]));
|
|
282
282
|
const useShadowDOM = this._editor.getOption(144 /* EditorOption.useShadowDOM */) && !isIOS; // Do not use shadow dom on IOS #122035
|
|
@@ -315,7 +315,7 @@ class ShowContextMenu extends EditorAction {
|
|
|
315
315
|
constructor() {
|
|
316
316
|
super({
|
|
317
317
|
id: 'editor.action.showContextMenu',
|
|
318
|
-
label: nls.localize2(
|
|
318
|
+
label: nls.localize2(910, "Show Editor Context Menu"),
|
|
319
319
|
precondition: undefined,
|
|
320
320
|
kbOpts: {
|
|
321
321
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -100,7 +100,7 @@ export class CursorUndo extends EditorAction {
|
|
|
100
100
|
constructor() {
|
|
101
101
|
super({
|
|
102
102
|
id: 'cursorUndo',
|
|
103
|
-
label: nls.localize2(
|
|
103
|
+
label: nls.localize2(911, "Cursor Undo"),
|
|
104
104
|
precondition: undefined,
|
|
105
105
|
kbOpts: {
|
|
106
106
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -117,7 +117,7 @@ export class CursorRedo extends EditorAction {
|
|
|
117
117
|
constructor() {
|
|
118
118
|
super({
|
|
119
119
|
id: 'cursorRedo',
|
|
120
|
-
label: nls.localize2(
|
|
120
|
+
label: nls.localize2(912, "Cursor Redo"),
|
|
121
121
|
precondition: undefined
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -51,7 +51,7 @@ registerEditorAction(class PasteAsAction extends EditorAction {
|
|
|
51
51
|
properties: {
|
|
52
52
|
kind: {
|
|
53
53
|
type: 'string',
|
|
54
|
-
description: nls.localize(
|
|
54
|
+
description: nls.localize(913, "The kind of the paste edit to try pasting with.\nIf there are multiple edits for this kind, the editor will show a picker. If there are no edits of this kind, the editor will show an error message."),
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
},
|
|
@@ -61,7 +61,7 @@ registerEditorAction(class PasteAsAction extends EditorAction {
|
|
|
61
61
|
properties: {
|
|
62
62
|
preferences: {
|
|
63
63
|
type: 'array',
|
|
64
|
-
description: nls.localize(
|
|
64
|
+
description: nls.localize(914, "List of preferred paste edit kind to try applying.\nThe first edit matching the preferences will be applied."),
|
|
65
65
|
items: { type: 'string' }
|
|
66
66
|
}
|
|
67
67
|
},
|
|
@@ -71,7 +71,7 @@ registerEditorAction(class PasteAsAction extends EditorAction {
|
|
|
71
71
|
constructor() {
|
|
72
72
|
super({
|
|
73
73
|
id: pasteAsCommandId,
|
|
74
|
-
label: nls.localize2(
|
|
74
|
+
label: nls.localize2(915, "Paste As..."),
|
|
75
75
|
precondition: EditorContextKeys.writable,
|
|
76
76
|
metadata: {
|
|
77
77
|
description: 'Paste as',
|
|
@@ -100,7 +100,7 @@ registerEditorAction(class extends EditorAction {
|
|
|
100
100
|
constructor() {
|
|
101
101
|
super({
|
|
102
102
|
id: 'editor.action.pasteAsText',
|
|
103
|
-
label: nls.localize2(
|
|
103
|
+
label: nls.localize2(916, "Paste as Text"),
|
|
104
104
|
precondition: EditorContextKeys.writable,
|
|
105
105
|
canTriggerInlineEdits: true,
|
|
106
106
|
});
|
|
@@ -47,7 +47,7 @@ import { createCombinedWorkspaceEdit, sortEditsByYieldTo } from './edit.js';
|
|
|
47
47
|
import { PostEditWidgetManager } from './postEditWidget.js';
|
|
48
48
|
export const changePasteTypeCommandId = 'editor.changePasteType';
|
|
49
49
|
export const pasteAsPreferenceConfig = 'editor.pasteAs.preferences';
|
|
50
|
-
export const pasteWidgetVisibleCtx = new RawContextKey('pasteWidgetVisible', false, localize(
|
|
50
|
+
export const pasteWidgetVisibleCtx = new RawContextKey('pasteWidgetVisible', false, localize(917, "Whether the paste widget is showing"));
|
|
51
51
|
const vscodeClipboardMime = 'application/vnd.code.copymetadata';
|
|
52
52
|
let CopyPasteController = class CopyPasteController extends Disposable {
|
|
53
53
|
static { CopyPasteController_1 = this; }
|
|
@@ -71,7 +71,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
71
71
|
this._register(addDisposableListener(container, 'cut', e => this.handleCopy(e)));
|
|
72
72
|
this._register(addDisposableListener(container, 'paste', e => this.handlePaste(e), true));
|
|
73
73
|
this._pasteProgressManager = this._register(new InlineProgressManager('pasteIntoEditor', editor, instantiationService));
|
|
74
|
-
this._postPasteWidgetManager = this._register(instantiationService.createInstance(PostEditWidgetManager, 'pasteIntoEditor', editor, pasteWidgetVisibleCtx, { id: changePasteTypeCommandId, label: localize(
|
|
74
|
+
this._postPasteWidgetManager = this._register(instantiationService.createInstance(PostEditWidgetManager, 'pasteIntoEditor', editor, pasteWidgetVisibleCtx, { id: changePasteTypeCommandId, label: localize(918, "Show paste options...") }, () => CopyPasteController_1._configureDefaultAction ? [CopyPasteController_1._configureDefaultAction] : []));
|
|
75
75
|
}
|
|
76
76
|
changePasteType() {
|
|
77
77
|
this._postPasteWidgetManager.tryShowSelector();
|
|
@@ -245,9 +245,9 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
245
245
|
const kindLabel = 'only' in preference
|
|
246
246
|
? preference.only.value
|
|
247
247
|
: 'preferences' in preference
|
|
248
|
-
? (preference.preferences.length ? preference.preferences.map(preference => preference.value).join(', ') : localize(
|
|
248
|
+
? (preference.preferences.length ? preference.preferences.map(preference => preference.value).join(', ') : localize(919, "empty"))
|
|
249
249
|
: preference.providerId;
|
|
250
|
-
MessageController.get(this._editor)?.showMessage(localize(
|
|
250
|
+
MessageController.get(this._editor)?.showMessage(localize(920, "No paste edits for '{0}' found", kindLabel), selections[0].getStartPosition());
|
|
251
251
|
}
|
|
252
252
|
doPasteInline(allProviders, selections, dataTransfer, metadata, clipboardEvent) {
|
|
253
253
|
this._logService.trace('CopyPasteController#doPasteInline');
|
|
@@ -297,7 +297,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
297
297
|
}
|
|
298
298
|
const resolveP = edit.provider.resolveDocumentPasteEdit(edit, resolveToken);
|
|
299
299
|
const showP = new DeferredPromise();
|
|
300
|
-
const resolved = await this._pasteProgressManager.showWhile(selections[0].getEndPosition(), localize(
|
|
300
|
+
const resolved = await this._pasteProgressManager.showWhile(selections[0].getEndPosition(), localize(921, "Resolving paste edit for '{0}'. Click to cancel", edit.title), raceCancellation(Promise.race([showP.p, resolveP]), resolveToken), {
|
|
301
301
|
cancel: () => showP.cancel()
|
|
302
302
|
}, 0);
|
|
303
303
|
if (resolved) {
|
|
@@ -316,7 +316,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
|
-
this._pasteProgressManager.showWhile(selections[0].getEndPosition(), localize(
|
|
319
|
+
this._pasteProgressManager.showWhile(selections[0].getEndPosition(), localize(922, "Running paste handlers. Click to cancel and do basic paste"), p, {
|
|
320
320
|
cancel: async () => {
|
|
321
321
|
p.cancel();
|
|
322
322
|
if (editorStateCts.token.isCancellationRequested) {
|
|
@@ -388,7 +388,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
388
388
|
else {
|
|
389
389
|
const configureDefaultItem = {
|
|
390
390
|
id: 'editor.pasteAs.default',
|
|
391
|
-
label: localize(
|
|
391
|
+
label: localize(923, "Configure default paste action"),
|
|
392
392
|
edit: undefined,
|
|
393
393
|
};
|
|
394
394
|
const selected = await this._quickInputService.pick([
|
|
@@ -405,7 +405,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
405
405
|
}
|
|
406
406
|
] : [])
|
|
407
407
|
], {
|
|
408
|
-
placeHolder: localize(
|
|
408
|
+
placeHolder: localize(924, "Select Paste Action"),
|
|
409
409
|
});
|
|
410
410
|
if (selected === configureDefaultItem) {
|
|
411
411
|
CopyPasteController_1._configureDefaultAction?.run();
|
|
@@ -428,7 +428,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
|
|
|
428
428
|
});
|
|
429
429
|
this._progressService.withProgress({
|
|
430
430
|
location: 10 /* ProgressLocation.Window */,
|
|
431
|
-
title: localize(
|
|
431
|
+
title: localize(925, "Running paste handlers"),
|
|
432
432
|
}, () => p);
|
|
433
433
|
}
|
|
434
434
|
setCopyMetadata(dataTransfer, metadata) {
|
|
@@ -72,7 +72,7 @@ export class DefaultTextPasteOrDropEditProvider extends SimplePasteAndDropProvid
|
|
|
72
72
|
const insertText = await textEntry.asString();
|
|
73
73
|
return {
|
|
74
74
|
handledMimeType: Mimes.text,
|
|
75
|
-
title: localize(
|
|
75
|
+
title: localize(926, "Insert Plain Text"),
|
|
76
76
|
insertText,
|
|
77
77
|
kind: this.kind,
|
|
78
78
|
};
|
|
@@ -105,14 +105,14 @@ class PathProvider extends SimplePasteAndDropProvider {
|
|
|
105
105
|
if (uriCount > 0) {
|
|
106
106
|
// Dropping at least one generic uri (such as https) so use most generic label
|
|
107
107
|
label = entries.length > 1
|
|
108
|
-
? localize(
|
|
109
|
-
: localize(
|
|
108
|
+
? localize(927, "Insert Uris")
|
|
109
|
+
: localize(928, "Insert Uri");
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
112
112
|
// All the paths are file paths
|
|
113
113
|
label = entries.length > 1
|
|
114
|
-
? localize(
|
|
115
|
-
: localize(
|
|
114
|
+
? localize(929, "Insert Paths")
|
|
115
|
+
: localize(930, "Insert Path");
|
|
116
116
|
}
|
|
117
117
|
return {
|
|
118
118
|
handledMimeType: Mimes.uriList,
|
|
@@ -145,8 +145,8 @@ let RelativePathProvider = class RelativePathProvider extends SimplePasteAndDrop
|
|
|
145
145
|
handledMimeType: Mimes.uriList,
|
|
146
146
|
insertText: relativeUris.join(' '),
|
|
147
147
|
title: entries.length > 1
|
|
148
|
-
? localize(
|
|
149
|
-
: localize(
|
|
148
|
+
? localize(931, "Insert Relative Paths")
|
|
149
|
+
: localize(932, "Insert Relative Path"),
|
|
150
150
|
kind: this.kind,
|
|
151
151
|
};
|
|
152
152
|
}
|
|
@@ -176,7 +176,7 @@ class PasteHtmlProvider {
|
|
|
176
176
|
edits: [{
|
|
177
177
|
insertText: htmlText,
|
|
178
178
|
yieldTo: this._yieldTo,
|
|
179
|
-
title: localize(
|
|
179
|
+
title: localize(933, 'Insert HTML'),
|
|
180
180
|
kind: this.kind,
|
|
181
181
|
}],
|
|
182
182
|
};
|
|
@@ -34,7 +34,7 @@ import { sortEditsByYieldTo } from './edit.js';
|
|
|
34
34
|
import { PostEditWidgetManager } from './postEditWidget.js';
|
|
35
35
|
export const dropAsPreferenceConfig = 'editor.dropIntoEditor.preferences';
|
|
36
36
|
export const changeDropTypeCommandId = 'editor.changeDropType';
|
|
37
|
-
export const dropWidgetVisibleCtx = new RawContextKey('dropWidgetVisible', false, localize(
|
|
37
|
+
export const dropWidgetVisibleCtx = new RawContextKey('dropWidgetVisible', false, localize(934, "Whether the drop widget is showing"));
|
|
38
38
|
let DropIntoEditorController = class DropIntoEditorController extends Disposable {
|
|
39
39
|
static { DropIntoEditorController_1 = this; }
|
|
40
40
|
static { this.ID = 'editor.contrib.dropIntoEditorController'; }
|
|
@@ -48,7 +48,7 @@ let DropIntoEditorController = class DropIntoEditorController extends Disposable
|
|
|
48
48
|
this._treeViewsDragAndDropService = _treeViewsDragAndDropService;
|
|
49
49
|
this.treeItemsTransfer = LocalSelectionTransfer.getInstance();
|
|
50
50
|
this._dropProgressManager = this._register(instantiationService.createInstance(InlineProgressManager, 'dropIntoEditor', editor));
|
|
51
|
-
this._postDropWidgetManager = this._register(instantiationService.createInstance(PostEditWidgetManager, 'dropIntoEditor', editor, dropWidgetVisibleCtx, { id: changeDropTypeCommandId, label: localize(
|
|
51
|
+
this._postDropWidgetManager = this._register(instantiationService.createInstance(PostEditWidgetManager, 'dropIntoEditor', editor, dropWidgetVisibleCtx, { id: changeDropTypeCommandId, label: localize(935, "Show drop options...") }, () => DropIntoEditorController_1._configureDefaultAction ? [DropIntoEditorController_1._configureDefaultAction] : []));
|
|
52
52
|
this._register(editor.onDropIntoEditor(e => this.onDropIntoEditor(editor, e.position, e.event)));
|
|
53
53
|
}
|
|
54
54
|
clearWidgets() {
|
|
@@ -103,7 +103,7 @@ let DropIntoEditorController = class DropIntoEditorController extends Disposable
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
-
this._dropProgressManager.showWhile(position, localize(
|
|
106
|
+
this._dropProgressManager.showWhile(position, localize(936, "Running drop handlers. Click to cancel"), p, { cancel: () => p.cancel() });
|
|
107
107
|
DropIntoEditorController_1._currentDropOperation = p;
|
|
108
108
|
}
|
|
109
109
|
async getDropEdits(providers, model, position, dataTransfer, token) {
|
|
@@ -162,7 +162,7 @@ let PostEditWidgetManager = class PostEditWidgetManager extends Disposable {
|
|
|
162
162
|
resolvedEdit = await raceCancellationError(resolve(edit, editorStateCts.token), editorStateCts.token);
|
|
163
163
|
}
|
|
164
164
|
catch (e) {
|
|
165
|
-
return handleError(e, localize(
|
|
165
|
+
return handleError(e, localize(937, "Error resolving edit '{0}':\n{1}", edit.title, toErrorMessage(e)));
|
|
166
166
|
}
|
|
167
167
|
finally {
|
|
168
168
|
editorStateCts.dispose();
|
|
@@ -185,7 +185,7 @@ let PostEditWidgetManager = class PostEditWidgetManager extends Disposable {
|
|
|
185
185
|
editRange = model.getDecorationRange(editTrackingDecoration[0]);
|
|
186
186
|
}
|
|
187
187
|
catch (e) {
|
|
188
|
-
return handleError(e, localize(
|
|
188
|
+
return handleError(e, localize(938, "Error applying edit '{0}':\n{1}", edit.title, toErrorMessage(e)));
|
|
189
189
|
}
|
|
190
190
|
finally {
|
|
191
191
|
model.deltaDecorations(editTrackingDecoration, []);
|
|
@@ -10,7 +10,7 @@ import { createDecorator } from '../../../../platform/instantiation/common/insta
|
|
|
10
10
|
import { registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
|
11
11
|
import { localize } from '../../../../nls.js';
|
|
12
12
|
const IEditorCancellationTokens = createDecorator('IEditorCancelService');
|
|
13
|
-
const ctxCancellableOperation = new RawContextKey('cancellableOperation', false, localize(
|
|
13
|
+
const ctxCancellableOperation = new RawContextKey('cancellableOperation', false, localize(939, 'Whether the editor runs a cancellable operation, e.g. like \'Peek References\''));
|
|
14
14
|
registerSingleton(IEditorCancellationTokens, class {
|
|
15
15
|
constructor() {
|
|
16
16
|
this._tokens = new WeakMap();
|