Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/vs
diff options
context:
space:
mode:
authorJustin Chen <54879025+justschen@users.noreply.github.com>2022-07-27 08:59:29 +0300
committerGitHub <noreply@github.com>2022-07-27 08:59:29 +0300
commit13b1427953e2d1b0e691cb60cdd2163a1a78d027 (patch)
tree5d97495c0e71c181982273dcbd1ae0a196f2cbd4 /src/vs
parent181df9e79298a6da0b955967295ba840de2fdaf2 (diff)
parent19ac36abb68c9a00c3ef546427c3dbd7c9ed80b9 (diff)
Merge branch 'main' into justin/widgetPreview
Diffstat (limited to 'src/vs')
-rw-r--r--src/vs/editor/browser/widget/codeEditorWidget.ts4
-rw-r--r--src/vs/editor/browser/widget/diffEditorWidget.ts2
-rw-r--r--src/vs/editor/common/config/editorOptions.ts59
-rw-r--r--src/vs/editor/common/standalone/standaloneEnums.ts2
-rw-r--r--src/vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution.ts17
-rw-r--r--src/vs/monaco.d.ts21
-rw-r--r--src/vs/workbench/browser/parts/editor/editorDropTarget.ts2
-rw-r--r--src/vs/workbench/browser/parts/editor/textDiffEditor.ts4
-rw-r--r--src/vs/workbench/browser/parts/editor/textEditor.ts4
-rw-r--r--src/vs/workbench/browser/workbench.contribution.ts5
-rw-r--r--src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts2
-rw-r--r--src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts2
-rw-r--r--src/vs/workbench/contrib/scm/browser/scmViewPane.ts2
-rw-r--r--src/vs/workbench/electron-sandbox/desktop.contribution.ts1
14 files changed, 81 insertions, 46 deletions
diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts
index 0cc2cfa02af..bed9912d2d3 100644
--- a/src/vs/editor/browser/widget/codeEditorWidget.ts
+++ b/src/vs/editor/browser/widget/codeEditorWidget.ts
@@ -371,7 +371,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._register(new dom.DragAndDropObserver(this._domElement, {
onDragEnter: () => undefined,
onDragOver: e => {
- if (!this._configuration.options.get(EditorOption.enableDropIntoEditor)) {
+ if (!this._configuration.options.get(EditorOption.dropIntoEditor).enabled) {
return;
}
@@ -381,7 +381,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
}
},
onDrop: async e => {
- if (!this._configuration.options.get(EditorOption.enableDropIntoEditor)) {
+ if (!this._configuration.options.get(EditorOption.dropIntoEditor).enabled) {
return;
}
diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts
index ee1a5a107b9..ef1aa278e53 100644
--- a/src/vs/editor/browser/widget/diffEditorWidget.ts
+++ b/src/vs/editor/browser/widget/diffEditorWidget.ts
@@ -1189,7 +1189,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
result.ariaLabel = options.originalAriaLabel;
}
result.readOnly = !this._options.originalEditable;
- result.enableDropIntoEditor = !result.readOnly;
+ result.dropIntoEditor = { enabled: !result.readOnly };
result.extraEditorClassName = 'original-in-monaco-diff-editor';
return {
...result,
diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts
index 826aa1a6a72..066080e9ae3 100644
--- a/src/vs/editor/common/config/editorOptions.ts
+++ b/src/vs/editor/common/config/editorOptions.ts
@@ -665,11 +665,11 @@ export interface IEditorOptions {
bracketPairColorization?: IBracketPairColorizationOptions;
/**
- * Enables dropping into the editor from an external source.
+ * Controls dropping into the editor from an external source.
*
- * This shows a preview of the drop location and triggers an `onDropIntoEditor` event.
+ * When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.
*/
- enableDropIntoEditor?: boolean;
+ dropIntoEditor?: IDropIntoEditorOptions;
}
/**
@@ -4439,6 +4439,53 @@ class EditorWrappingInfoComputer extends ComputedEditorOption<EditorOption.wrapp
//#endregion
+//#region dropIntoEditor
+
+/**
+ * Configuration options for editor drop into behavior
+ */
+export interface IDropIntoEditorOptions {
+ /**
+ * Enable the dropping into editor.
+ * Defaults to true.
+ */
+ enabled?: boolean;
+}
+
+/**
+ * @internal
+ */
+export type EditorDropIntoEditorOptions = Readonly<Required<IDropIntoEditorOptions>>;
+
+class EditorDropIntoEditor extends BaseEditorOption<EditorOption.dropIntoEditor, IDropIntoEditorOptions, EditorDropIntoEditorOptions> {
+
+ constructor() {
+ const defaults: EditorDropIntoEditorOptions = { enabled: true };
+ super(
+ EditorOption.dropIntoEditor, 'dropIntoEditor', defaults,
+ {
+ 'editor.dropIntoEditor.enabled': {
+ type: 'boolean',
+ default: defaults.enabled,
+ markdownDescription: nls.localize('dropIntoEditor.enabled', "Controls whether you can drag and drop a file into a text editor by holding down `shift` (instead of opening the file in an editor)."),
+ },
+ }
+ );
+ }
+
+ public validate(_input: any): EditorDropIntoEditorOptions {
+ if (!_input || typeof _input !== 'object') {
+ return this.defaultValue;
+ }
+ const input = _input as IDropIntoEditorOptions;
+ return {
+ enabled: boolean(input.enabled, this.defaultValue.enabled)
+ };
+ }
+}
+
+//#endregion
+
const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace';
const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace';
const DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'monospace\', monospace';
@@ -4501,7 +4548,7 @@ export const enum EditorOption {
disableMonospaceOptimizations,
domReadOnly,
dragAndDrop,
- enableDropIntoEditor,
+ dropIntoEditor,
emptySelectionClipboard,
extraEditorClassName,
fastScrollSensitivity,
@@ -4811,9 +4858,7 @@ export const EditorOptions = {
{ description: nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.") }
)),
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
- enableDropIntoEditor: register(new EditorBooleanOption(
- EditorOption.enableDropIntoEditor, 'enableDropIntoEditor', true
- )),
+ dropIntoEditor: register(new EditorDropIntoEditor()),
extraEditorClassName: register(new EditorStringOption(
EditorOption.extraEditorClassName, 'extraEditorClassName', '',
)),
diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts
index 6e9446f55db..c62e7fc404f 100644
--- a/src/vs/editor/common/standalone/standaloneEnums.ts
+++ b/src/vs/editor/common/standalone/standaloneEnums.ts
@@ -204,7 +204,7 @@ export enum EditorOption {
disableMonospaceOptimizations = 29,
domReadOnly = 30,
dragAndDrop = 31,
- enableDropIntoEditor = 32,
+ dropIntoEditor = 32,
emptySelectionClipboard = 33,
extraEditorClassName = 34,
fastScrollSensitivity = 35,
diff --git a/src/vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution.ts b/src/vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution.ts
index 10ed525fc05..83f8ad1e314 100644
--- a/src/vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution.ts
+++ b/src/vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution.ts
@@ -25,7 +25,6 @@ import { CodeEditorStateFlag, EditorStateCancellationTokenSource } from 'vs/edit
import { performSnippetEdit } from 'vs/editor/contrib/snippet/browser/snippetController2';
import { SnippetParser } from 'vs/editor/contrib/snippet/browser/snippetParser';
import { localize } from 'vs/nls';
-import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
@@ -37,7 +36,6 @@ export class DropIntoEditorController extends Disposable implements IEditorContr
constructor(
editor: ICodeEditor,
@IBulkEditService private readonly _bulkEditService: IBulkEditService,
- @IConfigurationService private readonly _configurationService: IConfigurationService,
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
@IProgressService private readonly _progressService: IProgressService,
@IWorkspaceContextService workspaceContextService: IWorkspaceContextService,
@@ -46,22 +44,7 @@ export class DropIntoEditorController extends Disposable implements IEditorContr
this._register(editor.onDropIntoEditor(e => this.onDropIntoEditor(editor, e.position, e.event)));
-
this._languageFeaturesService.documentOnDropEditProvider.register('*', new DefaultOnDropProvider(workspaceContextService));
-
- this._register(this._configurationService.onDidChangeConfiguration(e => {
- if (e.affectsConfiguration('workbench.editor.dropIntoEditor.enabled')) {
- this.updateEditorOptions(editor);
- }
- }));
-
- this.updateEditorOptions(editor);
- }
-
- private updateEditorOptions(editor: ICodeEditor) {
- editor.updateOptions({
- enableDropIntoEditor: this._configurationService.getValue('workbench.editor.dropIntoEditor.enabled')
- });
}
private async onDropIntoEditor(editor: ICodeEditor, position: IPosition, dragEvent: DragEvent) {
diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts
index ac468aa007f..db39c17f9c6 100644
--- a/src/vs/monaco.d.ts
+++ b/src/vs/monaco.d.ts
@@ -3439,11 +3439,11 @@ declare namespace monaco.editor {
*/
bracketPairColorization?: IBracketPairColorizationOptions;
/**
- * Enables dropping into the editor from an external source.
+ * Controls dropping into the editor from an external source.
*
- * This shows a preview of the drop location and triggers an `onDropIntoEditor` event.
+ * When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.
*/
- enableDropIntoEditor?: boolean;
+ dropIntoEditor?: IDropIntoEditorOptions;
}
export interface IDiffEditorBaseOptions {
@@ -4330,6 +4330,17 @@ declare namespace monaco.editor {
readonly wrappingColumn: number;
}
+ /**
+ * Configuration options for editor drop into behavior
+ */
+ export interface IDropIntoEditorOptions {
+ /**
+ * Enable the dropping into editor.
+ * Defaults to true.
+ */
+ enabled?: boolean;
+ }
+
export enum EditorOption {
acceptSuggestionOnCommitCharacter = 0,
acceptSuggestionOnEnter = 1,
@@ -4363,7 +4374,7 @@ declare namespace monaco.editor {
disableMonospaceOptimizations = 29,
domReadOnly = 30,
dragAndDrop = 31,
- enableDropIntoEditor = 32,
+ dropIntoEditor = 32,
emptySelectionClipboard = 33,
extraEditorClassName = 34,
fastScrollSensitivity = 35,
@@ -4503,7 +4514,7 @@ declare namespace monaco.editor {
domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
- enableDropIntoEditor: IEditorOption<EditorOption.enableDropIntoEditor, boolean>;
+ dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
diff --git a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
index e9686439360..947f4475f3b 100644
--- a/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
+++ b/src/vs/workbench/browser/parts/editor/editorDropTarget.ts
@@ -32,7 +32,7 @@ interface IDropOperation {
}
function isDropIntoEditorEnabledGlobally(configurationService: IConfigurationService) {
- return configurationService.getValue<boolean>('workbench.editor.dropIntoEditor.enabled');
+ return configurationService.getValue<boolean>('editor.dropIntoEditor.enabled');
}
function isDragIntoEditorEvent(e: DragEvent): boolean {
diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
index 2aa1285f9a1..2dcf135be7c 100644
--- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
@@ -240,7 +240,7 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
return {
...super.getConfigurationOverrides(),
readOnly,
- enableDropIntoEditor: !readOnly,
+ dropIntoEditor: { enabled: !readOnly },
originalEditable: this.input instanceof DiffEditorInput && !this.input.original.hasCapability(EditorInputCapabilities.Readonly),
lineDecorationsWidth: '2ch'
};
@@ -251,7 +251,7 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
this.diffEditorControl?.updateOptions({
readOnly: input.hasCapability(EditorInputCapabilities.Readonly),
originalEditable: !input.original.hasCapability(EditorInputCapabilities.Readonly),
- enableDropIntoEditor: !input.hasCapability(EditorInputCapabilities.Readonly)
+ dropIntoEditor: { enabled: !input.hasCapability(EditorInputCapabilities.Readonly) }
});
} else {
super.updateReadonly(input);
diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts
index c803409ef74..b43dd3baa8d 100644
--- a/src/vs/workbench/browser/parts/editor/textEditor.ts
+++ b/src/vs/workbench/browser/parts/editor/textEditor.ts
@@ -138,7 +138,7 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
this.updateEditorControlOptions({
readOnly,
- enableDropIntoEditor: !readOnly
+ dropIntoEditor: { enabled: !readOnly },
});
}
@@ -150,7 +150,7 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
lineNumbersMinChars: 3,
fixedOverflowWidgets: true,
readOnly,
- enableDropIntoEditor: !readOnly,
+ dropIntoEditor: { enabled: !readOnly },
renderValidationDecorations: 'on' // render problems even in readonly editors (https://github.com/microsoft/vscode/issues/89057)
};
}
diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts
index b042c202d98..c8728506774 100644
--- a/src/vs/workbench/browser/workbench.contribution.ts
+++ b/src/vs/workbench/browser/workbench.contribution.ts
@@ -466,11 +466,6 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
'default': 'both',
'description': localize('layoutControlType', "Controls whether the layout control in the custom title bar is displayed as a single menu button or with multiple UI toggles."),
},
- 'workbench.editor.dropIntoEditor.enabled': {
- 'type': 'boolean',
- 'default': true,
- 'markdownDescription': localize('dropIntoEditor', "Controls whether you can drag and drop a file into a text editor by holding down `shift` (instead of opening the file in an editor)."),
- },
'workbench.experimental.layoutControl.enabled': {
'type': 'boolean',
'tags': ['experimental'],
diff --git a/src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts b/src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts
index 870d4b2d719..813a6ef4354 100644
--- a/src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts
+++ b/src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts
@@ -329,7 +329,7 @@ export class StatefulMarkdownCell extends Disposable {
width: width,
height: editorHeight
},
- enableDropIntoEditor: true,
+ dropIntoEditor: { enabled: true },
// overflowWidgetsDomNode: this.notebookEditor.getOverflowContainerDomNode()
}, {
contributions: this.notebookEditor.creationOptions.cellEditorContributions
diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
index 949c8dd25b5..fff16d43316 100644
--- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
+++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
@@ -275,7 +275,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
width: 0,
height: 0
},
- enableDropIntoEditor: true,
+ dropIntoEditor: { enabled: true },
}, {
contributions: this.notebookEditor.creationOptions.cellEditorContributions
});
diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
index f479781fba7..32a0d626d66 100644
--- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
+++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
@@ -1963,7 +1963,7 @@ class SCMInputWidget {
scrollbar: { alwaysConsumeMouseWheel: false },
overflowWidgetsDomNode,
renderWhitespace: 'none',
- enableDropIntoEditor: true,
+ dropIntoEditor: { enabled: true },
accessibilitySupport
};
diff --git a/src/vs/workbench/electron-sandbox/desktop.contribution.ts b/src/vs/workbench/electron-sandbox/desktop.contribution.ts
index 1dd0c84873b..6559a5f52b7 100644
--- a/src/vs/workbench/electron-sandbox/desktop.contribution.ts
+++ b/src/vs/workbench/electron-sandbox/desktop.contribution.ts
@@ -242,6 +242,7 @@ import { ModifierKeyEmitter } from 'vs/base/browser/dom';
type: 'boolean',
description: localize('experimentalUseSandbox', "Experimental: When enabled, the window will have sandbox mode enabled via Electron API."),
default: false,
+ 'scope': ConfigurationScope.APPLICATION,
ignoreSync: true
},
}