mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 09:35:37 -05:00
* Revert "Revert "Merge from vscode merge-base (#22769)" (#22779)"
This reverts commit 47a1745180.
* Fix notebook download task
* Remove done call from extensions-ci
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { Editor } from './editor';
|
|
import { Editors } from './editors';
|
|
import { Code } from './code';
|
|
import { QuickAccess } from './quickaccess';
|
|
|
|
export class SettingsEditor {
|
|
|
|
constructor(private code: Code, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
|
|
|
|
/**
|
|
* Write a single setting key value pair.
|
|
*
|
|
* Warning: You may need to set `editor.wordWrap` to `"on"` if this is called with a really long
|
|
* setting.
|
|
*/
|
|
async addUserSetting(setting: string, value: string): Promise<void> {
|
|
await this.openUserSettingsFile();
|
|
|
|
await this.code.dispatchKeybinding('right');
|
|
await this.editor.waitForTypeInEditor('settings.json', `"${setting}": ${value},`);
|
|
await this.editors.saveOpenedFile();
|
|
}
|
|
|
|
/**
|
|
* Write several settings faster than multiple calls to {@link addUserSetting}.
|
|
*
|
|
* Warning: You will likely also need to set `editor.wordWrap` to `"on"` if `addUserSetting` is
|
|
* called after this in the test.
|
|
*/
|
|
async addUserSettings(settings: [key: string, value: string][]): Promise<void> {
|
|
await this.openUserSettingsFile();
|
|
|
|
await this.code.dispatchKeybinding('right');
|
|
await this.editor.waitForTypeInEditor('settings.json', settings.map(v => `"${v[0]}": ${v[1]},`).join(''));
|
|
await this.editors.saveOpenedFile();
|
|
}
|
|
|
|
async clearUserSettings(): Promise<void> {
|
|
await this.openUserSettingsFile();
|
|
await this.quickaccess.runCommand('editor.action.selectAll');
|
|
await this.code.dispatchKeybinding('Delete');
|
|
await this.editor.waitForTypeInEditor('settings.json', `{`); // will auto close }
|
|
await this.editors.saveOpenedFile();
|
|
await this.quickaccess.runCommand('workbench.action.closeActiveEditor');
|
|
}
|
|
|
|
async openUserSettingsFile(): Promise<void> {
|
|
await this.quickaccess.runCommand('workbench.action.openSettingsJson');
|
|
await this.editor.waitForEditorFocus('settings.json', 1);
|
|
}
|
|
}
|