mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Merge branch 'master' into ben/stacks
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import {readonly, illegalArgument} from 'vs/base/common/errors';
|
||||
import {IdGenerator} from 'vs/base/common/idGenerator';
|
||||
import Event, {Emitter} from 'vs/base/common/event';
|
||||
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
@@ -171,13 +173,13 @@ export class ExtHostEditors {
|
||||
|
||||
class TextEditorDecorationType implements vscode.TextEditorDecorationType {
|
||||
|
||||
private static LAST_ID: number = 0;
|
||||
private static _Keys = new IdGenerator('TextEditorDecorationType');
|
||||
|
||||
private _proxy: MainThreadEditors;
|
||||
public key: string;
|
||||
|
||||
constructor(proxy: MainThreadEditors, options: vscode.DecorationRenderOptions) {
|
||||
this.key = 'TextEditorDecorationType' + (++TextEditorDecorationType.LAST_ID);
|
||||
this.key = TextEditorDecorationType._Keys.nextId();
|
||||
this._proxy = proxy;
|
||||
this._proxy._registerTextEditorDecorationType(this.key, <any>options);
|
||||
}
|
||||
@@ -267,24 +269,13 @@ export class TextEditorEdit {
|
||||
|
||||
setEndOfLine(endOfLine:EndOfLine): void {
|
||||
if (endOfLine !== EndOfLine.LF && endOfLine !== EndOfLine.CRLF) {
|
||||
throw illegalArg('endOfLine');
|
||||
throw illegalArgument('endOfLine');
|
||||
}
|
||||
|
||||
this._setEndOfLine = endOfLine;
|
||||
}
|
||||
}
|
||||
|
||||
function readonly(name: string, alt?: string) {
|
||||
let message = `The property '${name}' is readonly.`;
|
||||
if (alt) {
|
||||
message += ` Use '${alt}' instead.`;
|
||||
}
|
||||
return new Error(message);
|
||||
}
|
||||
|
||||
function illegalArg(name: string) {
|
||||
return new Error(`illgeal argument '${name}'`);
|
||||
}
|
||||
|
||||
function deprecated(name: string, message: string = 'Refer to the documentation for further details.') {
|
||||
return (target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) => {
|
||||
@@ -378,7 +369,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
|
||||
set selection(value: Selection) {
|
||||
if (!(value instanceof Selection)) {
|
||||
throw illegalArg('selection');
|
||||
throw illegalArgument('selection');
|
||||
}
|
||||
this._selections = [value];
|
||||
this._trySetSelection(true);
|
||||
@@ -390,7 +381,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
|
||||
|
||||
set selections(value: Selection[]) {
|
||||
if (!Array.isArray(value) || value.some(a => !(a instanceof Selection))) {
|
||||
throw illegalArg('selections');
|
||||
throw illegalArgument('selections');
|
||||
}
|
||||
this._selections = value;
|
||||
this._trySetSelection(true);
|
||||
|
||||
Reference in New Issue
Block a user