Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable copy paste api in scm input #209466

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Enable dnd and copy paste apis in scm input
For #209460

Enables dropping or pasting a file from the vscode/system explorer into the scminput to insert the file name. Currently nothing happens when you try this

In the future will also allow extensions to hook into these apis
  • Loading branch information
mjbvz committed Apr 3, 2024
commit b89ad44e23f189a2bfaf433fce5944cb717dc6a3
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export class PostEditWidgetManager<T extends DocumentPasteEdit | DocumentOnDropE
}

const resolvedEdit = await resolve(edit, token);
if (token.isCancellationRequested) {
return;
}

const combinedWorkspaceEdit = createCombinedWorkspaceEdit(model.uri, ranges, resolvedEdit);

Expand All @@ -174,6 +177,7 @@ export class PostEditWidgetManager<T extends DocumentPasteEdit | DocumentOnDropE
options: { description: 'paste-line-suffix', stickiness: TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }
}]);

this._editor.focus();
let editResult: IBulkEditResult;
let editRange: Range | null;
try {
Expand All @@ -183,6 +187,10 @@ export class PostEditWidgetManager<T extends DocumentPasteEdit | DocumentOnDropE
model.deltaDecorations(editTrackingDecoration, []);
}

if (token.isCancellationRequested) {
return;
}

if (canShowWidget && editResult.isApplied && edits.allEdits.length > 1) {
this.show(editRange ?? primaryRange, edits, async (newEditIndex) => {
const model = this._editor.getModel();
Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/snippet/browser/snippetController2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ registerEditorCommand(new CommandCtor({
handler: ctrl => ctrl.next(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyCode.Tab
}
}));
Expand All @@ -341,7 +341,7 @@ registerEditorCommand(new CommandCtor({
handler: ctrl => ctrl.prev(),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.Shift | KeyCode.Tab
}
}));
Expand All @@ -351,7 +351,7 @@ registerEditorCommand(new CommandCtor({
handler: ctrl => ctrl.cancel(true),
kbOpts: {
weight: KeybindingWeight.EditorContrib + 30,
kbExpr: EditorContextKeys.editorTextFocus,
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape]
}
Expand Down
Loading