Skip to content

Commit 363b976

Browse files
committed
Convert more editor options
1 parent 75ffa8b commit 363b976

53 files changed

Lines changed: 1555 additions & 1282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/lib/tslint/noUnexternalizedStringsRule.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const Lint = require("tslint");
1111
*/
1212
class Rule extends Lint.Rules.AbstractRule {
1313
apply(sourceFile) {
14+
if (/\.d.ts$/.test(sourceFile.fileName)) {
15+
return [];
16+
}
1417
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
1518
}
1619
}

build/lib/tslint/noUnexternalizedStringsRule.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import * as Lint from 'tslint';
1111
*/
1212
export class Rule extends Lint.Rules.AbstractRule {
1313
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
14+
if (/\.d.ts$/.test(sourceFile.fileName)) {
15+
return [];
16+
}
1417
return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions()));
1518
}
1619
}

build/monaco/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName,
148148
}
149149
});
150150
}
151-
result = result.replace(/export default/g, 'export');
152-
result = result.replace(/export declare/g, 'export');
151+
result = result.replace(/export default /g, 'export ');
152+
result = result.replace(/export declare /g, 'export ');
153+
result = result.replace(/declare /g, '');
153154
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
154155
result = result.replace(/const enum/, 'enum');
155156
enums.push(result);

build/monaco/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati
178178
}
179179
});
180180
}
181-
result = result.replace(/export default/g, 'export');
182-
result = result.replace(/export declare/g, 'export');
181+
result = result.replace(/export default /g, 'export ');
182+
result = result.replace(/export declare /g, 'export ');
183+
result = result.replace(/declare /g, '');
183184

184185
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
185186
result = result.replace(/const enum/, 'enum');

