提交 53c0599c 编写于 作者: B Benjamin Pasero

inputs - some cleanup

上级 4a97fd5b
......@@ -4,17 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {BaseTextEditorModel} from 'vs/workbench/browser/parts/editor/textEditorModel';
import {IIdentifiedSingleEditOperation} from 'vs/editor/common/editorCommon';
import {EditorModel} from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import {URL} from 'vs/base/common/network';
import {Position} from 'vs/editor/common/core/position';
import {Range} from 'vs/editor/common/core/range';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {EditOperation} from 'vs/editor/common/core/editOperation';
/**
* An editor model whith an in-memory, readonly content that is backed by an existing editor model.
......
......@@ -100,10 +100,6 @@ export class StringEditorModel extends BaseTextEditorModel {
return null;
}
public setMime(mime: string): void {
this.mime = mime;
}
public getMime(): string {
return this.mime;
}
......@@ -112,12 +108,12 @@ export class StringEditorModel extends BaseTextEditorModel {
// Create text editor model if not yet done
if (!this.textEditorModel) {
return this.createTextEditorModel(this.value, this.mime, this.resource);
return this.createTextEditorModel(this.value, this.resource, this.mime);
}
// Otherwise update
else {
this.updateTextEditorModel(this.value, this.mime);
this.updateTextEditorModel(this.value);
}
return TPromise.as<EditorModel>(this);
......
......@@ -41,7 +41,7 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd
/**
* Creates the text editor model with the provided value, mime (can be comma separated for multiple values) and optional resource URL.
*/
protected createTextEditorModel(value: string, mime?: string, resource?: URI): TPromise<EditorModel> {
protected createTextEditorModel(value: string, resource?: URI, mime?: string): TPromise<EditorModel> {
let firstLineText = this.getFirstLineText(value);
// To avoid flickering, give the mode at most 50ms to load. If the mode doesn't load in 50ms, proceed creating the model with a mode promise
......
......@@ -289,7 +289,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements IEncodin
else {
diag('load() - created text editor model', this.resource, new Date());
this.createTextEditorModelPromise = this.createTextEditorModel(content.value, null, content.resource).then(() => {
this.createTextEditorModelPromise = this.createTextEditorModel(content.value, content.resource).then(() => {
this.createTextEditorModelPromise = null;
this.setDirty(false); // Ensure we are not tracking a stale state
......
......@@ -35,7 +35,7 @@ suite("Workbench - EditorModel", () => {
let m = new MyTextEditorModel(modelService, modeService);
m.load().then(function(model: any) {
assert(model === m);
return model.createTextEditorModel("foo", "text/plain").then(function() {
return model.createTextEditorModel("foo", null, "text/plain").then(function() {
assert.strictEqual(m.isResolved(), true);
});
}).done(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册