Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421 (#7404)

* Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421

* readd svgs
This commit is contained in:
Anthony Dresser
2019-09-27 11:13:19 -07:00
committed by GitHub
parent 6385443a4c
commit 07109617b5
348 changed files with 4219 additions and 4307 deletions

View File

@@ -52,37 +52,37 @@ suite('ExtHostWebview', () => {
const shape = createNoopMainThreadWebviews();
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
webviewCspSource: '',
webviewResourceRoot: 'vscode-resource:{{resource}}'
webviewResourceRoot: 'vscode-resource://{{resource}}'
});
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
assert.strictEqual(
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html')).toString(),
'vscode-resource:/Users/codey/file.html',
'vscode-resource://file///Users/codey/file.html',
'Unix basic'
);
assert.strictEqual(
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html#frag')).toString(),
'vscode-resource:/Users/codey/file.html#frag',
'vscode-resource://file///Users/codey/file.html#frag',
'Unix should preserve fragment'
);
assert.strictEqual(
webview.webview.asWebviewUri(URI.parse('file:///Users/codey/f%20ile.html')).toString(),
'vscode-resource:/Users/codey/f%20ile.html',
'vscode-resource://file///Users/codey/f%20ile.html',
'Unix with encoding'
);
assert.strictEqual(
webview.webview.asWebviewUri(URI.parse('file://localhost/Users/codey/file.html')).toString(),
'vscode-resource://localhost/Users/codey/file.html',
'vscode-resource://file//localhost/Users/codey/file.html',
'Unix should preserve authority'
);
assert.strictEqual(
webview.webview.asWebviewUri(URI.parse('file:///c:/codey/file.txt')).toString(),
'vscode-resource:/c%3A/codey/file.txt',
'vscode-resource://file///c%3A/codey/file.txt',
'Windows C drive'
);
});
@@ -92,7 +92,7 @@ suite('ExtHostWebview', () => {
const extHostWebviews = new ExtHostWebviews(SingleProxyRPCProtocol(shape), {
webviewCspSource: '',
webviewResourceRoot: `https://{{uuid}}.webview.contoso.com/commit{{resource}}`
webviewResourceRoot: `https://{{uuid}}.webview.contoso.com/commit/{{resource}}`
});
const webview = extHostWebviews.createWebviewPanel({} as any, 'type', 'title', 1, {});
@@ -102,31 +102,31 @@ suite('ExtHostWebview', () => {
assert.strictEqual(
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html')).toString()),
'webview.contoso.com/commit///Users/codey/file.html',
'webview.contoso.com/commit/file///Users/codey/file.html',
'Unix basic'
);
assert.strictEqual(
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/file.html#frag')).toString()),
'webview.contoso.com/commit///Users/codey/file.html#frag',
'webview.contoso.com/commit/file///Users/codey/file.html#frag',
'Unix should preserve fragment'
);
assert.strictEqual(
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///Users/codey/f%20ile.html')).toString()),
'webview.contoso.com/commit///Users/codey/f%20ile.html',
'webview.contoso.com/commit/file///Users/codey/f%20ile.html',
'Unix with encoding'
);
assert.strictEqual(
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file://localhost/Users/codey/file.html')).toString()),
'webview.contoso.com/commit//localhost/Users/codey/file.html',
'webview.contoso.com/commit/file//localhost/Users/codey/file.html',
'Unix should preserve authority'
);
assert.strictEqual(
stripEndpointUuid(webview.webview.asWebviewUri(URI.parse('file:///c:/codey/file.txt')).toString()),
'webview.contoso.com/commit///c%3A/codey/file.txt',
'webview.contoso.com/commit/file///c%3A/codey/file.txt',
'Windows C drive'
);
});

View File

@@ -35,14 +35,13 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IWindowsService, IWindowService, MenuBarVisibility, IURIToOpen, IOpenSettings, IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { MenuBarVisibility, IWindowConfiguration, IWindowOpenable, IOpenInWindowOptions, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened, IRecent } from 'vs/platform/history/common/history';
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { IPosition, Position as EditorPosition } from 'vs/editor/common/core/position';
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
@@ -92,7 +91,7 @@ export function createFileInput(instantiationService: IInstantiationService, res
return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined);
}
export const TestEnvironmentService = new WorkbenchEnvironmentService(parseArgs(process.argv, OPTIONS) as IWindowConfiguration, process.execPath);
export const TestEnvironmentService = new WorkbenchEnvironmentService(parseArgs(process.argv, OPTIONS) as IWindowConfiguration, process.execPath, 0);
export class TestContextService implements IWorkspaceContextService {
public _serviceBrand: undefined;
@@ -306,12 +305,10 @@ export function workbenchInstantiationService(): IInstantiationService {
instantiationService.stub(ITelemetryService, NullTelemetryService);
instantiationService.stub(INotificationService, new TestNotificationService());
instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService));
instantiationService.stub(IWindowService, new TestWindowService());
instantiationService.stub(IMenuService, new TestMenuService());
instantiationService.stub(IKeybindingService, new MockKeybindingService());
instantiationService.stub(IDecorationsService, new TestDecorationsService());
instantiationService.stub(IExtensionService, new TestExtensionService());
instantiationService.stub(IWindowsService, new TestWindowsService());
instantiationService.stub(IHostService, <IHostService>instantiationService.createInstance(TestHostService));
instantiationService.stub(ITextFileService, <ITextFileService>instantiationService.createInstance(TestTextFileService));
instantiationService.stub(ITextModelService, <ITextModelService>instantiationService.createInstance(TextModelResolverService));
@@ -1177,45 +1174,6 @@ export class TestCodeEditorService implements ICodeEditorService {
openCodeEditor(_input: IResourceInput, _source: ICodeEditor, _sideBySide?: boolean): Promise<ICodeEditor | undefined> { return Promise.resolve(undefined); }
}
export class TestWindowService implements IWindowService {
public _serviceBrand: undefined;
onDidChangeFocus: Event<boolean> = new Emitter<boolean>().event;
onDidChangeMaximize: Event<boolean>;
hasFocus = true;
readonly windowId = 0;
isFocused(): Promise<boolean> {
return Promise.resolve(false);
}
getRecentlyOpened(): Promise<IRecentlyOpened> {
return Promise.resolve({
workspaces: [],
files: []
});
}
addRecentlyOpened(_recents: IRecent[]): Promise<void> {
return Promise.resolve();
}
removeFromRecentlyOpened(_paths: URI[]): Promise<void> {
return Promise.resolve();
}
focusWindow(): Promise<void> {
return Promise.resolve();
}
openWindow(_uris: IURIToOpen[], _options?: IOpenSettings): Promise<void> {
return Promise.resolve();
}
}
export class TestLifecycleService implements ILifecycleService {
public _serviceBrand: undefined;
@@ -1255,58 +1213,6 @@ export class TestLifecycleService implements ILifecycleService {
}
}
export class TestWindowsService implements IWindowsService {
_serviceBrand: undefined;
readonly onWindowOpen: Event<number> = Event.None;
readonly onWindowFocus: Event<number> = Event.None;
readonly onWindowBlur: Event<number> = Event.None;
readonly onWindowMaximize: Event<number> = Event.None;
readonly onWindowUnmaximize: Event<number> = Event.None;
readonly onRecentlyOpenedChange: Event<void> = Event.None;
isFocused(_windowId: number): Promise<boolean> {
return Promise.resolve(false);
}
addRecentlyOpened(_recents: IRecent[]): Promise<void> {
return Promise.resolve();
}
removeFromRecentlyOpened(_paths: URI[]): Promise<void> {
return Promise.resolve();
}
clearRecentlyOpened(): Promise<void> {
return Promise.resolve();
}
getRecentlyOpened(_windowId: number): Promise<IRecentlyOpened> {
return Promise.resolve({
workspaces: [],
files: []
});
}
focusWindow(_windowId: number): Promise<void> {
return Promise.resolve();
}
// Global methods
openWindow(_windowId: number, _uris: IURIToOpen[], _options: IOpenSettings): Promise<void> {
return Promise.resolve();
}
getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
throw new Error('not implemented');
}
getActiveWindowId(): Promise<number | undefined> {
return Promise.resolve(undefined);
}
}
export class TestTextResourceConfigurationService implements ITextResourceConfigurationService {
_serviceBrand: undefined;
@@ -1367,7 +1273,12 @@ export class RemoteFileSystemProvider implements IFileSystemProvider {
readonly capabilities: FileSystemProviderCapabilities = this.diskFileSystemProvider.capabilities;
readonly onDidChangeCapabilities: Event<void> = this.diskFileSystemProvider.onDidChangeCapabilities;
readonly onDidChangeFile: Event<IFileChange[]> = Event.map(this.diskFileSystemProvider.onDidChangeFile, changes => changes.map(c => { c.resource = c.resource.with({ scheme: Schemas.vscodeRemote, authority: this.remoteAuthority }); return c; }));
readonly onDidChangeFile: Event<readonly IFileChange[]> = Event.map(this.diskFileSystemProvider.onDidChangeFile, changes => changes.map((c): IFileChange => {
return {
type: c.type,
resource: c.resource.with({ scheme: Schemas.vscodeRemote, authority: this.remoteAuthority }),
};
}));
watch(resource: URI, opts: IWatchOptions): IDisposable { return this.diskFileSystemProvider.watch(this.toFileResource(resource), opts); }
stat(resource: URI): Promise<IStat> { return this.diskFileSystemProvider.stat(this.toFileResource(resource)); }
@@ -1395,13 +1306,19 @@ export class TestHostService implements IHostService {
_serviceBrand: undefined;
readonly hasFocus: boolean = true;
readonly onDidChangeFocus: Event<boolean> = Event.None;
windowCount = Promise.resolve(1);
async restart(): Promise<void> { }
async reload(): Promise<void> { }
async closeWorkspace(): Promise<void> { }
async openEmptyWindow(options?: { reuse?: boolean, remoteAuthority?: string }): Promise<void> { }
async focus(): Promise<void> { }
async openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise<void> { }
async openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise<void> { }
async toggleFullScreen(): Promise<void> { }
}