mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Consistent naming for ext host <-> main process communication
This commit is contained in:
@@ -90,24 +90,24 @@ export abstract class MainThreadDiagnosticsShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadDocumentsShape {
|
||||
_tryOpenDocument(uri: URI): TPromise<any> { throw ni(); }
|
||||
$tryOpenDocument(uri: URI): TPromise<any> { throw ni(); }
|
||||
$registerTextContentProvider(handle:number, scheme: string): void { throw ni(); }
|
||||
$onVirtualDocumentChange(uri: URI, value: string): void { throw ni(); }
|
||||
$unregisterTextContentProvider(handle: number): void { throw ni(); }
|
||||
_trySaveDocument(uri: URI): TPromise<boolean> { throw ni(); }
|
||||
$trySaveDocument(uri: URI): TPromise<boolean> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadEditorsShape {
|
||||
_tryShowTextDocument(resource: URI, position: EditorPosition, preserveFocus: boolean): TPromise<string> { throw ni(); }
|
||||
_registerTextEditorDecorationType(key: string, options: editorCommon.IDecorationRenderOptions): void { throw ni(); }
|
||||
_removeTextEditorDecorationType(key: string): void { throw ni(); }
|
||||
_tryShowEditor(id: string, position: EditorPosition): TPromise<void> { throw ni(); }
|
||||
_tryHideEditor(id: string): TPromise<void> { throw ni(); }
|
||||
_trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> { throw ni(); }
|
||||
_trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): TPromise<any> { throw ni(); }
|
||||
_tryRevealRange(id: string, range: editorCommon.IRange, revealType: TextEditorRevealType): TPromise<any> { throw ni(); }
|
||||
_trySetSelections(id: string, selections: editorCommon.ISelection[]): TPromise<any> { throw ni(); }
|
||||
_tryApplyEdits(id: string, modelVersionId: number, edits: editorCommon.ISingleEditOperation[], setEndOfLine:EndOfLine): TPromise<boolean> { throw ni(); }
|
||||
$tryShowTextDocument(resource: URI, position: EditorPosition, preserveFocus: boolean): TPromise<string> { throw ni(); }
|
||||
$registerTextEditorDecorationType(key: string, options: editorCommon.IDecorationRenderOptions): void { throw ni(); }
|
||||
$removeTextEditorDecorationType(key: string): void { throw ni(); }
|
||||
$tryShowEditor(id: string, position: EditorPosition): TPromise<void> { throw ni(); }
|
||||
$tryHideEditor(id: string): TPromise<void> { throw ni(); }
|
||||
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> { throw ni(); }
|
||||
$trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): TPromise<any> { throw ni(); }
|
||||
$tryRevealRange(id: string, range: editorCommon.IRange, revealType: TextEditorRevealType): TPromise<any> { throw ni(); }
|
||||
$trySetSelections(id: string, selections: editorCommon.ISelection[]): TPromise<any> { throw ni(); }
|
||||
$tryApplyEdits(id: string, modelVersionId: number, edits: editorCommon.ISingleEditOperation[], setEndOfLine:EndOfLine): TPromise<boolean> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadErrorsShape {
|
||||
@@ -134,7 +134,7 @@ export abstract class MainThreadLanguageFeaturesShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadLanguagesShape {
|
||||
_getLanguages(): TPromise<string[]> { throw ni(); }
|
||||
$getLanguages(): TPromise<string[]> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadMessageServiceShape {
|
||||
@@ -142,10 +142,10 @@ export abstract class MainThreadMessageServiceShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadOutputServiceShape {
|
||||
append(channelId: string, label: string, value: string): TPromise<void> { throw ni(); }
|
||||
clear(channelId: string, label: string): TPromise<void> { throw ni(); }
|
||||
reveal(channelId: string, label: string, preserveFocus: boolean): TPromise<void> { throw ni(); }
|
||||
close(channelId: string): TPromise<void> { throw ni(); }
|
||||
$append(channelId: string, label: string, value: string): TPromise<void> { throw ni(); }
|
||||
$clear(channelId: string, label: string): TPromise<void> { throw ni(); }
|
||||
$reveal(channelId: string, label: string, preserveFocus: boolean): TPromise<void> { throw ni(); }
|
||||
$close(channelId: string): TPromise<void> { throw ni(); }
|
||||
}
|
||||
|
||||
export interface MyQuickPickItems extends IPickOpenEntry {
|
||||
@@ -159,13 +159,13 @@ export abstract class MainThreadQuickOpenShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadStatusBarShape {
|
||||
setEntry(id: number, text: string, tooltip: string, command: string, color: string, alignment: MainThreadStatusBarAlignment, priority: number): void { throw ni(); }
|
||||
dispose(id: number) { throw ni(); }
|
||||
$setEntry(id: number, text: string, tooltip: string, command: string, color: string, alignment: MainThreadStatusBarAlignment, priority: number): void { throw ni(); }
|
||||
$dispose(id: number) { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadStorageShape {
|
||||
getValue<T>(shared: boolean, key: string): TPromise<T> { throw ni(); }
|
||||
setValue(shared: boolean, key: string, value: any): TPromise<any> { throw ni(); }
|
||||
$getValue<T>(shared: boolean, key: string): TPromise<T> { throw ni(); }
|
||||
$setValue(shared: boolean, key: string, value: any): TPromise<any> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadTelemetryShape {
|
||||
@@ -211,13 +211,13 @@ export interface IModelAddedData {
|
||||
}
|
||||
export abstract class ExtHostDocumentsShape {
|
||||
$provideTextDocumentContent(handle: number, uri: URI): TPromise<string> { throw ni(); }
|
||||
_acceptModelAdd(initData: IModelAddedData): void { throw ni(); }
|
||||
_acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void { throw ni(); }
|
||||
_acceptModelSaved(strURL: string): void { throw ni(); }
|
||||
_acceptModelDirty(strURL: string): void { throw ni(); }
|
||||
_acceptModelReverted(strURL: string): void { throw ni(); }
|
||||
_acceptModelRemoved(strURL: string): void { throw ni(); }
|
||||
_acceptModelChanged(strURL: string, events: editorCommon.IModelContentChangedEvent2[]): void { throw ni(); }
|
||||
$acceptModelAdd(initData: IModelAddedData): void { throw ni(); }
|
||||
$acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void { throw ni(); }
|
||||
$acceptModelSaved(strURL: string): void { throw ni(); }
|
||||
$acceptModelDirty(strURL: string): void { throw ni(); }
|
||||
$acceptModelReverted(strURL: string): void { throw ni(); }
|
||||
$acceptModelRemoved(strURL: string): void { throw ni(); }
|
||||
$acceptModelChanged(strURL: string, events: editorCommon.IModelContentChangedEvent2[]): void { throw ni(); }
|
||||
}
|
||||
|
||||
export interface ITextEditorAddData {
|
||||
@@ -231,12 +231,12 @@ export interface ITextEditorPositionData {
|
||||
[id: string]: EditorPosition;
|
||||
}
|
||||
export abstract class ExtHostEditorsShape {
|
||||
_acceptTextEditorAdd(data: ITextEditorAddData): void { throw ni(); }
|
||||
_acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void { throw ni(); }
|
||||
_acceptSelectionsChanged(id: string, _selections: editorCommon.ISelection[]): void { throw ni(); }
|
||||
_acceptActiveEditorAndVisibleEditors(id: string, visibleIds: string[]): void { throw ni(); }
|
||||
_acceptEditorPositionData(data: ITextEditorPositionData): void { throw ni(); }
|
||||
_acceptTextEditorRemove(id: string): void { throw ni(); }
|
||||
$acceptTextEditorAdd(data: ITextEditorAddData): void { throw ni(); }
|
||||
$acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void { throw ni(); }
|
||||
$acceptSelectionsChanged(id: string, _selections: editorCommon.ISelection[]): void { throw ni(); }
|
||||
$acceptActiveEditorAndVisibleEditors(id: string, visibleIds: string[]): void { throw ni(); }
|
||||
$acceptEditorPositionData(data: ITextEditorPositionData): void { throw ni(); }
|
||||
$acceptTextEditorRemove(id: string): void { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostExtensionServiceShape {
|
||||
@@ -250,7 +250,7 @@ export interface FileSystemEvents {
|
||||
deleted: URI[];
|
||||
}
|
||||
export abstract class ExtHostFileSystemEventServiceShape {
|
||||
_onFileEvent(events: FileSystemEvents) { throw ni(); }
|
||||
$onFileEvent(events: FileSystemEvents) { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostLanguageFeaturesShape {
|
||||
|
||||
@@ -101,7 +101,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
|
||||
|
||||
let promise = this._documentLoader[uri.toString()];
|
||||
if (!promise) {
|
||||
promise = this._proxy._tryOpenDocument(uri).then(() => {
|
||||
promise = this._proxy.$tryOpenDocument(uri).then(() => {
|
||||
delete this._documentLoader[uri.toString()];
|
||||
return this._documentData[uri.toString()];
|
||||
}, err => {
|
||||
@@ -153,7 +153,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
|
||||
return asWinJsPromise(token => provider.provideTextDocumentContent(uri, token));
|
||||
}
|
||||
|
||||
public _acceptModelAdd(initData: IModelAddedData): void {
|
||||
public $acceptModelAdd(initData: IModelAddedData): void {
|
||||
let data = new ExtHostDocumentData(this._proxy, initData.url, initData.value.lines, initData.value.EOL, initData.modeId, initData.versionId, initData.isDirty);
|
||||
let key = data.document.uri.toString();
|
||||
if (this._documentData[key]) {
|
||||
@@ -163,7 +163,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
|
||||
this._onDidAddDocumentEventEmitter.fire(data.document);
|
||||
}
|
||||
|
||||
public _acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void {
|
||||
public $acceptModelModeChanged(strURL: string, oldModeId: string, newModeId: string): void {
|
||||
let data = this._documentData[strURL];
|
||||
|
||||
// Treat a mode change as a remove + add
|
||||
@@ -173,23 +173,23 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
|
||||
this._onDidAddDocumentEventEmitter.fire(data.document);
|
||||
}
|
||||
|
||||
public _acceptModelSaved(strURL: string): void {
|
||||
public $acceptModelSaved(strURL: string): void {
|
||||
let data = this._documentData[strURL];
|
||||
data._acceptIsDirty(false);
|
||||
this._onDidSaveDocumentEventEmitter.fire(data.document);
|
||||
}
|
||||
|
||||
public _acceptModelDirty(strURL: string): void {
|
||||
public $acceptModelDirty(strURL: string): void {
|
||||
let document = this._documentData[strURL];
|
||||
document._acceptIsDirty(true);
|
||||
}
|
||||
|
||||
public _acceptModelReverted(strURL: string): void {
|
||||
public $acceptModelReverted(strURL: string): void {
|
||||
let document = this._documentData[strURL];
|
||||
document._acceptIsDirty(false);
|
||||
}
|
||||
|
||||
public _acceptModelRemoved(strURL: string): void {
|
||||
public $acceptModelRemoved(strURL: string): void {
|
||||
if (!this._documentData[strURL]) {
|
||||
throw new Error('Document `' + strURL + '` does not exist.');
|
||||
}
|
||||
@@ -199,7 +199,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
|
||||
data.dispose();
|
||||
}
|
||||
|
||||
public _acceptModelChanged(strURL: string, events: editorCommon.IModelContentChangedEvent2[]): void {
|
||||
public $acceptModelChanged(strURL: string, events: editorCommon.IModelContentChangedEvent2[]): void {
|
||||
let data = this._documentData[strURL];
|
||||
data.onEvents(events);
|
||||
this._onDidChangeDocumentEventEmitter.fire({
|
||||
@@ -253,7 +253,7 @@ export class ExtHostDocumentData extends MirrorModel2 {
|
||||
get languageId() { return data._languageId; },
|
||||
get version() { return data._versionId; },
|
||||
get isDirty() { return data._isDirty; },
|
||||
save() { return data._proxy._trySaveDocument(data._uri); },
|
||||
save() { return data._proxy.$trySaveDocument(data._uri); },
|
||||
getText(range?) { return range ? data._getTextInRange(range) : data.getText(); },
|
||||
get lineCount() { return data._lines.length; },
|
||||
lineAt(lineOrPos) { return data.lineAt(lineOrPos); },
|
||||
|
||||
@@ -71,7 +71,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
}
|
||||
|
||||
showTextDocument(document: TextDocument, column: ViewColumn, preserveFocus: boolean): TPromise<vscode.TextEditor> {
|
||||
return this._proxy._tryShowTextDocument(<URI> document.uri, TypeConverters.fromViewColumn(column), preserveFocus).then(id => {
|
||||
return this._proxy.$tryShowTextDocument(<URI> document.uri, TypeConverters.fromViewColumn(column), preserveFocus).then(id => {
|
||||
let editor = this._editors[id];
|
||||
if (editor) {
|
||||
return editor;
|
||||
@@ -87,13 +87,13 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
|
||||
// --- called from main thread
|
||||
|
||||
_acceptTextEditorAdd(data: ITextEditorAddData): void {
|
||||
$acceptTextEditorAdd(data: ITextEditorAddData): void {
|
||||
let document = this._extHostDocuments.getDocumentData(data.document);
|
||||
let newEditor = new ExtHostTextEditor(this._proxy, data.id, document, data.selections.map(TypeConverters.toSelection), data.options, TypeConverters.toViewColumn(data.editorPosition));
|
||||
this._editors[data.id] = newEditor;
|
||||
}
|
||||
|
||||
_acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void {
|
||||
$acceptOptionsChanged(id: string, opts: IResolvedTextEditorConfiguration): void {
|
||||
let editor = this._editors[id];
|
||||
editor._acceptOptions(opts);
|
||||
this._onDidChangeTextEditorOptions.fire({
|
||||
@@ -102,7 +102,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
});
|
||||
}
|
||||
|
||||
_acceptSelectionsChanged(id: string, _selections: ISelection[]): void {
|
||||
$acceptSelectionsChanged(id: string, _selections: ISelection[]): void {
|
||||
let selections = _selections.map(TypeConverters.toSelection);
|
||||
let editor = this._editors[id];
|
||||
editor._acceptSelections(selections);
|
||||
@@ -112,7 +112,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
});
|
||||
}
|
||||
|
||||
_acceptActiveEditorAndVisibleEditors(id: string, visibleIds: string[]): void {
|
||||
$acceptActiveEditorAndVisibleEditors(id: string, visibleIds: string[]): void {
|
||||
this._visibleEditorIds = visibleIds;
|
||||
|
||||
if (this._activeEditorId === id) {
|
||||
@@ -123,7 +123,7 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
this._onDidChangeActiveTextEditor.fire(this.getActiveTextEditor());
|
||||
}
|
||||
|
||||
_acceptEditorPositionData(data: ITextEditorPositionData): void {
|
||||
$acceptEditorPositionData(data: ITextEditorPositionData): void {
|
||||
for (let id in data) {
|
||||
let textEditor = this._editors[id];
|
||||
let viewColumn = TypeConverters.toViewColumn(data[id]);
|
||||
@@ -134,15 +134,15 @@ export class ExtHostEditors extends ExtHostEditorsShape {
|
||||
}
|
||||
}
|
||||
|
||||
_acceptTextEditorRemove(id: string): void {
|
||||
$acceptTextEditorRemove(id: string): void {
|
||||
// make sure the removed editor is not visible
|
||||
let newVisibleEditors = this._visibleEditorIds.filter(visibleEditorId => visibleEditorId !== id);
|
||||
|
||||
if (this._activeEditorId === id) {
|
||||
// removing the current active editor
|
||||
this._acceptActiveEditorAndVisibleEditors(undefined, newVisibleEditors);
|
||||
this.$acceptActiveEditorAndVisibleEditors(undefined, newVisibleEditors);
|
||||
} else {
|
||||
this._acceptActiveEditorAndVisibleEditors(this._activeEditorId, newVisibleEditors);
|
||||
this.$acceptActiveEditorAndVisibleEditors(this._activeEditorId, newVisibleEditors);
|
||||
}
|
||||
|
||||
let editor = this._editors[id];
|
||||
@@ -161,11 +161,11 @@ class TextEditorDecorationType implements vscode.TextEditorDecorationType {
|
||||
constructor(proxy: MainThreadEditorsShape, options: vscode.DecorationRenderOptions) {
|
||||
this.key = TextEditorDecorationType._Keys.nextId();
|
||||
this._proxy = proxy;
|
||||
this._proxy._registerTextEditorDecorationType(this.key, <any>options);
|
||||
this._proxy.$registerTextEditorDecorationType(this.key, <any>options);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._proxy._removeTextEditorDecorationType(this.key);
|
||||
this._proxy.$removeTextEditorDecorationType(this.key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,11 +293,11 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
}
|
||||
|
||||
@deprecated('TextEditor.show') show(column: vscode.ViewColumn) {
|
||||
this._proxy._tryShowEditor(this._id, TypeConverters.fromViewColumn(column));
|
||||
this._proxy.$tryShowEditor(this._id, TypeConverters.fromViewColumn(column));
|
||||
}
|
||||
|
||||
@deprecated('TextEditor.hide') hide() {
|
||||
this._proxy._tryHideEditor(this._id);
|
||||
this._proxy.$tryHideEditor(this._id);
|
||||
}
|
||||
|
||||
// ---- the document
|
||||
@@ -319,7 +319,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
set options(value: TextEditorOptions) {
|
||||
this._options = value;
|
||||
this._runOnProxy(() => {
|
||||
return this._proxy._trySetOptions(this._id, this._options);
|
||||
return this._proxy.$trySetOptions(this._id, this._options);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
|
||||
setDecorations(decorationType: vscode.TextEditorDecorationType, ranges: Range[] | vscode.DecorationOptions[]): void {
|
||||
this._runOnProxy(
|
||||
() => this._proxy._trySetDecorations(
|
||||
() => this._proxy.$trySetDecorations(
|
||||
this._id,
|
||||
decorationType.key,
|
||||
TypeConverters.fromRangeOrRangeWithMessage(ranges)
|
||||
@@ -380,7 +380,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
|
||||
revealRange(range: Range, revealType: vscode.TextEditorRevealType): void {
|
||||
this._runOnProxy(
|
||||
() => this._proxy._tryRevealRange(
|
||||
() => this._proxy.$tryRevealRange(
|
||||
this._id,
|
||||
TypeConverters.fromRange(range),
|
||||
revealType || TextEditorRevealType.Default
|
||||
@@ -391,7 +391,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
|
||||
private _trySetSelection(silent: boolean): TPromise<vscode.TextEditor> {
|
||||
let selection = this._selections.map(TypeConverters.fromSelection);
|
||||
return this._runOnProxy(() => this._proxy._trySetSelections(this._id, selection), silent);
|
||||
return this._runOnProxy(() => this._proxy.$trySetSelections(this._id, selection), silent);
|
||||
}
|
||||
|
||||
_acceptSelections(selections: Selection[]): void {
|
||||
@@ -418,7 +418,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
};
|
||||
});
|
||||
|
||||
return this._proxy._tryApplyEdits(this._id, editData.documentVersionId, edits, editData.setEndOfLine);
|
||||
return this._proxy.$tryApplyEdits(this._id, editData.documentVersionId, edits, editData.setEndOfLine);
|
||||
}
|
||||
|
||||
// ---- util
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ExtHostLanguages {
|
||||
}
|
||||
|
||||
getLanguages(): TPromise<string[]> {
|
||||
return this._proxy._getLanguages();
|
||||
return this._proxy.$getLanguages();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ export class ExtHostOutputChannel implements vscode.OutputChannel {
|
||||
|
||||
dispose(): void {
|
||||
if (!this._disposed) {
|
||||
this._proxy.clear(this._id, this._name).then(() => {
|
||||
this._proxy.$clear(this._id, this._name).then(() => {
|
||||
this._disposed = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
append(value: string): void {
|
||||
this._proxy.append(this._id, this._name, value);
|
||||
this._proxy.$append(this._id, this._name, value);
|
||||
}
|
||||
|
||||
appendLine(value: string): void {
|
||||
@@ -43,7 +43,7 @@ export class ExtHostOutputChannel implements vscode.OutputChannel {
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this._proxy.clear(this._id, this._name);
|
||||
this._proxy.$clear(this._id, this._name);
|
||||
}
|
||||
|
||||
show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void {
|
||||
@@ -51,11 +51,11 @@ export class ExtHostOutputChannel implements vscode.OutputChannel {
|
||||
preserveFocus = columnOrPreserveFocus;
|
||||
}
|
||||
|
||||
this._proxy.reveal(this._id, this._name, preserveFocus);
|
||||
this._proxy.$reveal(this._id, this._name, preserveFocus);
|
||||
}
|
||||
|
||||
hide(): void {
|
||||
this._proxy.close(this._id);
|
||||
this._proxy.$close(this._id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
||||
|
||||
public hide(): void {
|
||||
this._visible = false;
|
||||
this._proxy.dispose(this.id);
|
||||
this._proxy.$dispose(this.id);
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
@@ -106,7 +106,7 @@ export class ExtHostStatusBarEntry implements StatusBarItem {
|
||||
this._timeoutHandle = null;
|
||||
|
||||
// Set to status bar
|
||||
this._proxy.setEntry(this.id, this.text, this.tooltip, this.command, this.color,
|
||||
this._proxy.$setEntry(this.id, this.text, this.tooltip, this.command, this.color,
|
||||
this._alignment === ExtHostStatusBarAlignment.Left ? MainThreadStatusBarAlignment.LEFT : MainThreadStatusBarAlignment.RIGHT,
|
||||
this._priority);
|
||||
}, 0);
|
||||
|
||||
@@ -17,10 +17,10 @@ export class ExtHostStorage {
|
||||
}
|
||||
|
||||
getValue<T>(shared: boolean, key: string, defaultValue?: T): TPromise<T> {
|
||||
return this._proxy.getValue(shared, key).then(value => value || defaultValue);
|
||||
return this._proxy.$getValue(shared, key).then(value => value || defaultValue);
|
||||
}
|
||||
|
||||
setValue(shared: boolean, key: string, value: any): TPromise<void> {
|
||||
return this._proxy.setValue(shared, key, value);
|
||||
return this._proxy.$setValue(shared, key, value);
|
||||
}
|
||||
}
|
||||
@@ -62,17 +62,17 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
|
||||
this._toDispose.push(eventService.addListener2(FileEventType.FILE_SAVED, (e: TextFileChangeEvent) => {
|
||||
if (this._shouldHandleFileEvent(e)) {
|
||||
this._proxy._acceptModelSaved(e.resource.toString());
|
||||
this._proxy.$acceptModelSaved(e.resource.toString());
|
||||
}
|
||||
}));
|
||||
this._toDispose.push(eventService.addListener2(FileEventType.FILE_REVERTED, (e: TextFileChangeEvent) => {
|
||||
if (this._shouldHandleFileEvent(e)) {
|
||||
this._proxy._acceptModelReverted(e.resource.toString());
|
||||
this._proxy.$acceptModelReverted(e.resource.toString());
|
||||
}
|
||||
}));
|
||||
this._toDispose.push(eventService.addListener2(FileEventType.FILE_DIRTY, (e: TextFileChangeEvent) => {
|
||||
if (this._shouldHandleFileEvent(e)) {
|
||||
this._proxy._acceptModelDirty(e.resource.toString());
|
||||
this._proxy.$acceptModelDirty(e.resource.toString());
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -106,7 +106,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
let modelUrl = model.uri;
|
||||
this._modelIsSynced[modelUrl.toString()] = true;
|
||||
this._modelToDisposeMap[modelUrl.toString()] = model.addBulkListener((events) => this._onModelEvents(modelUrl, events));
|
||||
this._proxy._acceptModelAdd({
|
||||
this._proxy.$acceptModelAdd({
|
||||
url: model.uri,
|
||||
versionId: model.getVersionId(),
|
||||
value: model.toRawText(),
|
||||
@@ -121,7 +121,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
if (!this._modelIsSynced[modelUrl.toString()]) {
|
||||
return;
|
||||
}
|
||||
this._proxy._acceptModelModeChanged(model.uri.toString(), oldModeId, model.getMode().getId());
|
||||
this._proxy.$acceptModelModeChanged(model.uri.toString(), oldModeId, model.getMode().getId());
|
||||
}
|
||||
|
||||
private _onModelRemoved(model: editorCommon.IModel): void {
|
||||
@@ -132,7 +132,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
delete this._modelIsSynced[modelUrl.toString()];
|
||||
this._modelToDisposeMap[modelUrl.toString()].dispose();
|
||||
delete this._modelToDisposeMap[modelUrl.toString()];
|
||||
this._proxy._acceptModelRemoved(modelUrl.toString());
|
||||
this._proxy.$acceptModelRemoved(modelUrl.toString());
|
||||
}
|
||||
|
||||
private _onModelEvents(modelUrl: URI, events: EmitterEvent[]): void {
|
||||
@@ -146,17 +146,17 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
}
|
||||
}
|
||||
if (changedEvents.length > 0) {
|
||||
this._proxy._acceptModelChanged(modelUrl.toString(), changedEvents);
|
||||
this._proxy.$acceptModelChanged(modelUrl.toString(), changedEvents);
|
||||
}
|
||||
}
|
||||
|
||||
// --- from extension host process
|
||||
|
||||
_trySaveDocument(uri: URI): TPromise<boolean> {
|
||||
$trySaveDocument(uri: URI): TPromise<boolean> {
|
||||
return this._textFileService.save(uri);
|
||||
}
|
||||
|
||||
_tryOpenDocument(uri: URI): TPromise<any> {
|
||||
$tryOpenDocument(uri: URI): TPromise<any> {
|
||||
|
||||
if (!uri.scheme || !(uri.fsPath || uri.authority)) {
|
||||
return TPromise.wrapError(`Invalid uri. Scheme and authority or path must be set.`);
|
||||
@@ -202,7 +202,7 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
|
||||
if (!this._modelIsSynced[uri.toString()]) {
|
||||
throw new Error(`expected URI ${uri.toString()} to have come to LIFE`);
|
||||
}
|
||||
return this._proxy._acceptModelDirty(uri.toString()); // mark as dirty
|
||||
return this._proxy.$acceptModelDirty(uri.toString()); // mark as dirty
|
||||
}).then(() => {
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -79,12 +79,12 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
let id = textEditor.getId();
|
||||
let toDispose: IDisposable[] = [];
|
||||
toDispose.push(textEditor.onConfigurationChanged((opts) => {
|
||||
this._proxy._acceptOptionsChanged(id, opts);
|
||||
this._proxy.$acceptOptionsChanged(id, opts);
|
||||
}));
|
||||
toDispose.push(textEditor.onSelectionChanged((selection) => {
|
||||
this._proxy._acceptSelectionsChanged(id, selection);
|
||||
this._proxy.$acceptSelectionsChanged(id, selection);
|
||||
}));
|
||||
this._proxy._acceptTextEditorAdd({
|
||||
this._proxy.$acceptTextEditorAdd({
|
||||
id: id,
|
||||
document: textEditor.getModel().uri,
|
||||
options: textEditor.getConfiguration(),
|
||||
@@ -101,7 +101,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
dispose(this._textEditorsListenersMap[id]);
|
||||
delete this._textEditorsListenersMap[id];
|
||||
delete this._textEditorsMap[id];
|
||||
this._proxy._acceptTextEditorRemove(id);
|
||||
this._proxy.$acceptTextEditorRemove(id);
|
||||
}
|
||||
|
||||
private _updateActiveAndVisibleTextEditors(): void {
|
||||
@@ -112,14 +112,14 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
if (activeEditor !== this._activeTextEditor || !arrayEquals(this._visibleEditors, visibleEditors, (a, b) => a === b)) {
|
||||
this._activeTextEditor = activeEditor;
|
||||
this._visibleEditors = visibleEditors;
|
||||
this._proxy._acceptActiveEditorAndVisibleEditors(this._activeTextEditor, this._visibleEditors);
|
||||
this._proxy.$acceptActiveEditorAndVisibleEditors(this._activeTextEditor, this._visibleEditors);
|
||||
}
|
||||
|
||||
// editor columns
|
||||
let editorPositionData = this._getTextEditorPositionData();
|
||||
if (!objectEquals(this._editorPositionData, editorPositionData)) {
|
||||
this._editorPositionData = editorPositionData;
|
||||
this._proxy._acceptEditorPositionData(this._editorPositionData);
|
||||
this._proxy.$acceptEditorPositionData(this._editorPositionData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
|
||||
// --- from extension host process
|
||||
|
||||
_tryShowTextDocument(resource: URI, position: EditorPosition, preserveFocus: boolean): TPromise<string> {
|
||||
$tryShowTextDocument(resource: URI, position: EditorPosition, preserveFocus: boolean): TPromise<string> {
|
||||
|
||||
const input = {
|
||||
resource,
|
||||
@@ -222,7 +222,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
});
|
||||
}
|
||||
|
||||
_tryShowEditor(id: string, position: EditorPosition): TPromise<void> {
|
||||
$tryShowEditor(id: string, position: EditorPosition): TPromise<void> {
|
||||
// check how often this is used
|
||||
this._telemetryService.publicLog('api.deprecated', { function: 'TextEditor.show' });
|
||||
|
||||
@@ -236,7 +236,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
}
|
||||
}
|
||||
|
||||
_tryHideEditor(id: string): TPromise<void> {
|
||||
$tryHideEditor(id: string): TPromise<void> {
|
||||
// check how often this is used
|
||||
this._telemetryService.publicLog('api.deprecated', { function: 'TextEditor.hide' });
|
||||
|
||||
@@ -251,7 +251,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
}
|
||||
}
|
||||
|
||||
_trySetSelections(id: string, selections: ISelection[]): TPromise<any> {
|
||||
$trySetSelections(id: string, selections: ISelection[]): TPromise<any> {
|
||||
if (!this._textEditorsMap[id]) {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
@@ -259,7 +259,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
_trySetDecorations(id: string, key: string, ranges: IDecorationOptions[]): TPromise<any> {
|
||||
$trySetDecorations(id: string, key: string, ranges: IDecorationOptions[]): TPromise<any> {
|
||||
if (!this._textEditorsMap[id]) {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
@@ -267,14 +267,14 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
_tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise<any> {
|
||||
$tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise<any> {
|
||||
if (!this._textEditorsMap[id]) {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
this._textEditorsMap[id].revealRange(range, revealType);
|
||||
}
|
||||
|
||||
_trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> {
|
||||
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> {
|
||||
if (!this._textEditorsMap[id]) {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
@@ -282,18 +282,18 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
_tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], setEndOfLine:EndOfLine): TPromise<boolean> {
|
||||
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], setEndOfLine:EndOfLine): TPromise<boolean> {
|
||||
if (!this._textEditorsMap[id]) {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
return TPromise.as(this._textEditorsMap[id].applyEdits(modelVersionId, edits, setEndOfLine));
|
||||
}
|
||||
|
||||
_registerTextEditorDecorationType(key: string, options: IDecorationRenderOptions): void {
|
||||
$registerTextEditorDecorationType(key: string, options: IDecorationRenderOptions): void {
|
||||
this._editorTracker.registerTextEditorDecorationType(key, options);
|
||||
}
|
||||
|
||||
_removeTextEditorDecorationType(key: string): void {
|
||||
$removeTextEditorDecorationType(key: string): void {
|
||||
this._editorTracker.removeTextEditorDecorationType(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class MainThreadFileSystemEventService {
|
||||
};
|
||||
|
||||
const scheduler = new RunOnceScheduler(() => {
|
||||
proxy._onFileEvent(events);
|
||||
proxy.$onFileEvent(events);
|
||||
events.created.length = 0;
|
||||
events.changed.length = 0;
|
||||
events.deleted.length = 0;
|
||||
|
||||
@@ -19,7 +19,7 @@ export class MainThreadLanguages extends MainThreadLanguagesShape {
|
||||
this._modeService = modeService;
|
||||
}
|
||||
|
||||
_getLanguages(): TPromise<string[]> {
|
||||
$getLanguages(): TPromise<string[]> {
|
||||
return TPromise.as(this._modeService.getRegisteredModes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,17 +27,17 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape {
|
||||
this._panelService = panelService;
|
||||
}
|
||||
|
||||
public append(channelId: string, label: string, value: string): TPromise<void> {
|
||||
public $append(channelId: string, label: string, value: string): TPromise<void> {
|
||||
this._getChannel(channelId, label).append(value);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public clear(channelId: string, label: string): TPromise<void> {
|
||||
public $clear(channelId: string, label: string): TPromise<void> {
|
||||
this._getChannel(channelId, label).clear();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public reveal(channelId: string, label: string, preserveFocus: boolean): TPromise<void> {
|
||||
public $reveal(channelId: string, label: string, preserveFocus: boolean): TPromise<void> {
|
||||
this._getChannel(channelId, label).show(preserveFocus);
|
||||
return undefined;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export class MainThreadOutputService extends MainThreadOutputServiceShape {
|
||||
return this._outputService.getChannel(channelId);
|
||||
}
|
||||
|
||||
public close(channelId: string): TPromise<void> {
|
||||
public $close(channelId: string): TPromise<void> {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
if (panel && panel.getId() === OUTPUT_PANEL_ID && channelId === this._outputService.getActiveChannel().id ) {
|
||||
this._partService.setPanelHidden(true);
|
||||
|
||||
@@ -18,7 +18,7 @@ export class MainThreadStatusBar extends MainThreadStatusBarShape {
|
||||
this.mapIdToDisposable = Object.create(null);
|
||||
}
|
||||
|
||||
setEntry(id: number, text: string, tooltip: string, command: string, color: string, alignment: MainThreadStatusBarAlignment, priority: number): void {
|
||||
$setEntry(id: number, text: string, tooltip: string, command: string, color: string, alignment: MainThreadStatusBarAlignment, priority: number): void {
|
||||
|
||||
// Dispose any old
|
||||
this.dispose(id);
|
||||
|
||||
@@ -17,7 +17,7 @@ export class MainThreadStorage extends MainThreadStorageShape {
|
||||
this._storageService = storageService;
|
||||
}
|
||||
|
||||
getValue<T>(shared: boolean, key: string): TPromise<T> {
|
||||
$getValue<T>(shared: boolean, key: string): TPromise<T> {
|
||||
let jsonValue = this._storageService.get(key, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
if (!jsonValue) {
|
||||
return TPromise.as(undefined);
|
||||
@@ -31,7 +31,7 @@ export class MainThreadStorage extends MainThreadStorageShape {
|
||||
}
|
||||
}
|
||||
|
||||
setValue(shared: boolean, key: string, value: any): TPromise<any> {
|
||||
$setValue(shared: boolean, key: string, value: any): TPromise<any> {
|
||||
let jsonValue: any;
|
||||
try {
|
||||
jsonValue = JSON.stringify(value);
|
||||
|
||||
Reference in New Issue
Block a user