Skip to content

Commit

Permalink
Fix extra auto complete on fast delete (#74675)
Browse files Browse the repository at this point in the history
Fixes #vscode-remote-release/4
  • Loading branch information
alexr00 authored Jun 26, 2019
1 parent 86306cc commit b266566
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/vs/workbench/services/dialogs/browser/remoteFileDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export class RemoteFileDialog {
}
} else {
this.filePickBox.activeItems = [];
this.userEnteredPathSegment = '';
}
}
} catch {
Expand Down Expand Up @@ -369,7 +370,11 @@ export class RemoteFileDialog {
}

private constructFullUserPath(): string {
return this.pathAppend(this.currentFolder, this.userEnteredPathSegment);
if (equalsIgnoreCase(this.filePickBox.value.substr(0, this.userEnteredPathSegment.length), this.userEnteredPathSegment)) {
return this.pathFromUri(this.currentFolder);
} else {
return this.pathAppend(this.currentFolder, this.userEnteredPathSegment);
}
}

private filePickBoxValue(): URI {
Expand Down Expand Up @@ -492,11 +497,13 @@ export class RemoteFileDialog {
const userPath = this.constructFullUserPath();
if (equalsIgnoreCase(userPath, value.substring(0, userPath.length))) {
let hasMatch = false;
for (let i = 0; i < this.filePickBox.items.length; i++) {
const item = <FileQuickPickItem>this.filePickBox.items[i];
if (this.setAutoComplete(value, inputBasename, item)) {
hasMatch = true;
break;
if (inputBasename.length > this.userEnteredPathSegment.length) {
for (let i = 0; i < this.filePickBox.items.length; i++) {
const item = <FileQuickPickItem>this.filePickBox.items[i];
if (this.setAutoComplete(value, inputBasename, item)) {
hasMatch = true;
break;
}
}
}
if (!hasMatch) {
Expand All @@ -505,11 +512,7 @@ export class RemoteFileDialog {
this.filePickBox.activeItems = [];
}
} else {
if (!equalsIgnoreCase(inputBasename, resources.basename(this.currentFolder))) {
this.userEnteredPathSegment = inputBasename;
} else {
this.userEnteredPathSegment = '';
}
this.userEnteredPathSegment = inputBasename;
this.autoCompletePathSegment = '';
}
}
Expand Down

0 comments on commit b266566

Please sign in to comment.