提交 26769ff0 编写于 作者: A Alex Dima

Convert IInternalEditorOptions to InternalEditorOptions

上级 a2f2f4b0
......@@ -40,7 +40,7 @@ export class ScrollManager implements IDisposable {
listenOnDomNode: viewDomNode,
vertical: configScrollbarOpts.vertical,
horizontal: configScrollbarOpts.horizontal,
className: ClassNames.SCROLLABLE_ELEMENT + ' ' + this.configuration.editor.theme,
className: ClassNames.SCROLLABLE_ELEMENT + ' ' + this.configuration.editor.viewInfo.theme,
useShadows: false,
lazyRender: true,
saveLastScrollTimeOnClassName: ClassNames.VIEW_LINE
......@@ -63,7 +63,7 @@ export class ScrollManager implements IDisposable {
}));
this.toDispose.push(this.configuration.onDidChange((e:IConfigurationChangedEvent) => {
this.scrollbar.updateClassName(this.configuration.editor.theme);
this.scrollbar.updateClassName(ClassNames.SCROLLABLE_ELEMENT + ' ' + this.configuration.editor.viewInfo.theme);
if (e.viewInfo.scrollbar) {
let newOpts:ScrollableElementChangeOptions = {
canUseTranslate3d: true,
......
......@@ -23,7 +23,6 @@ export class ViewLine implements IVisibleLineData {
private _spaceWidth: number;
private _lineHeight: number;
private _stopRenderingLineAfter: number;
protected _fontLigatures: boolean;
private _domNode: FastDomNode;
......@@ -43,7 +42,6 @@ export class ViewLine implements IVisibleLineData {
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
this._lineHeight = this._context.configuration.editor.lineHeight;
this._stopRenderingLineAfter = this._context.configuration.editor.viewInfo.stopRenderingLineAfter;
this._fontLigatures = this._context.configuration.editor.fontLigatures;
this._domNode = null;
this._isInvalid = true;
......@@ -99,9 +97,6 @@ export class ViewLine implements IVisibleLineData {
if (e.viewInfo.stopRenderingLineAfter) {
this._stopRenderingLineAfter = this._context.configuration.editor.viewInfo.stopRenderingLineAfter;
}
if (e.fontLigatures) {
this._fontLigatures = this._context.configuration.editor.fontLigatures;
}
this._isInvalid = true;
}
......@@ -312,18 +307,6 @@ class WebKitViewLine extends ViewLine {
protected _readVisibleRangesForRange(startColumn:number, endColumn:number, clientRectDeltaLeft:number, endNode:HTMLElement): HorizontalRange[] {
let output = super._readVisibleRangesForRange(startColumn, endColumn, clientRectDeltaLeft, endNode);
if (this._fontLigatures && output.length === 1 && endColumn > 1 && endColumn === this._charOffsetInPart.length) {
let lastSpanBoundingClientRect = (<HTMLElement>this._getReadingTarget().lastChild).getBoundingClientRect();
let lastSpanBoundingClientRectRight = lastSpanBoundingClientRect.right - clientRectDeltaLeft;
if (startColumn === endColumn) {
output[0].left = lastSpanBoundingClientRectRight;
output[0].width = 0;
} else {
output[0].width = lastSpanBoundingClientRectRight - output[0].left;
}
return output;
}
if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._charOffsetInPart.length)) {
return output;
}
......
......@@ -42,7 +42,7 @@ export class DecorationsOverviewRuler extends ViewPart {
getVerticalOffsetForLine
);
this._overviewRuler.setLanesCount(this._context.configuration.editor.viewInfo.overviewRulerLanes, false);
let theme = this._context.configuration.editor.theme;
let theme = this._context.configuration.editor.viewInfo.theme;
this._overviewRuler.setUseDarkColor(!themes.isLightTheme(theme), false);
this._shouldUpdateDecorations = true;
......@@ -91,8 +91,8 @@ export class DecorationsOverviewRuler extends ViewPart {
shouldRender = true;
}
if (e.theme) {
let theme = this._context.configuration.editor.theme;
if (e.viewInfo.theme) {
let theme = this._context.configuration.editor.viewInfo.theme;
this._overviewRuler.setUseDarkColor(!themes.isLightTheme(theme), false);
shouldRender = true;
}
......
......@@ -91,9 +91,9 @@ export class CodeEditorWidget extends CommonCodeEditor implements editorBrowser.
}
public updateOptions(newOptions:editorCommon.IEditorOptions): void {
let oldTheme = this._configuration.editor.theme;
let oldTheme = this._configuration.editor.viewInfo.theme;
super.updateOptions(newOptions);
let newTheme = this._configuration.editor.theme;
let newTheme = this._configuration.editor.viewInfo.theme;
if (oldTheme !== newTheme) {
this.render();
......
......@@ -1718,7 +1718,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
class InlineViewZonesComputer extends ViewZonesComputer {
private originalModel:editorCommon.IModel;
private modifiedEditorConfiguration:editorCommon.IInternalEditorOptions;
private modifiedEditorConfiguration:editorCommon.InternalEditorOptions;
private modifiedEditorTabSize:number;
constructor(lineChanges:editorCommon.ILineChange[], originalForeignVZ:editorCommon.IEditorWhitespace[], modifiedForeignVZ:editorCommon.IEditorWhitespace[], originalEditor:editorBrowser.ICodeEditor, modifiedEditor:editorBrowser.ICodeEditor) {
......@@ -1773,7 +1773,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
};
}
private renderOriginalLine(count:number, originalModel:editorCommon.IModel, config:editorCommon.IInternalEditorOptions, tabSize:number, lineNumber:number, decorations:editorCommon.IModelDecoration[]): string[] {
private renderOriginalLine(count:number, originalModel:editorCommon.IModel, config:editorCommon.InternalEditorOptions, tabSize:number, lineNumber:number, decorations:editorCommon.IModelDecoration[]): string[] {
let lineContent = originalModel.getLineContent(lineNumber);
let lineTokens = new ViewLineTokens([new ViewLineToken(0, '')], 0, lineContent.length);
......
......@@ -181,7 +181,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
}
}
public getConfiguration(): editorCommon.IInternalEditorOptions {
public getConfiguration(): editorCommon.InternalEditorOptions {
return this._configuration.editorClone;
}
......
......@@ -11,7 +11,7 @@ import * as objects from 'vs/base/common/objects';
import * as platform from 'vs/base/common/platform';
import {Extensions, IConfigurationRegistry, IConfigurationNode} from 'vs/platform/configuration/common/configurationRegistry';
import {Registry} from 'vs/platform/platform';
import {DefaultConfig, DEFAULT_INDENTATION, GOLDEN_LINE_HEIGHT_RATIO} from 'vs/editor/common/config/defaultConfig';
import {DefaultConfig, DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE, GOLDEN_LINE_HEIGHT_RATIO} from 'vs/editor/common/config/defaultConfig';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {EditorLayoutProvider} from 'vs/editor/common/viewLayout/editorLayoutProvider';
import {ScrollbarVisibility} from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
......@@ -62,46 +62,6 @@ export class ConfigurationWithDefaults {
}
}
export class InternalEditorOptions implements editorCommon.IInternalEditorOptions {
_internalEditorOptionsBrand: void;
wordSeparators: string;
theme:string;
readOnly:boolean;
fontLigatures:boolean;
tabFocusMode:boolean;
stopLineTokenizationAfter:number;
longLineBoundary:number;
autoClosingBrackets:boolean;
useTabStops: boolean;
trimAutoWhitespace: boolean;
layoutInfo: editorCommon.EditorLayoutInfo;
fontInfo: editorCommon.FontInfo;
viewInfo: editorCommon.InternalEditorViewOptions;
wrappingInfo: editorCommon.EditorWrappingInfo;
contribInfo: editorCommon.EditorContribOptions;
lineHeight:number;
constructor(input:editorCommon.IInternalEditorOptions) {
this.wordSeparators = String(input.wordSeparators);
this.theme = String(input.theme);
this.readOnly = Boolean(input.readOnly);
this.fontLigatures = Boolean(input.fontLigatures);
this.tabFocusMode = Boolean(input.tabFocusMode);
this.stopLineTokenizationAfter = Number(input.stopLineTokenizationAfter)|0;
this.longLineBoundary = Number(input.longLineBoundary)|0;
this.autoClosingBrackets = Boolean(input.autoClosingBrackets);
this.useTabStops = Boolean(input.useTabStops);
this.trimAutoWhitespace = Boolean(input.trimAutoWhitespace);
this.layoutInfo = input.layoutInfo.clone();
this.fontInfo = input.fontInfo.clone();
this.viewInfo = input.viewInfo.clone();
this.wrappingInfo = input.wrappingInfo.clone();
this.contribInfo = input.contribInfo.clone();
this.lineHeight = Number(input.lineHeight)|0;
}
}
class InternalEditorOptionsHelper {
constructor() {
......@@ -114,7 +74,7 @@ class InternalEditorOptionsHelper {
editorClassName:string,
isDominatedByLongLines:boolean,
lineCount: number
): editorCommon.IInternalEditorOptions {
): editorCommon.InternalEditorOptions {
let wrappingColumn = toInteger(opts.wrappingColumn, -1);
......@@ -203,6 +163,7 @@ class InternalEditorOptionsHelper {
}
let viewInfo = new editorCommon.InternalEditorViewOptions({
theme: opts.theme,
experimentalScreenReader: toBoolean(opts.experimentalScreenReader),
rulers: toSortedIntegerArray(opts.rulers),
ariaLabel: String(opts.ariaLabel),
......@@ -239,28 +200,21 @@ class InternalEditorOptionsHelper {
folding: toBoolean(opts.folding),
});
return {
// ---- Options that are transparent - get no massaging
theme: opts.theme,
readOnly: readOnly,
wordSeparators: String(opts.wordSeparators),
fontLigatures: toBoolean(opts.fontLigatures),
tabFocusMode: tabFocusMode,
return new editorCommon.InternalEditorOptions({
stopLineTokenizationAfter: stopLineTokenizationAfter,
longLineBoundary: toInteger(opts.longLineBoundary),
lineHeight: fontInfo.lineHeight, // todo -> duplicated in styling
readOnly: readOnly,
wordSeparators: String(opts.wordSeparators),
autoClosingBrackets: toBoolean(opts.autoClosingBrackets),
useTabStops: toBoolean(opts.useTabStops),
trimAutoWhitespace: toBoolean(opts.trimAutoWhitespace),
tabFocusMode: tabFocusMode,
layoutInfo: layoutInfo,
fontInfo: fontInfo,
viewInfo: viewInfo,
wrappingInfo: wrappingInfo,
contribInfo: contribInfo,
lineHeight: fontInfo.lineHeight, // todo -> duplicated in styling
};
});
}
private static _sanitizeScrollbarOpts(raw:editorCommon.IEditorScrollbarOptions, mouseWheelScrollSensitivity:number): editorCommon.InternalEditorScrollbarOptions {
......@@ -298,30 +252,6 @@ class InternalEditorOptionsHelper {
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity
});
}
public static createConfigurationChangedEvent(prevOpts:InternalEditorOptions, newOpts:InternalEditorOptions): editorCommon.IConfigurationChangedEvent {
return {
wordSeparators: (prevOpts.wordSeparators !== newOpts.wordSeparators),
theme: (prevOpts.theme !== newOpts.theme),
readOnly: (prevOpts.readOnly !== newOpts.readOnly),
fontLigatures: (prevOpts.fontLigatures !== newOpts.fontLigatures),
tabFocusMode: (prevOpts.tabFocusMode !== newOpts.tabFocusMode),
stopLineTokenizationAfter: (prevOpts.stopLineTokenizationAfter !== newOpts.stopLineTokenizationAfter),
longLineBoundary: (prevOpts.longLineBoundary !== newOpts.longLineBoundary),
autoClosingBrackets: (prevOpts.autoClosingBrackets !== newOpts.autoClosingBrackets),
useTabStops: (prevOpts.useTabStops !== newOpts.useTabStops),
trimAutoWhitespace: (prevOpts.trimAutoWhitespace !== newOpts.trimAutoWhitespace),
layoutInfo: (!prevOpts.layoutInfo.equals(newOpts.layoutInfo)),
fontInfo: (!prevOpts.fontInfo.equals(newOpts.fontInfo)),
viewInfo: prevOpts.viewInfo.createChangeEvent(newOpts.viewInfo),
wrappingInfo: (!prevOpts.wrappingInfo.equals(newOpts.wrappingInfo)),
contribInfo: (!prevOpts.contribInfo.equals(newOpts.contribInfo)),
lineHeight: (prevOpts.lineHeight !== newOpts.lineHeight),
};
}
}
function toBoolean(value:any): boolean {
......@@ -412,8 +342,8 @@ export interface IElementSizeObserver {
export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration {
public editor:InternalEditorOptions;
public editorClone:InternalEditorOptions;
public editor:editorCommon.InternalEditorOptions;
public editorClone:editorCommon.InternalEditorOptions;
protected _configWithDefaults:ConfigurationWithDefaults;
protected _elementSizeObserver: IElementSizeObserver;
......@@ -429,9 +359,8 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
this._elementSizeObserver = elementSizeObserver;
this._isDominatedByLongLines = false;
this._lineCount = 1;
this.editor = this._computeInternalOptions();
this.editorClone = new InternalEditorOptions(this.editor);
this.editorClone = this.editor.clone();
}
public dispose(): void {
......@@ -439,41 +368,25 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
}
protected _recomputeOptions(): void {
let oldOpts = this.editor;
this.editor = this._computeInternalOptions();
this.editorClone = new InternalEditorOptions(this.editor);
let changeEvent = InternalEditorOptionsHelper.createConfigurationChangedEvent(oldOpts, this.editor);
let hasChanged = false;
let keys = Object.keys(changeEvent);
for (let i = 0, len = keys.length; i < len; i++) {
let key = keys[i];
if (changeEvent[key] === true) {
hasChanged = true;
break;
}
}
this._setOptions(this._computeInternalOptions());
}
keys = Object.keys(changeEvent.viewInfo);
for (let i = 0, len = keys.length; i < len; i++) {
let key = keys[i];
if (changeEvent[key] === true) {
hasChanged = true;
break;
}
private _setOptions(newOptions:editorCommon.InternalEditorOptions): void {
if (this.editor && this.editor.equals(newOptions)) {
return;
}
if (hasChanged) {
this._onDidChange.fire(changeEvent);
}
let changeEvent = this.editor.createChangeEvent(newOptions);
this.editor = newOptions;
this.editorClone = this.editor.clone();
this._onDidChange.fire(changeEvent);
}
public getRawOptions(): editorCommon.IEditorOptions {
return this._configWithDefaults.getEditorOptions();
}
private _computeInternalOptions(): InternalEditorOptions {
private _computeInternalOptions(): editorCommon.InternalEditorOptions {
let opts = this._configWithDefaults.getEditorOptions();
let editorClassName = this._getEditorClassName(opts.theme, toBoolean(opts.fontLigatures));
......@@ -485,7 +398,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
}
let result = InternalEditorOptionsHelper.createInternalEditorOptions(
return InternalEditorOptionsHelper.createInternalEditorOptions(
this.getOuterWidth(),
this.getOuterHeight(),
opts,
......@@ -498,8 +411,6 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
this._isDominatedByLongLines,
this._lineCount
);
return new InternalEditorOptions(result);
}
public updateOptions(newOptions:editorCommon.IEditorOptions): void {
......@@ -764,7 +675,7 @@ let editorConfiguration:IConfigurationNode = {
},
'editor.trimAutoWhitespace' : {
'type': 'boolean',
'default': DefaultConfig.editor.trimAutoWhitespace,
'default': DEFAULT_TRIM_AUTO_WHITESPACE,
'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace")
},
'editor.dismissPeekOnEsc' : {
......
......@@ -18,6 +18,7 @@ export const DEFAULT_INDENTATION = {
insertSpaces: true,
detectIndentation: true
};
export const DEFAULT_TRIM_AUTO_WHITESPACE = true;
const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace';
const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace';
......@@ -90,7 +91,6 @@ class ConfigClass implements IConfiguration {
renderWhitespace: false,
indentGuides: false,
useTabStops: true,
trimAutoWhitespace: true,
fontFamily: (
platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
......
......@@ -400,7 +400,6 @@ export interface IEditorOptions {
*/
wordWrapBreakObtrusiveCharacters?: string;
// autoSize?:boolean;
/**
* Control what pressing Tab does.
* If it is false, pressing Tab or Shift-Tab will be handled by the editor.
......@@ -511,10 +510,6 @@ export interface IEditorOptions {
* Inserting and deleting whitespace follows tab stops.
*/
useTabStops?: boolean;
/**
* Remove trailing auto inserted whitespace.
*/
trimAutoWhitespace?: boolean;
/**
* The font family
*/
......@@ -666,6 +661,7 @@ export class EditorWrappingInfo {
export class InternalEditorViewOptions {
_internalEditorViewOptionsBrand: void;
theme:string;
experimentalScreenReader: boolean;
rulers: number[];
ariaLabel: string;
......@@ -686,6 +682,7 @@ export class InternalEditorViewOptions {
scrollbar:InternalEditorScrollbarOptions;
constructor(source:{
theme:string;
experimentalScreenReader: boolean;
rulers: number[];
ariaLabel: string;
......@@ -705,6 +702,7 @@ export class InternalEditorViewOptions {
indentGuides: boolean;
scrollbar:InternalEditorScrollbarOptions;
}) {
this.theme = String(source.theme);
this.experimentalScreenReader = Boolean(source.experimentalScreenReader);
this.rulers = InternalEditorViewOptions._toSortedIntegerArray(source.rulers);
this.ariaLabel = String(source.ariaLabel);
......@@ -755,7 +753,8 @@ export class InternalEditorViewOptions {
public equals(other:InternalEditorViewOptions): boolean {
return (
this.experimentalScreenReader === other.experimentalScreenReader
this.theme === other.theme
&& this.experimentalScreenReader === other.experimentalScreenReader
&& InternalEditorViewOptions._numberArraysEqual(this.rulers, other.rulers)
&& this.ariaLabel === other.ariaLabel
&& this.lineNumbers === other.lineNumbers
......@@ -778,6 +777,7 @@ export class InternalEditorViewOptions {
public createChangeEvent(newOpts:InternalEditorViewOptions): IViewConfigurationChangedEvent {
return {
theme: this.theme !== newOpts.theme,
experimentalScreenReader: this.experimentalScreenReader !== newOpts.experimentalScreenReader,
rulers: (!InternalEditorViewOptions._numberArraysEqual(this.rulers, newOpts.rulers)),
ariaLabel: this.ariaLabel !== newOpts.ariaLabel,
......@@ -805,6 +805,7 @@ export class InternalEditorViewOptions {
}
export interface IViewConfigurationChangedEvent {
theme: boolean;
experimentalScreenReader: boolean;
rulers: boolean;
ariaLabel: boolean;
......@@ -896,64 +897,114 @@ export class EditorContribOptions {
/**
* Internal configuration options (transformed or computed) for the editor.
*/
export interface IInternalEditorOptions {
readOnly:boolean;
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;
// ---- cursor options
wordSeparators: string;
autoClosingBrackets:boolean;
useTabStops: boolean;
tabFocusMode:boolean;
// ---- model options
trimAutoWhitespace: boolean;
stopLineTokenizationAfter:number;
longLineBoundary:number;
// ---- Options that are transparent - get no massaging
theme:string; // todo: move to viewInfo
fontLigatures:boolean; // todo: move to fontInfo
// ---- Options that are computed
// ---- grouped options
layoutInfo: EditorLayoutInfo;
fontInfo: FontInfo;
viewInfo: InternalEditorViewOptions;
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
/**
* Computed line height (deduced from theme and CSS) in px.
*/
lineHeight:number; // todo: move to fontInfo
constructor(source: {
stopLineTokenizationAfter:number;
longLineBoundary:number;
lineHeight:number;
readOnly:boolean;
wordSeparators: string;
autoClosingBrackets:boolean;
useTabStops: boolean;
tabFocusMode:boolean;
layoutInfo: EditorLayoutInfo;
fontInfo: FontInfo;
viewInfo: InternalEditorViewOptions;
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);
this.autoClosingBrackets = Boolean(source.autoClosingBrackets);
this.useTabStops = Boolean(source.useTabStops);
this.tabFocusMode = Boolean(source.tabFocusMode);
this.layoutInfo = source.layoutInfo.clone();
this.fontInfo = source.fontInfo.clone();
this.viewInfo = source.viewInfo.clone();
this.wrappingInfo = source.wrappingInfo.clone();
this.contribInfo = source.contribInfo.clone();
}
public equals(other:InternalEditorOptions): boolean {
return (
this.stopLineTokenizationAfter === other.stopLineTokenizationAfter
&& this.longLineBoundary === other.longLineBoundary
&& this.lineHeight === other.lineHeight
&& this.readOnly === other.readOnly
&& this.wordSeparators === other.wordSeparators
&& this.autoClosingBrackets === other.autoClosingBrackets
&& this.useTabStops === other.useTabStops
&& this.tabFocusMode === other.tabFocusMode
&& this.layoutInfo.equals(other.layoutInfo)
&& this.fontInfo.equals(other.fontInfo)
&& this.viewInfo.equals(other.viewInfo)
&& this.wrappingInfo.equals(other.wrappingInfo)
&& this.contribInfo.equals(other.contribInfo)
);
}
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),
autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets),
useTabStops: (this.useTabStops !== newOpts.useTabStops),
tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode),
layoutInfo: (!this.layoutInfo.equals(newOpts.layoutInfo)),
fontInfo: (!this.fontInfo.equals(newOpts.fontInfo)),
viewInfo: this.viewInfo.createChangeEvent(newOpts.viewInfo),
wrappingInfo: (!this.wrappingInfo.equals(newOpts.wrappingInfo)),
contribInfo: (!this.contribInfo.equals(newOpts.contribInfo)),
};
}
public clone(): InternalEditorOptions {
return new InternalEditorOptions(this);
}
}
/**
* An event describing that the configuration of the editor has changed.
*/
export interface IConfigurationChangedEvent {
wordSeparators: boolean;
// ---- Options that are transparent - get no massaging
theme: boolean;
readOnly: boolean;
fontLigatures: boolean;
tabFocusMode: boolean;
stopLineTokenizationAfter: boolean;
longLineBoundary: boolean;
// ---- Options that are transparent - get no massaging
lineHeight: boolean;
readOnly: boolean;
wordSeparators: boolean;
autoClosingBrackets: boolean;
useTabStops: boolean;
trimAutoWhitespace: boolean;
// ---- Options that are computed
tabFocusMode: boolean;
layoutInfo: boolean;
fontInfo: boolean;
viewInfo: IViewConfigurationChangedEvent;
wrappingInfo: boolean;
contribInfo: boolean;
lineHeight: boolean;
}
/**
......@@ -2789,7 +2840,7 @@ export class FontInfo extends BareFontInfo {
export interface IConfiguration {
onDidChange: Event<IConfigurationChangedEvent>;
editor:IInternalEditorOptions;
editor:InternalEditorOptions;
setLineCount(lineCount:number): void;
}
......@@ -3314,7 +3365,7 @@ export interface ICommonCodeEditor extends IEditor {
/**
* Returns the current editor's configuration
*/
getConfiguration(): IInternalEditorOptions;
getConfiguration(): InternalEditorOptions;
/**
* Returns the 'raw' editor's configuration, as it was applied over the defaults, but without any computed members.
......
......@@ -11,7 +11,7 @@ import {Range} from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {ModelLine} from 'vs/editor/common/model/modelLine';
import {guessIndentation} from 'vs/editor/common/model/indentationGuesser';
import {DEFAULT_INDENTATION, DefaultConfig} from 'vs/editor/common/config/defaultConfig';
import {DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE} from 'vs/editor/common/config/defaultConfig';
var LIMIT_FIND_COUNT = 999;
......@@ -21,7 +21,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
tabSize: DEFAULT_INDENTATION.tabSize,
insertSpaces: DEFAULT_INDENTATION.insertSpaces,
detectIndentation: false,
trimAutoWhitespace: DefaultConfig.editor.trimAutoWhitespace,
trimAutoWhitespace: DEFAULT_TRIM_AUTO_WHITESPACE,
defaultEOL: editorCommon.DefaultEndOfLine.LF
};
......
......@@ -26,7 +26,7 @@ import {IModelService} from 'vs/editor/common/services/modelService';
import {IResourceService} from 'vs/editor/common/services/resourceService';
import * as platform from 'vs/base/common/platform';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {DEFAULT_INDENTATION, DefaultConfig} from 'vs/editor/common/config/defaultConfig';
import {DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE} from 'vs/editor/common/config/defaultConfig';
import {IMessageService} from 'vs/platform/message/common/message';
export interface IRawModelData {
......@@ -221,7 +221,7 @@ export class ModelServiceImpl implements IModelService {
insertSpaces: DEFAULT_INDENTATION.insertSpaces,
detectIndentation: DEFAULT_INDENTATION.detectIndentation,
defaultEOL: (platform.isLinux || platform.isMacintosh) ? editorCommon.DefaultEndOfLine.LF : editorCommon.DefaultEndOfLine.CRLF,
trimAutoWhitespace: DefaultConfig.editor.trimAutoWhitespace
trimAutoWhitespace: DEFAULT_TRIM_AUTO_WHITESPACE
};
this._threadService = threadService;
this._markerService = markerService;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册