mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 04:53:33 +01:00
Add two alternative language-changing interface functions
This commit is contained in:
@@ -258,6 +258,9 @@ export function createApiFactory(
|
||||
getLanguages(): TPromise<string[]> {
|
||||
return extHostLanguages.getLanguages();
|
||||
},
|
||||
setLanguageById(documentUri: vscode.Uri, languageId: string): TPromise<void> {
|
||||
return extHostLanguages.setLanguageById(documentUri, languageId);
|
||||
},
|
||||
match(selector: vscode.DocumentSelector, document: vscode.TextDocument): number {
|
||||
return score(typeConverters.LanguageSelector.from(selector), document.uri, document.languageId, true);
|
||||
},
|
||||
|
||||
@@ -194,6 +194,7 @@ export interface MainThreadTextEditorsShape extends IDisposable {
|
||||
$tryHideEditor(id: string): TPromise<void>;
|
||||
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<void>;
|
||||
$trySetLanguageById(id: string, languageId: string): TPromise<void>;
|
||||
$trySetLanguageByName(id: string, languageName: string): TPromise<void>;
|
||||
$trySetDecorations(id: string, key: string, ranges: editorCommon.IDecorationOptions[]): TPromise<void>;
|
||||
$trySetDecorationsFast(id: string, key: string, ranges: number[]): TPromise<void>;
|
||||
$tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise<void>;
|
||||
@@ -288,6 +289,7 @@ export interface MainThreadLanguageFeaturesShape extends IDisposable {
|
||||
|
||||
export interface MainThreadLanguagesShape extends IDisposable {
|
||||
$getLanguages(): TPromise<string[]>;
|
||||
$setLanguageById(resource: UriComponents, languageId: string): TPromise<void>;
|
||||
}
|
||||
|
||||
export interface MainThreadMessageOptions {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { MainContext, MainThreadLanguagesShape, IMainContext } from './extHost.protocol';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class ExtHostLanguages {
|
||||
|
||||
@@ -20,4 +21,7 @@ export class ExtHostLanguages {
|
||||
getLanguages(): TPromise<string[]> {
|
||||
return this._proxy.$getLanguages();
|
||||
}
|
||||
setLanguageById(documentUri: vscode.Uri, languageId: string): TPromise<void> {
|
||||
return this._proxy.$setLanguageById(documentUri, languageId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,8 +435,12 @@ export class ExtHostTextEditor implements vscode.TextEditor {
|
||||
this._trySetSelection();
|
||||
}
|
||||
|
||||
setLanguageById(language_id: string): void {
|
||||
this._runOnProxy(() => this._proxy.$trySetLanguageById(this._id, language_id));
|
||||
setLanguageById(languageId: string): void {
|
||||
this._runOnProxy(() => this._proxy.$trySetLanguageById(this._id, languageId));
|
||||
}
|
||||
|
||||
setLanguageByName(languageName: string): void {
|
||||
this._runOnProxy(() => this._proxy.$trySetLanguageByName(this._id, languageName));
|
||||
}
|
||||
|
||||
setDecorations(decorationType: vscode.TextEditorDecorationType, ranges: Range[] | vscode.DecorationOptions[]): void {
|
||||
|
||||
Reference in New Issue
Block a user