提交 067d266d 编写于 作者: J Johannes Rieken

more UriComponents in mainThread-land, #40169

上级 7f712487
......@@ -5,7 +5,7 @@
'use strict';
import { IMarkerService, IMarkerData } from 'vs/platform/markers/common/markers';
import URI from 'vs/base/common/uri';
import URI, { UriComponents } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { MainThreadDiagnosticsShape, MainContext, IExtHostContext } from '../node/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
......@@ -27,10 +27,10 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
this._activeOwners.forEach(owner => this._markerService.changeAll(owner, undefined));
}
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any> {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): TPromise<any> {
for (let entry of entries) {
let [uri, markers] = entry;
this._markerService.changeOne(owner, uri, markers);
this._markerService.changeOne(owner, URI.revive(uri), markers);
}
this._activeOwners.add(owner);
return undefined;
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
import { MainThreadDiaglogsShape, MainContext, IExtHostContext, MainThreadDialogOpenOptions, MainThreadDialogSaveOptions } from '../node/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
......@@ -56,7 +57,7 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
result.buttonLabel = options.openLabel;
}
if (options.defaultUri) {
result.defaultPath = options.defaultUri.fsPath;
result.defaultPath = URI.revive(options.defaultUri).fsPath;
}
if (!options.canSelectFiles && !options.canSelectFolders) {
options.canSelectFiles = true;
......@@ -82,7 +83,7 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
};
if (options.defaultUri) {
result.defaultPath = options.defaultUri.fsPath;
result.defaultPath = URI.revive(options.defaultUri).fsPath;
}
if (options.saveLabel) {
result.buttonLabel = options.saveLabel;
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import URI, { UriComponents } from 'vs/base/common/uri';
import { IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { IModel } from 'vs/editor/common/editorCommon';
......@@ -63,8 +63,8 @@ export class MainThreadDocumentContentProviders implements MainThreadDocumentCon
}
}
$onVirtualDocumentChange(uri: URI, value: ITextSource): void {
const model = this._modelService.getModel(uri);
$onVirtualDocumentChange(uri: UriComponents, value: ITextSource): void {
const model = this._modelService.getModel(URI.revive(uri));
if (!model) {
return;
}
......
......@@ -113,12 +113,12 @@ export interface MainThreadConfigurationShape extends IDisposable {
}
export interface MainThreadDiagnosticsShape extends IDisposable {
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any>;
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): TPromise<any>;
$clear(owner: string): TPromise<any>;
}
export interface MainThreadDialogOpenOptions {
defaultUri?: URI;
defaultUri?: UriComponents;
openLabel?: string;
canSelectFiles?: boolean;
canSelectFolders?: boolean;
......@@ -127,7 +127,7 @@ export interface MainThreadDialogOpenOptions {
}
export interface MainThreadDialogSaveOptions {
defaultUri?: URI;
defaultUri?: UriComponents;
saveLabel?: string;
filters?: { [name: string]: string[] };
}
......@@ -146,7 +146,7 @@ export interface MainThreadDecorationsShape extends IDisposable {
export interface MainThreadDocumentContentProvidersShape extends IDisposable {
$registerTextContentProvider(handle: number, scheme: string): void;
$unregisterTextContentProvider(handle: number): void;
$onVirtualDocumentChange(uri: URI, value: ITextSource): void;
$onVirtualDocumentChange(uri: UriComponents, value: ITextSource): void;
}
export interface MainThreadDocumentsShape extends IDisposable {
......@@ -668,10 +668,10 @@ export const MainContext = {
MainThreadCommands: <ProxyIdentifier<MainThreadCommandsShape>>createMainId<MainThreadCommandsShape>('MainThreadCommands', ProxyType.CustomMarshaller),
MainThreadConfiguration: createMainId<MainThreadConfigurationShape>('MainThreadConfiguration', ProxyType.CustomMarshaller),
MainThreadDebugService: createMainId<MainThreadDebugServiceShape>('MainThreadDebugService', ProxyType.CustomMarshaller),
MainThreadDecorations: createMainId<MainThreadDecorationsShape>('MainThreadDecorations', ProxyType.NativeJSON),
MainThreadDiagnostics: createMainId<MainThreadDiagnosticsShape>('MainThreadDiagnostics', ProxyType.CustomMarshaller),
MainThreadDialogs: createMainId<MainThreadDiaglogsShape>('MainThreadDiaglogs', ProxyType.CustomMarshaller),
MainThreadDocuments: createMainId<MainThreadDocumentsShape>('MainThreadDocuments', ProxyType.CustomMarshaller),
MainThreadDecorations: createMainId<MainThreadDecorationsShape>('MainThreadDecorations'),
MainThreadDiagnostics: createMainId<MainThreadDiagnosticsShape>('MainThreadDiagnostics'),
MainThreadDialogs: createMainId<MainThreadDiaglogsShape>('MainThreadDiaglogs'),
MainThreadDocuments: createMainId<MainThreadDocumentsShape>('MainThreadDocuments'),
MainThreadDocumentContentProviders: createMainId<MainThreadDocumentContentProvidersShape>('MainThreadDocumentContentProviders', ProxyType.CustomMarshaller),
MainThreadEditors: createMainId<MainThreadEditorsShape>('MainThreadEditors'),
MainThreadErrors: createMainId<MainThreadErrorsShape>('MainThreadErrors'),
......@@ -681,7 +681,7 @@ export const MainContext = {
MainThreadMessageService: createMainId<MainThreadMessageServiceShape>('MainThreadMessageService', ProxyType.CustomMarshaller),
MainThreadOutputService: createMainId<MainThreadOutputServiceShape>('MainThreadOutputService'),
MainThreadProgress: createMainId<MainThreadProgressShape>('MainThreadProgress'),
MainThreadQuickOpen: createMainId<MainThreadQuickOpenShape>('MainThreadQuickOpen', ProxyType.CustomMarshaller),
MainThreadQuickOpen: createMainId<MainThreadQuickOpenShape>('MainThreadQuickOpen'),
MainThreadStatusBar: createMainId<MainThreadStatusBarShape>('MainThreadStatusBar'),
MainThreadStorage: createMainId<MainThreadStorageShape>('MainThreadStorage', ProxyType.CustomMarshaller),
MainThreadTelemetry: createMainId<MainThreadTelemetryShape>('MainThreadTelemetry', ProxyType.CustomMarshaller),
......
......@@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import URI from 'vs/base/common/uri';
import URI, { UriComponents } from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
import { DiagnosticCollection } from 'vs/workbench/api/node/extHostDiagnostics';
import { Diagnostic, DiagnosticSeverity, Range } from 'vs/workbench/api/node/extHostTypes';
......@@ -18,7 +18,7 @@ import { mock } from 'vs/workbench/test/electron-browser/api/mock';
suite('ExtHostDiagnostics', () => {
class DiagnosticsShape extends mock<MainThreadDiagnosticsShape>() {
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any> {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): TPromise<any> {
return TPromise.as(null);
}
$clear(owner: string): TPromise<any> {
......@@ -163,9 +163,9 @@ suite('ExtHostDiagnostics', () => {
test('diagnostics collection, set tuple overrides, #11547', function () {
let lastEntries: [URI, IMarkerData[]][];
let lastEntries: [UriComponents, IMarkerData[]][];
let collection = new DiagnosticCollection('test', new class extends DiagnosticsShape {
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any> {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): TPromise<any> {
lastEntries = entries;
return super.$changeMany(owner, entries);
}
......@@ -237,9 +237,9 @@ suite('ExtHostDiagnostics', () => {
test('diagnostic capping', function () {
let lastEntries: [URI, IMarkerData[]][];
let lastEntries: [UriComponents, IMarkerData[]][];
let collection = new DiagnosticCollection('test', new class extends DiagnosticsShape {
$changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise<any> {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[]][]): TPromise<any> {
lastEntries = entries;
return super.$changeMany(owner, entries);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册