Skip to content

Commit 060de16

Browse files
authored
Directly accepting editor selection when using text area edit context (microsoft#239211)
* allowing two offsets * changing to true
1 parent 405f21f commit 060de16

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/automation/src/settings.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export class SettingsEditor {
2525
await this.openUserSettingsFile();
2626

2727
await this.code.dispatchKeybinding('right');
28-
const selectionOffset = this._editContextSelectionOffset();
29-
await this.editor.waitForEditorSelection('settings.json', s => s.selectionStart === selectionOffset && s.selectionEnd === selectionOffset);
28+
await this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s));
3029
await this.editor.waitForTypeInEditor('settings.json', `"${setting}": ${value},`);
3130
await this.editors.saveOpenedFile();
3231
}
@@ -41,8 +40,7 @@ export class SettingsEditor {
4140
await this.openUserSettingsFile();
4241

4342
await this.code.dispatchKeybinding('right');
44-
const selectionOffset = this._editContextSelectionOffset();
45-
await this.editor.waitForEditorSelection('settings.json', (s) => s.selectionStart === selectionOffset && s.selectionEnd === selectionOffset);
43+
await this.editor.waitForEditorSelection('settings.json', (s) => this._acceptEditorSelection(this.code.quality, s));
4644
await this.editor.waitForTypeInEditor('settings.json', settings.map(v => `"${v[0]}": ${v[1]},`).join(''));
4745
await this.editors.saveOpenedFile();
4846
}
@@ -86,7 +84,10 @@ export class SettingsEditor {
8684
return this.code.quality === Quality.Stable ? SEARCH_BOX_TEXTAREA : SEARCH_BOX_NATIVE_EDIT_CONTEXT;
8785
}
8886

89-
private _editContextSelectionOffset(): number {
90-
return this.code.quality === Quality.Stable ? 0 : 1;
87+
private _acceptEditorSelection(quality: Quality, s: { selectionStart: number; selectionEnd: number }): boolean {
88+
if (quality === Quality.Stable) {
89+
return true;
90+
}
91+
return s.selectionStart === 1 && s.selectionEnd === 1;
9192
}
9293
}

0 commit comments

Comments
 (0)