Allow to show status bar entries with an id and name (fix #74972)

This commit is contained in:
Benjamin Pasero
2021-05-19 14:03:28 +02:00
parent f23f011f55
commit 159479eb5a
31 changed files with 212 additions and 167 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind, QuickPickItem, TextEditor } from 'vscode';
import { workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind, QuickPickItem, TextEditor, StatusBarAlignment } from 'vscode';
import { join } from 'path';
import { closeAllEditors, pathEquals, createRandomFile, assertNoRpc } from '../utils';
@@ -638,4 +638,22 @@ suite('vscode API - window', () => {
});
});
test('createStatusBar', async function () {
const statusBarEntryWithoutId = window.createStatusBarItem(StatusBarAlignment.Left, 100);
assert.strictEqual(statusBarEntryWithoutId.id, 'vscode.vscode-api-tests');
assert.strictEqual(statusBarEntryWithoutId.alignment, StatusBarAlignment.Left);
assert.strictEqual(statusBarEntryWithoutId.priority, 100);
assert.strictEqual(statusBarEntryWithoutId.name, undefined);
statusBarEntryWithoutId.name = 'Test Name';
assert.strictEqual(statusBarEntryWithoutId.name, 'Test Name');
const statusBarEntryWithId = window.createStatusBarItem('testId', StatusBarAlignment.Right, 200);
assert.strictEqual(statusBarEntryWithId.alignment, StatusBarAlignment.Right);
assert.strictEqual(statusBarEntryWithId.priority, 200);
assert.strictEqual(statusBarEntryWithId.id, 'testId');
assert.strictEqual(statusBarEntryWithId.name, undefined);
statusBarEntryWithId.name = 'Test Name';
assert.strictEqual(statusBarEntryWithId.name, 'Test Name');
});
});