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:
authorMatt Bierner <matb@microsoft.com>2022-07-28 01:43:40 +0300
committerGitHub <noreply@github.com>2022-07-28 01:43:40 +0300
commit083728eb874d5b1529db7b7ab29e3cce476c694b (patch)
tree306d9ca6461b02ce5552a6d96a6ac279b3d3b47f /src/vs
parent99cf19c04206beffd16dae6c824509d6d721b75b (diff)
Fix drop indicator showing up even if you have disabled dropIntoEditor (#156506)
This fixes a number of places where we were adding `dropIntoEditor` to the config override, which also overrides the user's configation. Instead we can check if the editor is readonly in `codeEditorWidget`
Diffstat (limited to 'src/vs')
-rw-r--r--src/vs/editor/browser/widget/codeEditorWidget.ts9
-rw-r--r--src/vs/workbench/browser/parts/editor/textDiffEditor.ts2
-rw-r--r--src/vs/workbench/browser/parts/editor/textEditor.ts7
-rw-r--r--src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts1
-rw-r--r--src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts1
5 files changed, 8 insertions, 12 deletions
diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts
index bed9912d2d3..32b66fa6680 100644
--- a/src/vs/editor/browser/widget/codeEditorWidget.ts
+++ b/src/vs/editor/browser/widget/codeEditorWidget.ts
@@ -368,10 +368,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._actions[internalAction.id] = internalAction;
});
+ const isDropIntoEnabled = () => {
+ return !this._configuration.options.get(EditorOption.readOnly)
+ && this._configuration.options.get(EditorOption.dropIntoEditor).enabled;
+ };
+
this._register(new dom.DragAndDropObserver(this._domElement, {
onDragEnter: () => undefined,
onDragOver: e => {
- if (!this._configuration.options.get(EditorOption.dropIntoEditor).enabled) {
+ if (!isDropIntoEnabled()) {
return;
}
@@ -381,7 +386,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
}
},
onDrop: async e => {
- if (!this._configuration.options.get(EditorOption.dropIntoEditor).enabled) {
+ if (!isDropIntoEnabled()) {
return;
}
diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
index 2dcf135be7c..a638504849a 100644
--- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts
@@ -240,7 +240,6 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
return {
...super.getConfigurationOverrides(),
readOnly,
- dropIntoEditor: { enabled: !readOnly },
originalEditable: this.input instanceof DiffEditorInput && !this.input.original.hasCapability(EditorInputCapabilities.Readonly),
lineDecorationsWidth: '2ch'
};
@@ -251,7 +250,6 @@ export class TextDiffEditor extends AbstractTextEditor<IDiffEditorViewState> imp
this.diffEditorControl?.updateOptions({
readOnly: input.hasCapability(EditorInputCapabilities.Readonly),
originalEditable: !input.original.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 b43dd3baa8d..da518cdc0e7 100644
--- a/src/vs/workbench/browser/parts/editor/textEditor.ts
+++ b/src/vs/workbench/browser/parts/editor/textEditor.ts
@@ -135,11 +135,7 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
protected updateReadonly(input: EditorInput): void {
const readOnly = input.hasCapability(EditorInputCapabilities.Readonly);
-
- this.updateEditorControlOptions({
- readOnly,
- dropIntoEditor: { enabled: !readOnly },
- });
+ this.updateEditorControlOptions({ readOnly });
}
protected getConfigurationOverrides(): ICodeEditorOptions {
@@ -150,7 +146,6 @@ export abstract class AbstractTextEditor<T extends IEditorViewState> extends Abs
lineNumbersMinChars: 3,
fixedOverflowWidgets: true,
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/contrib/notebook/browser/view/cellParts/markdownCell.ts b/src/vs/workbench/contrib/notebook/browser/view/cellParts/markdownCell.ts
index 813a6ef4354..ac666a052eb 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,6 @@ export class StatefulMarkdownCell extends Disposable {
width: width,
height: editorHeight
},
- 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 fff16d43316..8e3ab0b4640 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,6 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
width: 0,
height: 0
},
- dropIntoEditor: { enabled: true },
}, {
contributions: this.notebookEditor.creationOptions.cellEditorContributions
});