提交 1547d80b 编写于 作者: A Alex Dima

Remove more editor options

上级 26769ff0
......@@ -669,8 +669,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
if (this.model) {
this.domElement.setAttribute('data-mode-id', this.model.getMode().getId());
this._langIdKey.set(this.model.getMode().getId());
this.model.setStopLineTokenizationAfter(this._configuration.editor.stopLineTokenizationAfter);
this._configuration.setIsDominatedByLongLines(this.model.isDominatedByLongLines(this._configuration.editor.longLineBoundary));
this._configuration.setIsDominatedByLongLines(this.model.isDominatedByLongLines());
this.model.onBeforeAttached();
......
......@@ -78,15 +78,6 @@ class InternalEditorOptionsHelper {
let wrappingColumn = toInteger(opts.wrappingColumn, -1);
let stopLineTokenizationAfter:number;
if (typeof opts.stopLineTokenizationAfter !== 'undefined') {
stopLineTokenizationAfter = toInteger(opts.stopLineTokenizationAfter, -1);
} else if (wrappingColumn >= 0) {
stopLineTokenizationAfter = -1;
} else {
stopLineTokenizationAfter = 10000;
}
let stopRenderingLineAfter:number;
if (typeof opts.stopRenderingLineAfter !== 'undefined') {
stopRenderingLineAfter = toInteger(opts.stopRenderingLineAfter, -1);
......@@ -201,8 +192,6 @@ class InternalEditorOptionsHelper {
});
return new editorCommon.InternalEditorOptions({
stopLineTokenizationAfter: stopLineTokenizationAfter,
longLineBoundary: toInteger(opts.longLineBoundary),
lineHeight: fontInfo.lineHeight, // todo -> duplicated in styling
readOnly: readOnly,
wordSeparators: String(opts.wordSeparators),
......
......@@ -69,9 +69,6 @@ class ConfigClass implements IConfiguration {
wordWrapBreakAfterCharacters: ' \t})]?|&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー’”〉》」』】〕)]}」',
wordWrapBreakObtrusiveCharacters: '.',
tabFocusMode: false,
// stopLineTokenizationAfter
// stopRenderingLineAfter
longLineBoundary: 300,
// Features
hover: true,
......
......@@ -408,24 +408,12 @@ export interface IEditorOptions {
*/
tabFocusMode?:boolean;
/**
* Performance guard: Stop tokenizing a line after x characters.
* Defaults to 10000 if wrappingColumn is -1. Defaults to -1 if wrappingColumn is >= 0.
* Use -1 to never stop tokenization.
*/
stopLineTokenizationAfter?:number;
/**
* Performance guard: Stop rendering a line after x characters.
* Defaults to 10000 if wrappingColumn is -1. Defaults to -1 if wrappingColumn is >= 0.
* Use -1 to never stop rendering
*/
stopRenderingLineAfter?:number;
/**
* Performance guard: Force viewport width wrapping if more than half of the
* characters in a model are on lines of length >= `longLineBoundary`.
* Defaults to 300.
*/
longLineBoundary?:number;
/**
* Enable hover.
* Defaults to true.
......@@ -900,8 +888,6 @@ export class EditorContribOptions {
export class InternalEditorOptions {
_internalEditorOptionsBrand: void;
stopLineTokenizationAfter:number; // todo: move to model opts
longLineBoundary:number; // todo: move to model opts
lineHeight:number; // todo: move to fontInfo
readOnly:boolean;
......@@ -918,8 +904,6 @@ export class InternalEditorOptions {
contribInfo: EditorContribOptions;
constructor(source: {
stopLineTokenizationAfter:number;
longLineBoundary:number;
lineHeight:number;
readOnly:boolean;
wordSeparators: string;
......@@ -932,8 +916,6 @@ export class InternalEditorOptions {
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
}) {
this.stopLineTokenizationAfter = source.stopLineTokenizationAfter|0;
this.longLineBoundary = source.longLineBoundary|0;
this.lineHeight = source.lineHeight|0;
this.readOnly = Boolean(source.readOnly);
this.wordSeparators = String(source.wordSeparators);
......@@ -949,9 +931,7 @@ export class InternalEditorOptions {
public equals(other:InternalEditorOptions): boolean {
return (
this.stopLineTokenizationAfter === other.stopLineTokenizationAfter
&& this.longLineBoundary === other.longLineBoundary
&& this.lineHeight === other.lineHeight
this.lineHeight === other.lineHeight
&& this.readOnly === other.readOnly
&& this.wordSeparators === other.wordSeparators
&& this.autoClosingBrackets === other.autoClosingBrackets
......@@ -967,8 +947,6 @@ export class InternalEditorOptions {
public createChangeEvent(newOpts:InternalEditorOptions): IConfigurationChangedEvent {
return {
stopLineTokenizationAfter: (this.stopLineTokenizationAfter !== newOpts.stopLineTokenizationAfter),
longLineBoundary: (this.longLineBoundary !== newOpts.longLineBoundary),
lineHeight: (this.lineHeight !== newOpts.lineHeight),
readOnly: (this.readOnly !== newOpts.readOnly),
wordSeparators: (this.wordSeparators !== newOpts.wordSeparators),
......@@ -992,8 +970,6 @@ export class InternalEditorOptions {
* An event describing that the configuration of the editor has changed.
*/
export interface IConfigurationChangedEvent {
stopLineTokenizationAfter: boolean;
longLineBoundary: boolean;
lineHeight: boolean;
readOnly: boolean;
wordSeparators: boolean;
......@@ -1546,11 +1522,11 @@ export interface ITextModel {
/**
* Splits characters in two buckets. First bucket (A) is of characters that
* sit in lines with length < `longLineBoundary`. Second bucket (B) is of
* characters that sit in lines with length >= `longLineBoundary`.
* sit in lines with length < `LONG_LINE_BOUNDARY`. Second bucket (B) is of
* characters that sit in lines with length >= `LONG_LINE_BOUNDARY`.
* If count(B) > count(A) return true. Returns false otherwise.
*/
isDominatedByLongLines(longLineBoundary:number): boolean;
isDominatedByLongLines(): boolean;
/**
* Get the number of lines in the model.
......@@ -1650,12 +1626,6 @@ export interface IFoundBracket {
*/
export interface ITokenizedModel extends ITextModel {
/**
* Set the value at which to stop tokenization.
* The default is 10000.
*/
setStopLineTokenizationAfter(stopLineTokenizationAfter:number): void;
/**
* Tokenize if necessary and get the tokens for the line `lineNumber`.
* @param lineNumber The line number
......
......@@ -14,6 +14,7 @@ import {guessIndentation} from 'vs/editor/common/model/indentationGuesser';
import {DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE} from 'vs/editor/common/config/defaultConfig';
var LIMIT_FIND_COUNT = 999;
export const LONG_LINE_BOUNDARY = 1000;
export class TextModel extends OrderGuaranteeEventEmitter implements editorCommon.ITextModel {
......@@ -21,8 +22,8 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
tabSize: DEFAULT_INDENTATION.tabSize,
insertSpaces: DEFAULT_INDENTATION.insertSpaces,
detectIndentation: false,
defaultEOL: editorCommon.DefaultEndOfLine.LF,
trimAutoWhitespace: DEFAULT_TRIM_AUTO_WHITESPACE,
defaultEOL: editorCommon.DefaultEndOfLine.LF
};
_lines:ModelLine[];
......@@ -382,7 +383,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
return result;
}
public isDominatedByLongLines(longLineBoundary:number): boolean {
public isDominatedByLongLines(): boolean {
var smallLineCharCount = 0,
longLineCharCount = 0,
i: number,
......@@ -392,7 +393,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
for (i = 0, len = this._lines.length; i < len; i++) {
lineLength = lines[i].text.length;
if (lineLength >= longLineBoundary) {
if (lineLength >= LONG_LINE_BOUNDARY) {
longLineCharCount += lineLength;
} else {
smallLineCharCount += lineLength;
......
......@@ -11,7 +11,6 @@ import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {StopWatch} from 'vs/base/common/stopwatch';
import * as timer from 'vs/base/common/timer';
import {TPromise} from 'vs/base/common/winjs.base';
import {DefaultConfig} from 'vs/editor/common/config/defaultConfig';
import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ModelLine} from 'vs/editor/common/model/modelLine';
......@@ -178,7 +177,6 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
private _modeListener: IDisposable;
private _modeToModelBinder:ModeToModelBinder;
private _tokensInflatorMap:TokensInflatorMap;
private _stopLineTokenizationAfter:number;
private _invalidLineStartIndex:number;
private _lastState:IState;
......@@ -201,7 +199,6 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
this._modeListener = null;
this._modeToModelBinder = null;
this._tokensInflatorMap = null;
this._stopLineTokenizationAfter = DefaultConfig.editor.stopLineTokenizationAfter;
this._invalidLineStartIndex = 0;
this._lastState = null;
......@@ -404,10 +401,6 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
this._beginBackgroundTokenization();
}
public setStopLineTokenizationAfter(stopLineTokenizationAfter:number): void {
this._stopLineTokenizationAfter = stopLineTokenizationAfter;
}
public getLineTokens(lineNumber:number, inaccurateTokensAcceptable:boolean = false): editorCommon.ILineTokens {
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value ' + lineNumber + ' for `lineNumber`');
......@@ -589,7 +582,6 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
tokenizedChars = 0,
currentCharsToTokenize = 0,
currentEstimatedTimeToTokenize = 0,
stopLineTokenizationAfter = this._stopLineTokenizationAfter,
sw = StopWatch.create(false),
elapsedTime: number;
......@@ -607,9 +599,6 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
// Compute how many characters will be tokenized for this line
currentCharsToTokenize = this._lines[lineNumber - 1].text.length;
if (stopLineTokenizationAfter !== -1 && currentCharsToTokenize > stopLineTokenizationAfter) {
currentCharsToTokenize = stopLineTokenizationAfter;
}
if (tokenizedChars > 0) {
// If we have enough history, estimate how long tokenizing this line would take
......@@ -659,10 +648,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
private _updateTokensUntilLine(lineNumber:number, emitEvents:boolean): void {
var linesLength = this._lines.length;
var endLineIndex = lineNumber - 1;
var stopLineTokenizationAfter = this._stopLineTokenizationAfter;
if (stopLineTokenizationAfter === -1) {
stopLineTokenizationAfter = 1000000000; // 1 billion, if a line is so long, you have other trouble :).
}
var stopLineTokenizationAfter = 1000000000; // 1 billion, if a line is so long, you have other trouble :).
var fromLineNumber = this._invalidLineStartIndex + 1, toLineNumber = lineNumber;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册