mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 (#9279)
* Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 * remove github
This commit is contained in:
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
||||
import { setUnexpectedErrorHandler, errorHandler } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as types from 'vs/workbench/api/common/extHostTypes';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { TestRPCProtocol } from './testRPCProtocol';
|
||||
import { MarkerService } from 'vs/platform/markers/common/markerService';
|
||||
import { IMarkerService } from 'vs/platform/markers/common/markers';
|
||||
@@ -49,7 +49,7 @@ import 'vs/editor/contrib/smartSelect/smartSelect';
|
||||
import 'vs/editor/contrib/suggest/suggest';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = TextModel.createFromString(
|
||||
const model: ITextModel = createTextModel(
|
||||
[
|
||||
'This is the first line',
|
||||
'This is the second line',
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { setUnexpectedErrorHandler, errorHandler } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as types from 'vs/workbench/api/common/extHostTypes';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { Position as EditorPosition, Position } from 'vs/editor/common/core/position';
|
||||
import { Range as EditorRange } from 'vs/editor/common/core/range';
|
||||
import { TestRPCProtocol } from './testRPCProtocol';
|
||||
@@ -48,9 +48,10 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerServ
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { NullApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
|
||||
import { Progress } from 'vs/platform/progress/common/progress';
|
||||
|
||||
const defaultSelector = { scheme: 'far' };
|
||||
const model: ITextModel = TextModel.createFromString(
|
||||
const model: ITextModel = createTextModel(
|
||||
[
|
||||
'This is the first line',
|
||||
'This is the second line',
|
||||
@@ -590,7 +591,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 2);
|
||||
const [first, second] = actions;
|
||||
assert.equal(first.title, 'Testing1');
|
||||
@@ -614,7 +615,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
const [first] = actions;
|
||||
assert.equal(first.title, 'Testing1');
|
||||
@@ -637,7 +638,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
});
|
||||
|
||||
@@ -655,7 +656,7 @@ suite('ExtHostLanguageFeatures', function () {
|
||||
}));
|
||||
|
||||
await rpcProtocol.sync();
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, CancellationToken.None);
|
||||
const { validActions: actions } = await getCodeActions(model, model.getFullModelRange(), { type: modes.CodeActionTriggerType.Manual }, Progress.None, CancellationToken.None);
|
||||
assert.equal(actions.length, 1);
|
||||
});
|
||||
|
||||
|
||||
@@ -13,18 +13,33 @@ import { ExtHostWebviews } from 'vs/workbench/api/common/extHostWebview';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
|
||||
import { mock } from 'vs/workbench/test/browser/api/mock';
|
||||
import { SingleProxyRPCProtocol } from './testRPCProtocol';
|
||||
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { NullApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
|
||||
|
||||
suite('ExtHostWebview', () => {
|
||||
|
||||
let rpcProtocol: (IExtHostRpcService & IExtHostContext) | undefined;
|
||||
let extHostDocuments: ExtHostDocuments | undefined;
|
||||
|
||||
setup(() => {
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
rpcProtocol = SingleProxyRPCProtocol(shape);
|
||||
|
||||
const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol, new NullLogService());
|
||||
extHostDocuments = new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors);
|
||||
});
|
||||
|
||||
test('Cannot register multiple serializers for the same view type', async () => {
|
||||
const viewType = 'view.type';
|
||||
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
|
||||
const extHostWebviews = new ExtHostWebviews(rpcProtocol!, {
|
||||
webviewCspSource: '',
|
||||
webviewResourceRoot: '',
|
||||
isExtensionDevelopmentDebug: false,
|
||||
}, undefined, new NullLogService());
|
||||
}, undefined, new NullLogService(), NullApiDeprecationService, extHostDocuments!);
|
||||
|
||||
let lastInvokedDeserializer: vscode.WebviewPanelSerializer | undefined = undefined;
|
||||
|
||||
@@ -57,12 +72,11 @@ suite('ExtHostWebview', () => {
|
||||
});
|
||||
|
||||
test('asWebviewUri for desktop vscode-resource scheme', () => {
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
|
||||
const extHostWebviews = new ExtHostWebviews(rpcProtocol!, {
|
||||
webviewCspSource: '',
|
||||
webviewResourceRoot: 'vscode-resource://{{resource}}',
|
||||
isExtensionDevelopmentDebug: false,
|
||||
}, undefined, new NullLogService());
|
||||
}, undefined, new NullLogService(), NullApiDeprecationService, extHostDocuments!);
|
||||
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
|
||||
|
||||
assert.strictEqual(
|
||||
@@ -97,13 +111,11 @@ suite('ExtHostWebview', () => {
|
||||
});
|
||||
|
||||
test('asWebviewUri for web endpoint', () => {
|
||||
const shape = createNoopMainThreadWebviews();
|
||||
|
||||
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
|
||||
const extHostWebviews = new ExtHostWebviews(rpcProtocol!, {
|
||||
webviewCspSource: '',
|
||||
webviewResourceRoot: `https://{{uuid}}.webview.contoso.com/commit/{{resource}}`,
|
||||
isExtensionDevelopmentDebug: false,
|
||||
}, undefined, new NullLogService());
|
||||
}, undefined, new NullLogService(), NullApiDeprecationService, extHostDocuments!);
|
||||
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
|
||||
|
||||
function stripEndpointUuid(input: string) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { MainThreadDocumentContentProviders } from 'vs/workbench/api/browser/mainThreadDocumentContentProviders';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { mock } from 'vs/workbench/test/browser/api/mock';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
@@ -18,7 +18,7 @@ suite('MainThreadDocumentContentProviders', function () {
|
||||
test('events are processed properly', function () {
|
||||
|
||||
let uri = URI.parse('test:uri');
|
||||
let model = TextModel.createFromString('1', undefined, undefined, uri);
|
||||
let model = createTextModel('1', undefined, undefined, uri);
|
||||
|
||||
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
||||
new class extends mock<IModelService>() {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { BoundModelReferenceCollection } from 'vs/workbench/api/browser/mainThreadDocuments';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
suite('BoundModelReferenceCollection', () => {
|
||||
@@ -21,7 +21,7 @@ suite('BoundModelReferenceCollection', () => {
|
||||
let didDispose = false;
|
||||
|
||||
col.add({
|
||||
object: <any>{ textEditorModel: TextModel.createFromString('farboo') },
|
||||
object: <any>{ textEditorModel: createTextModel('farboo') },
|
||||
dispose() {
|
||||
didDispose = true;
|
||||
}
|
||||
@@ -36,20 +36,20 @@ suite('BoundModelReferenceCollection', () => {
|
||||
let disposed: number[] = [];
|
||||
|
||||
col.add({
|
||||
object: <any>{ textEditorModel: TextModel.createFromString('farboo') },
|
||||
object: <any>{ textEditorModel: createTextModel('farboo') },
|
||||
dispose() {
|
||||
disposed.push(0);
|
||||
}
|
||||
});
|
||||
col.add({
|
||||
object: <any>{ textEditorModel: TextModel.createFromString('boofar') },
|
||||
object: <any>{ textEditorModel: createTextModel('boofar') },
|
||||
dispose() {
|
||||
disposed.push(1);
|
||||
}
|
||||
});
|
||||
|
||||
col.add({
|
||||
object: <any>{ textEditorModel: TextModel.createFromString(new Array(71).join('x')) },
|
||||
object: <any>{ textEditorModel: createTextModel(new Array(71).join('x')) },
|
||||
dispose() {
|
||||
disposed.push(2);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
|
||||
suite('MainThreadDocumentsAndEditors', () => {
|
||||
|
||||
@@ -45,7 +47,10 @@ suite('MainThreadDocumentsAndEditors', () => {
|
||||
deltas.length = 0;
|
||||
const configService = new TestConfigurationService();
|
||||
configService.setUserConfiguration('editor', { 'detectIndentation': false });
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService(), new UndoRedoService());
|
||||
const dialogService = new TestDialogService();
|
||||
const notificationService = new TestNotificationService();
|
||||
const undoRedoService = new UndoRedoService(dialogService, notificationService);
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService(), undoRedoService);
|
||||
codeEditorService = new TestCodeEditorService();
|
||||
textFileService = new class extends mock<ITextFileService>() {
|
||||
isDirty() { return false; }
|
||||
|
||||
@@ -42,6 +42,11 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
suite('MainThreadEditors', () => {
|
||||
|
||||
@@ -64,7 +69,10 @@ suite('MainThreadEditors', () => {
|
||||
|
||||
|
||||
const configService = new TestConfigurationService();
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService(), new UndoRedoService());
|
||||
const dialogService = new TestDialogService();
|
||||
const notificationService = new TestNotificationService();
|
||||
const undoRedoService = new UndoRedoService(dialogService, notificationService);
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService(), undoRedoService);
|
||||
|
||||
|
||||
const services = new ServiceCollection();
|
||||
@@ -74,6 +82,9 @@ suite('MainThreadEditors', () => {
|
||||
services.set(IWorkspaceContextService, new TestContextService());
|
||||
services.set(IWorkbenchEnvironmentService, TestEnvironmentService);
|
||||
services.set(IConfigurationService, configService);
|
||||
services.set(IDialogService, dialogService);
|
||||
services.set(INotificationService, notificationService);
|
||||
services.set(IUndoRedoService, undoRedoService);
|
||||
services.set(IModelService, modelService);
|
||||
services.set(ICodeEditorService, new TestCodeEditorService());
|
||||
services.set(IFileService, new TestFileService());
|
||||
|
||||
Reference in New Issue
Block a user