mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 (#8649)
* Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 * distro * fix tests
This commit is contained in:
@@ -71,8 +71,8 @@ suite('QuickOpen', () => {
|
||||
});
|
||||
|
||||
test('QuickOpen Action', () => {
|
||||
let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService((prefix: string) => assert(!prefix)));
|
||||
let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService((prefix: string) => assert(!!prefix)));
|
||||
let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService(prefix => assert(!prefix)));
|
||||
let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService(prefix => assert(!!prefix)));
|
||||
|
||||
defaultAction.run();
|
||||
prefixAction.run();
|
||||
|
||||
@@ -13,7 +13,7 @@ suite('Viewlets', () => {
|
||||
class TestViewlet extends Viewlet {
|
||||
|
||||
constructor() {
|
||||
super('id', null!, null!, null!, null!, null!);
|
||||
super('id', null!, null!, null!, null!, null!, null!, null!, null!, null!, null!);
|
||||
}
|
||||
|
||||
public layout(dimension: any): void {
|
||||
|
||||
@@ -30,6 +30,8 @@ import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = EditorModel.createFromString(
|
||||
@@ -90,10 +92,15 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
onModelRemoved: undefined!,
|
||||
getCreationOptions() { throw new Error(); }
|
||||
});
|
||||
instantiationService.stub(IEditorWorkerService, new class extends mock<IEditorWorkerService>() {
|
||||
async computeMoreMinimalEdits(_uri: any, edits: any) {
|
||||
return edits || undefined;
|
||||
}
|
||||
});
|
||||
inst = instantiationService;
|
||||
}
|
||||
|
||||
const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol);
|
||||
const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol, new NullLogService());
|
||||
extHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({
|
||||
addedDocuments: [{
|
||||
isDirty: false,
|
||||
@@ -195,6 +202,21 @@ suite('ExtHostLanguageFeatureCommands', function () {
|
||||
assert.equal(symbols.length, 1);
|
||||
});
|
||||
|
||||
// --- formatting
|
||||
test('executeFormatDocumentProvider, back and forth', async function () {
|
||||
|
||||
disposables.push(extHost.registerDocumentFormattingEditProvider(nullExtensionDescription, defaultSelector, new class implements vscode.DocumentFormattingEditProvider {
|
||||
provideDocumentFormattingEdits() {
|
||||
return [types.TextEdit.insert(new types.Position(0, 0), '42')];
|
||||
}
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
let edits = await commands.executeCommand<vscode.SymbolInformation[]>('vscode.executeFormatDocumentProvider', model.uri);
|
||||
assert.equal(edits.length, 1);
|
||||
});
|
||||
|
||||
|
||||
// --- definition
|
||||
|
||||
test('Definition, invalid arguments', function () {
|
||||
|
||||
@@ -37,7 +37,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
|
||||
};
|
||||
|
||||
setup(() => {
|
||||
const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null));
|
||||
const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null), new NullLogService());
|
||||
documentsAndEditors.$acceptDocumentsAndEditorsDelta({
|
||||
addedDocuments: [{
|
||||
isDirty: false,
|
||||
|
||||
@@ -7,13 +7,14 @@ import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
suite('ExtHostDocumentsAndEditors', () => {
|
||||
|
||||
let editors: ExtHostDocumentsAndEditors;
|
||||
|
||||
setup(function () {
|
||||
editors = new ExtHostDocumentsAndEditors(new TestRPCProtocol());
|
||||
editors = new ExtHostDocumentsAndEditors(new TestRPCProtocol(), new NullLogService());
|
||||
});
|
||||
|
||||
test('The value of TextDocument.isClosed is incorrect when a text document is closed, #27949', () => {
|
||||
|
||||
@@ -84,7 +84,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
originalErrorHandler = errorHandler.getUnexpectedErrorHandler();
|
||||
setUnexpectedErrorHandler(() => { });
|
||||
|
||||
const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol);
|
||||
const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol, new NullLogService());
|
||||
extHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({
|
||||
addedDocuments: [{
|
||||
isDirty: false,
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ExtHostTextEditorOptions, ExtHostTextEditor } from 'vs/workbench/api/co
|
||||
import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { mock } from 'vs/workbench/test/electron-browser/api/mock';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
suite('ExtHostTextEditor', () => {
|
||||
|
||||
@@ -19,7 +20,7 @@ suite('ExtHostTextEditor', () => {
|
||||
], '\n', 'text', 1, false);
|
||||
|
||||
setup(() => {
|
||||
editor = new ExtHostTextEditor(null!, 'fake', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
editor = new ExtHostTextEditor('fake', null!, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
});
|
||||
|
||||
test('disposed editor', () => {
|
||||
@@ -40,12 +41,13 @@ suite('ExtHostTextEditor', () => {
|
||||
|
||||
test('API [bug]: registerTextEditorCommand clears redo stack even if no edits are made #55163', async function () {
|
||||
let applyCount = 0;
|
||||
let editor = new ExtHostTextEditor(new class extends mock<MainThreadTextEditorsShape>() {
|
||||
$tryApplyEdits(): Promise<boolean> {
|
||||
applyCount += 1;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}, 'edt1', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
let editor = new ExtHostTextEditor('edt1',
|
||||
new class extends mock<MainThreadTextEditorsShape>() {
|
||||
$tryApplyEdits(): Promise<boolean> {
|
||||
applyCount += 1;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1);
|
||||
|
||||
await editor.edit(edit => { });
|
||||
assert.equal(applyCount, 0);
|
||||
@@ -92,7 +94,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
insertSpaces: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
lineNumbers: RenderLineNumbersType.On
|
||||
});
|
||||
}, new NullLogService());
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocum
|
||||
import { SingleProxyRPCProtocol, TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
|
||||
import { ExtHostEditors } from 'vs/workbench/api/common/extHostTextEditors';
|
||||
import { ResourceTextEdit } from 'vs/editor/common/modes';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
|
||||
|
||||
@@ -28,7 +29,7 @@ suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
});
|
||||
const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null));
|
||||
const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null), new NullLogService());
|
||||
documentsAndEditors.$acceptDocumentsAndEditorsDelta({
|
||||
addedDocuments: [{
|
||||
isDirty: false,
|
||||
|
||||
@@ -120,7 +120,7 @@ suite('ExtHostWorkspace', function () {
|
||||
assert.equal(ws.getPath(), undefined);
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('Folder'), 0), aWorkspaceFolderData(URI.file('Another/Folder'), 1)] }, new NullLogService());
|
||||
assert.equal(ws.getPath(), undefined);
|
||||
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
|
||||
ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('/Folder'), 0)] }, new NullLogService());
|
||||
assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder');
|
||||
|
||||
Reference in New Issue
Block a user