build/monaco/monaco.d.ts.recipe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface ICommandHandler {
6262
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
6363
#includeAll(vs/editor/common/model/textModelEvents):
6464
#includeAll(vs/editor/common/controller/cursorEvents):
65+
#include(vs/platform/accessibility/common/accessibility): AccessibilitySupport
6566
#includeAll(vs/editor/common/config/editorOptions):
6667
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
6768
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo

src/vs/editor/browser/controller/mouseHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export class MouseHandler extends ViewEventHandler {
217217
const targetIsContent = (t.type === editorBrowser.MouseTargetType.CONTENT_TEXT || t.type === editorBrowser.MouseTargetType.CONTENT_EMPTY);
218218
const targetIsGutter = (t.type === editorBrowser.MouseTargetType.GUTTER_GLYPH_MARGIN || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS || t.type === editorBrowser.MouseTargetType.GUTTER_LINE_DECORATIONS);
219219
const targetIsLineNumbers = (t.type === editorBrowser.MouseTargetType.GUTTER_LINE_NUMBERS);
220-
const selectOnLineNumbers = this._context.configuration.getOption<typeof EditorOption.selectOnLineNumbers>(EditorOptionId.selectOnLineNumbers);
220+
const selectOnLineNumbers = this._context.configuration.options.get<typeof EditorOption.selectOnLineNumbers>(EditorOptionId.selectOnLineNumbers);
221221
const targetIsViewZone = (t.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || t.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE);
222222
const targetIsWidget = (t.type === editorBrowser.MouseTargetType.CONTENT_WIDGET);
223223

src/vs/editor/browser/controller/mouseTarget.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ClientCoordinates, EditorMouseEvent, EditorPagePosition, PageCoordinate
1010
import { PartFingerprint, PartFingerprints } from 'vs/editor/browser/view/viewPart';
1111
import { ViewLine } from 'vs/editor/browser/viewParts/lines/viewLine';
1212
import { IViewCursorRenderData } from 'vs/editor/browser/viewParts/viewCursors/viewCursor';
13-
import { EditorLayoutInfo } from 'vs/editor/common/config/editorOptions';
13+
import { EditorLayoutInfo, EditorOptionId, EditorOption } from 'vs/editor/common/config/editorOptions';
1414
import { Position } from 'vs/editor/common/core/position';
1515
import { Range as EditorRange } from 'vs/editor/common/core/range';
1616
import { HorizontalRange } from 'vs/editor/common/view/renderingContext';
@@ -239,7 +239,8 @@ export class HitTestContext {
239239

240240
constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastViewCursorsRenderData: IViewCursorRenderData[]) {
241241
this.model = context.model;
242-
this.layoutInfo = context.configuration.editor.layoutInfo;
242+
const options = context.configuration.options;
243+
this.layoutInfo = options.get<typeof EditorOption.layoutInfo>(EditorOptionId.layoutInfo);
243244
this.viewDomNode = viewHelper.viewDomNode;
244245
this.lineHeight = context.configuration.editor.lineHeight;
245246
this.typicalHalfwidthCharacterWidth = context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
@@ -713,7 +714,8 @@ export class MouseTargetFactory {
713714
}
714715

715716
public getMouseColumn(editorPos: EditorPagePosition, pos: PageCoordinates): number {
716-
const layoutInfo = this._context.configuration.editor.layoutInfo;
717+
const options = this._context.configuration.options;
718+
const layoutInfo = options.get<typeof EditorOption.layoutInfo>(EditorOptionId.layoutInfo);
717719
const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + pos.x - editorPos.x - layoutInfo.contentLeft;
718720
return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, this._context.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth);
719721
}

src/vs/editor/browser/controller/textAreaHandler.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ViewController } from 'vs/editor/browser/view/viewController';
1616
import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart';
1717
import { LineNumbersOverlay } from 'vs/editor/browser/viewParts/lineNumbers/lineNumbers';
1818
import { Margin } from 'vs/editor/browser/viewParts/margin/margin';
19-
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
19+
import { RenderLineNumbersType, EditorOptionId, EditorOption } from 'vs/editor/common/config/editorOptions';
2020
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
2121
import { WordCharacterClass, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
2222
import { Position } from 'vs/editor/common/core/position';
@@ -119,11 +119,13 @@ export class TextAreaHandler extends ViewPart {
119119
this._viewHelper = viewHelper;
120120

121121
const conf = this._context.configuration.editor;
122+
const options = this._context.configuration.options;
123+
const layoutInfo = options.get<typeof EditorOption.layoutInfo>(EditorOptionId.layoutInfo);
122124

123125
this._accessibilitySupport = conf.accessibilitySupport;
124-
this._contentLeft = conf.layoutInfo.contentLeft;
125-
this._contentWidth = conf.layoutInfo.contentWidth;
126-
this._contentHeight = conf.layoutInfo.contentHeight;
126+
this._contentLeft = layoutInfo.contentLeft;
127+
this._contentWidth = layoutInfo.contentWidth;
128+
this._contentHeight = layoutInfo.contentHeight;
127129
this._scrollLeft = 0;
128130
this._scrollTop = 0;
129131
this._fontInfo = conf.fontInfo;
@@ -143,7 +145,7 @@ export class TextAreaHandler extends ViewPart {
143145
this.textArea.setAttribute('autocapitalize', 'off');
144146
this.textArea.setAttribute('autocomplete', 'off');
145147
this.textArea.setAttribute('spellcheck', 'false');
146-
this.textArea.setAttribute('aria-label', conf.viewInfo.ariaLabel);
148+
this.textArea.setAttribute('aria-label', options.get<typeof EditorOption.ariaLabel>(EditorOptionId.ariaLabel));
147149
this.textArea.setAttribute('role', 'textbox');
148150
this.textArea.setAttribute('aria-multiline', 'true');
149151
this.textArea.setAttribute('aria-haspopup', 'false');
@@ -371,22 +373,24 @@ export class TextAreaHandler extends ViewPart {
371373

372374
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
373375
const conf = this._context.configuration.editor;
376+
const options = this._context.configuration.options;
374377

375378
if (e.fontInfo) {
376379
this._fontInfo = conf.fontInfo;
377380
}
378381
if (e.viewInfo) {
379-
this.textArea.setAttribute('aria-label', conf.viewInfo.ariaLabel);
382+
this.textArea.setAttribute('aria-label', options.get<typeof EditorOption.ariaLabel>(EditorOptionId.ariaLabel));
380383
}
381-
if (e.layoutInfo) {
382-
this._contentLeft = conf.layoutInfo.contentLeft;
383-
this._contentWidth = conf.layoutInfo.contentWidth;
384-
this._contentHeight = conf.layoutInfo.contentHeight;
384+
if (e.hasChanged(EditorOptionId.layoutInfo)) {
385+
const layoutInfo = options.get<typeof EditorOption.layoutInfo>(EditorOptionId.layoutInfo);
386+
this._contentLeft = layoutInfo.contentLeft;
387+
this._contentWidth = layoutInfo.contentWidth;
388+
this._contentHeight = layoutInfo.contentHeight;
385389
}
386390
if (e.lineHeight) {
387391
this._lineHeight = conf.lineHeight;
388392
}
389-
if (e.accessibilitySupport) {
393+
if (e.hasChanged(EditorOptionId.accessibilitySupport)) {
390394
this._accessibilitySupport = conf.accessibilitySupport;
391395
this._textAreaInput.writeScreenReaderContent('strategy changed');
392396
}
@@ -544,10 +548,13 @@ export class TextAreaHandler extends ViewPart {
544548
tac.setWidth(1);
545549
tac.setHeight(1);
546550

551+
const options = this._context.configuration.options;
552+
547553
if (this._context.configuration.editor.viewInfo.glyphMargin) {
548554
tac.setClassName('monaco-editor-background textAreaCover ' + Margin.OUTER_CLASS_NAME);
549555
} else {
550-
if (this._context.configuration.editor.viewInfo.renderLineNumbers !== RenderLineNumbersType.Off) {
556+
const renderLineNumbers = options.get<typeof EditorOption.renderLineNumbers>(EditorOptionId.renderLineNumbers);
557+
if (renderLineNumbers.renderType !== RenderLineNumbersType.Off) {
551558
tac.setClassName('monaco-editor-background textAreaCover ' + LineNumbersOverlay.CLASS_NAME);
552559
} else {
553560
tac.setClassName('monaco-editor-background textAreaCover');

src/vs/editor/browser/editorBrowser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ export interface ICodeEditor extends editorCommon.IEditor {
536536
*/
537537
getConfiguration(): editorOptions.InternalEditorOptions;
538538

539+
getOptions(): editorOptions.IComputedEditorOptions;
540+
539541
getOption<T extends editorOptions.IEditorOption<any, any, any>>(id: editorOptions.EditorOptionId): editorOptions.ComputedEditorOptionValue<T>;
540542

541543
/**

src/vs/editor/browser/view/viewImpl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'
4848
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
4949
import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
5050
import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService';
51+
import { EditorOptionId, EditorOption } from 'vs/editor/common/config/editorOptions';
5152

5253
export interface IContentWidgetData {
5354
widget: editorBrowser.IContentWidget;
@@ -281,7 +282,8 @@ export class View extends ViewEventHandler {
281282
}
282283

283284
private _setLayout(): void {
284-
const layoutInfo = this._context.configuration.editor.layoutInfo;
285+
const options = this._context.configuration.options;
286+
const layoutInfo = options.get<typeof EditorOption.layoutInfo>(EditorOptionId.layoutInfo);
285287
this.domNode.setWidth(layoutInfo.width);
286288
this.domNode.setHeight(layoutInfo.height);
287289

@@ -304,7 +306,7 @@ export class View extends ViewEventHandler {
304306
if (e.editorClassName) {
305307
this.domNode.setClassName(this.getEditorClassName());
306308
}
307-
if (e.layoutInfo) {
309+
if (e.hasChanged(EditorOptionId.layoutInfo)) {
308310
this._setLayout();
309311
}
310312
return false;

0 commit comments

Comments
 (0)