diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index d6fd59992d424..9958edfbde8ea 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -16,7 +16,6 @@ import { ISashEvent, IVerticalSashLayoutProvider, Sash } from 'vs/base/browser/u import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; import { Range, IRange } from 'vs/editor/common/core/range'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; @@ -214,7 +213,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._domElement = domElement; options = options || {}; - this._theme = options.theme || DefaultConfig.editor.theme; + this._theme = options.theme || editorOptions.EDITOR_DEFAULTS.theme; // renderSideBySide this._renderSideBySide = true; if (typeof options.renderSideBySide !== 'undefined') { @@ -899,7 +898,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE private _adjustOptionsForRightHandSide(options: editorOptions.IDiffEditorOptions): editorOptions.IEditorOptions { let result = this._adjustOptionsForSubEditor(options); - result.revealHorizontalRightPadding = DefaultConfig.editor.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH; + result.revealHorizontalRightPadding = editorOptions.EDITOR_DEFAULTS.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH; result.scrollbar.verticalHasArrows = false; result.theme = this._theme + ' modified-in-monaco-diff-editor'; return result; diff --git a/src/vs/editor/common/commonCodeEditor.ts b/src/vs/editor/common/commonCodeEditor.ts index d7a01189a10b1..63609ca09a274 100644 --- a/src/vs/editor/common/commonCodeEditor.ts +++ b/src/vs/editor/common/commonCodeEditor.ts @@ -12,7 +12,6 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IContextKey, IContextKeyServiceTarget, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { CommonEditorConfiguration } from 'vs/editor/common/config/commonEditorConfig'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; import { Cursor } from 'vs/editor/common/controller/cursor'; import { CursorColumns, IViewModelHelper, ICursors } from 'vs/editor/common/controller/cursorCommon'; import { Position, IPosition } from 'vs/editor/common/core/position'; @@ -126,9 +125,6 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo this._decorationTypeSubtypes = {}; options = options || {}; - if (typeof options.ariaLabel === 'undefined') { - options.ariaLabel = DefaultConfig.editor.ariaLabel; - } this._configuration = this._register(this._createConfiguration(options)); this._register(this._configuration.onDidChange((e) => { this._onDidChangeConfiguration.fire(e); diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 066c5ae79f3d8..9a1a5aa404c65 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -11,11 +11,13 @@ 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, DEFAULT_TRIM_AUTO_WHITESPACE } from 'vs/editor/common/config/defaultConfig'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; import * as editorOptions from 'vs/editor/common/config/editorOptions'; +import EDITOR_DEFAULTS = editorOptions.EDITOR_DEFAULTS; +import EDITOR_FONT_DEFAULTS = editorOptions.EDITOR_FONT_DEFAULTS; +import EDITOR_MODEL_DEFAULTS = editorOptions.EDITOR_MODEL_DEFAULTS; /** * Control what pressing Tab does. @@ -74,8 +76,8 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed constructor(options: editorOptions.IEditorOptions, elementSizeObserver: IElementSizeObserver = null) { super(); - this._rawOptions = options; - this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, editorOptions.DEFAULTS); + this._rawOptions = options || {}; + this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS); this._elementSizeObserver = elementSizeObserver; this._isDominatedByLongLines = false; @@ -126,7 +128,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed public updateOptions(newOptions: editorOptions.IEditorOptions): void { this._rawOptions = objects.mixin(this._rawOptions, newOptions || {}); - this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, editorOptions.DEFAULTS); + this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS); this._recomputeOptions(); } @@ -178,29 +180,29 @@ const editorConfiguration: IConfigurationNode = { 'properties': { 'editor.fontFamily': { 'type': 'string', - 'default': DefaultConfig.editor.fontFamily, + 'default': EDITOR_FONT_DEFAULTS.fontFamily, 'description': nls.localize('fontFamily', "Controls the font family.") }, 'editor.fontWeight': { 'type': 'string', 'enum': ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'], - 'default': DefaultConfig.editor.fontWeight, + 'default': EDITOR_FONT_DEFAULTS.fontWeight, 'description': nls.localize('fontWeight', "Controls the font weight.") }, 'editor.fontSize': { 'type': 'number', - 'default': DefaultConfig.editor.fontSize, + 'default': EDITOR_FONT_DEFAULTS.fontSize, 'description': nls.localize('fontSize', "Controls the font size in pixels.") }, 'editor.lineHeight': { 'type': 'number', - 'default': DefaultConfig.editor.lineHeight, + 'default': EDITOR_FONT_DEFAULTS.lineHeight, 'description': nls.localize('lineHeight', "Controls the line height. Use 0 to compute the lineHeight from the fontSize.") }, 'editor.lineNumbers': { 'type': 'string', 'enum': ['off', 'on', 'relative'], - 'default': DefaultConfig.editor.lineNumbers, + 'default': 'on', 'description': nls.localize('lineNumbers', "Controls the display of line numbers. Possible values are 'on', 'off', and 'relative'. 'relative' shows the line count from the current cursor position.") }, 'editor.rulers': { @@ -208,55 +210,55 @@ const editorConfiguration: IConfigurationNode = { 'items': { 'type': 'number' }, - 'default': DefaultConfig.editor.rulers, + 'default': EDITOR_DEFAULTS.rulers, 'description': nls.localize('rulers', "Columns at which to show vertical rulers") }, 'editor.wordSeparators': { 'type': 'string', - 'default': DefaultConfig.editor.wordSeparators, + 'default': EDITOR_DEFAULTS.wordSeparators, 'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations") }, 'editor.tabSize': { 'type': 'number', - 'default': DEFAULT_INDENTATION.tabSize, + 'default': EDITOR_MODEL_DEFAULTS.tabSize, 'minimum': 1, 'description': nls.localize('tabSize', "The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on."), 'errorMessage': nls.localize('tabSize.errorMessage', "Expected 'number'. Note that the value \"auto\" has been replaced by the `editor.detectIndentation` setting.") }, 'editor.insertSpaces': { 'type': 'boolean', - 'default': DEFAULT_INDENTATION.insertSpaces, + 'default': EDITOR_MODEL_DEFAULTS.insertSpaces, 'description': nls.localize('insertSpaces', "Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on."), 'errorMessage': nls.localize('insertSpaces.errorMessage', "Expected 'boolean'. Note that the value \"auto\" has been replaced by the `editor.detectIndentation` setting.") }, 'editor.detectIndentation': { 'type': 'boolean', - 'default': DEFAULT_INDENTATION.detectIndentation, + 'default': EDITOR_MODEL_DEFAULTS.detectIndentation, 'description': nls.localize('detectIndentation', "When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.") }, 'editor.roundedSelection': { 'type': 'boolean', - 'default': DefaultConfig.editor.roundedSelection, + 'default': EDITOR_DEFAULTS.roundedSelection, 'description': nls.localize('roundedSelection', "Controls if selections have rounded corners") }, 'editor.scrollBeyondLastLine': { 'type': 'boolean', - 'default': DefaultConfig.editor.scrollBeyondLastLine, + 'default': EDITOR_DEFAULTS.scrollBeyondLastLine, 'description': nls.localize('scrollBeyondLastLine', "Controls if the editor will scroll beyond the last line") }, 'editor.minimap.enabled': { 'type': 'boolean', - 'default': DefaultConfig.editor.minimap.enabled, + 'default': EDITOR_DEFAULTS.minimap.enabled, 'description': nls.localize('minimap.enabled', "Controls if the minimap is shown") }, 'editor.minimap.renderCharacters': { 'type': 'boolean', - 'default': DefaultConfig.editor.minimap.renderCharacters, + 'default': EDITOR_DEFAULTS.minimap.renderCharacters, 'description': nls.localize('minimap.renderCharacters', "Render the actual characters on a line (as opposed to color blocks)") }, 'editor.minimap.maxColumn': { 'type': 'number', - 'default': DefaultConfig.editor.minimap.maxColumn, + 'default': EDITOR_DEFAULTS.minimap.maxColumn, 'description': nls.localize('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns") }, 'editor.wordWrap': { @@ -279,7 +281,7 @@ const editorConfiguration: IConfigurationNode = { ] }, "Lines will wrap at the minimum of viewport and `editor.wordWrapColumn`."), ], - 'default': DefaultConfig.editor.wordWrap, + 'default': EDITOR_DEFAULTS.wordWrap, 'description': nls.localize({ key: 'wordWrap', comment: [ @@ -290,7 +292,7 @@ const editorConfiguration: IConfigurationNode = { }, 'editor.wordWrapColumn': { 'type': 'integer', - 'default': DefaultConfig.editor.wordWrapColumn, + 'default': EDITOR_DEFAULTS.wordWrapColumn, 'minimum': 1, 'description': nls.localize({ key: 'wordWrapColumn', @@ -303,12 +305,12 @@ const editorConfiguration: IConfigurationNode = { 'editor.wrappingIndent': { 'type': 'string', 'enum': ['none', 'same', 'indent'], - 'default': DefaultConfig.editor.wrappingIndent, + 'default': 'same', 'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.") }, 'editor.mouseWheelScrollSensitivity': { 'type': 'number', - 'default': DefaultConfig.editor.mouseWheelScrollSensitivity, + 'default': EDITOR_DEFAULTS.mouseWheelScrollSensitivity, 'description': nls.localize('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events") }, 'editor.quickSuggestions': { @@ -337,64 +339,64 @@ const editorConfiguration: IConfigurationNode = { } } ], - 'default': DefaultConfig.editor.quickSuggestions, + 'default': EDITOR_DEFAULTS.quickSuggestions, 'description': nls.localize('quickSuggestions', "Controls if suggestions should automatically show up while typing") }, 'editor.quickSuggestionsDelay': { 'type': 'integer', - 'default': DefaultConfig.editor.quickSuggestionsDelay, + 'default': EDITOR_DEFAULTS.quickSuggestionsDelay, 'minimum': 0, 'description': nls.localize('quickSuggestionsDelay', "Controls the delay in ms after which quick suggestions will show up") }, 'editor.parameterHints': { 'type': 'boolean', - 'default': DefaultConfig.editor.parameterHints, + 'default': EDITOR_DEFAULTS.parameterHints, 'description': nls.localize('parameterHints', "Enables parameter hints") }, 'editor.autoClosingBrackets': { 'type': 'boolean', - 'default': DefaultConfig.editor.autoClosingBrackets, + 'default': EDITOR_DEFAULTS.autoClosingBrackets, 'description': nls.localize('autoClosingBrackets', "Controls if the editor should automatically close brackets after opening them") }, 'editor.formatOnType': { 'type': 'boolean', - 'default': DefaultConfig.editor.formatOnType, + 'default': EDITOR_DEFAULTS.formatOnType, 'description': nls.localize('formatOnType', "Controls if the editor should automatically format the line after typing") }, 'editor.formatOnPaste': { 'type': 'boolean', - 'default': DefaultConfig.editor.formatOnPaste, + 'default': EDITOR_DEFAULTS.formatOnPaste, 'description': nls.localize('formatOnPaste', "Controls if the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.") }, 'editor.suggestOnTriggerCharacters': { 'type': 'boolean', - 'default': DefaultConfig.editor.suggestOnTriggerCharacters, + 'default': EDITOR_DEFAULTS.suggestOnTriggerCharacters, 'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters") }, 'editor.acceptSuggestionOnEnter': { 'type': 'boolean', - 'default': DefaultConfig.editor.acceptSuggestionOnEnter, + 'default': EDITOR_DEFAULTS.acceptSuggestionOnEnter, 'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.") }, 'editor.acceptSuggestionOnCommitCharacter': { 'type': 'boolean', - 'default': DefaultConfig.editor.acceptSuggestionOnCommitCharacter, + 'default': EDITOR_DEFAULTS.acceptSuggestionOnCommitCharacter, 'description': nls.localize('acceptSuggestionOnCommitCharacter', "Controls if suggestions should be accepted on commit characters. For instance in JavaScript the semi-colon (';') can be a commit character that accepts a suggestion and types that character.") }, 'editor.snippetSuggestions': { 'type': 'string', 'enum': ['top', 'bottom', 'inline', 'none'], - 'default': DefaultConfig.editor.snippetSuggestions, + 'default': EDITOR_DEFAULTS.snippetSuggestions, 'description': nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.") }, 'editor.emptySelectionClipboard': { 'type': 'boolean', - 'default': DefaultConfig.editor.emptySelectionClipboard, + 'default': EDITOR_DEFAULTS.emptySelectionClipboard, 'description': nls.localize('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.") }, 'editor.wordBasedSuggestions': { 'type': 'boolean', - 'default': DefaultConfig.editor.wordBasedSuggestions, + 'default': EDITOR_DEFAULTS.wordBasedSuggestions, 'description': nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.") }, 'editor.suggestFontSize': { @@ -411,12 +413,12 @@ const editorConfiguration: IConfigurationNode = { }, 'editor.selectionHighlight': { 'type': 'boolean', - 'default': DefaultConfig.editor.selectionHighlight, + 'default': EDITOR_DEFAULTS.selectionHighlight, 'description': nls.localize('selectionHighlight', "Controls whether the editor should highlight similar matches to the selection") }, 'editor.occurrencesHighlight': { 'type': 'boolean', - 'default': DefaultConfig.editor.occurrencesHighlight, + 'default': EDITOR_DEFAULTS.occurrencesHighlight, 'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences") }, 'editor.overviewRulerLanes': { @@ -426,91 +428,91 @@ const editorConfiguration: IConfigurationNode = { }, 'editor.overviewRulerBorder': { 'type': 'boolean', - 'default': DefaultConfig.editor.overviewRulerBorder, + 'default': EDITOR_DEFAULTS.overviewRulerBorder, 'description': nls.localize('overviewRulerBorder', "Controls if a border should be drawn around the overview ruler.") }, 'editor.cursorBlinking': { 'type': 'string', 'enum': ['blink', 'smooth', 'phase', 'expand', 'solid'], - 'default': DefaultConfig.editor.cursorBlinking, + 'default': EDITOR_DEFAULTS.cursorBlinking, 'description': nls.localize('cursorBlinking', "Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'") }, 'editor.mouseWheelZoom': { 'type': 'boolean', - 'default': DefaultConfig.editor.mouseWheelZoom, + 'default': EDITOR_DEFAULTS.mouseWheelZoom, 'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl") }, 'editor.cursorStyle': { 'type': 'string', 'enum': ['block', 'block-outline', 'line', 'line-thin', 'underline', 'underline-thin'], - 'default': DefaultConfig.editor.cursorStyle, + 'default': EDITOR_DEFAULTS.cursorStyle, 'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'") }, 'editor.fontLigatures': { 'type': 'boolean', - 'default': DefaultConfig.editor.fontLigatures, + 'default': EDITOR_DEFAULTS.fontLigatures, 'description': nls.localize('fontLigatures', "Enables font ligatures") }, 'editor.hideCursorInOverviewRuler': { 'type': 'boolean', - 'default': DefaultConfig.editor.hideCursorInOverviewRuler, + 'default': EDITOR_DEFAULTS.hideCursorInOverviewRuler, 'description': nls.localize('hideCursorInOverviewRuler', "Controls if the cursor should be hidden in the overview ruler.") }, 'editor.renderWhitespace': { 'type': 'string', 'enum': ['none', 'boundary', 'all'], - default: DefaultConfig.editor.renderWhitespace, + default: EDITOR_DEFAULTS.renderWhitespace, description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters, possibilities are 'none', 'boundary', and 'all'. The 'boundary' option does not render single spaces between words.") }, 'editor.renderControlCharacters': { 'type': 'boolean', - default: DefaultConfig.editor.renderControlCharacters, + default: EDITOR_DEFAULTS.renderControlCharacters, description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters") }, 'editor.renderIndentGuides': { 'type': 'boolean', - default: DefaultConfig.editor.renderIndentGuides, + default: EDITOR_DEFAULTS.renderIndentGuides, description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides") }, 'editor.renderLineHighlight': { 'type': 'string', 'enum': ['none', 'gutter', 'line', 'all'], - default: DefaultConfig.editor.renderLineHighlight, + default: EDITOR_DEFAULTS.renderLineHighlight, description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight, possibilities are 'none', 'gutter', 'line', and 'all'.") }, 'editor.codeLens': { 'type': 'boolean', - 'default': DefaultConfig.editor.codeLens, + 'default': EDITOR_DEFAULTS.codeLens, 'description': nls.localize('codeLens', "Controls if the editor shows code lenses") }, 'editor.folding': { 'type': 'boolean', - 'default': DefaultConfig.editor.folding, + 'default': EDITOR_DEFAULTS.folding, 'description': nls.localize('folding', "Controls whether the editor has code folding enabled") }, 'editor.hideFoldIcons': { 'type': 'boolean', - 'default': DefaultConfig.editor.hideFoldIcons, + 'default': EDITOR_DEFAULTS.hideFoldIcons, 'description': nls.localize('hideFoldIcons', "Controls whether the fold icons on the gutter are automatically hidden.") }, 'editor.matchBrackets': { 'type': 'boolean', - 'default': DefaultConfig.editor.matchBrackets, + 'default': EDITOR_DEFAULTS.matchBrackets, 'description': nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.") }, 'editor.glyphMargin': { 'type': 'boolean', - 'default': DefaultConfig.editor.glyphMargin, + 'default': EDITOR_DEFAULTS.glyphMargin, 'description': nls.localize('glyphMargin', "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.") }, 'editor.useTabStops': { 'type': 'boolean', - 'default': DefaultConfig.editor.useTabStops, + 'default': EDITOR_DEFAULTS.useTabStops, 'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops") }, 'editor.trimAutoWhitespace': { 'type': 'boolean', - 'default': DEFAULT_TRIM_AUTO_WHITESPACE, + 'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace, 'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace") }, 'editor.stablePeek': { @@ -520,7 +522,7 @@ const editorConfiguration: IConfigurationNode = { }, 'editor.dragAndDrop': { 'type': 'boolean', - 'default': DefaultConfig.editor.dragAndDrop, + 'default': EDITOR_DEFAULTS.dragAndDrop, 'description': nls.localize('dragAndDrop', "Controls if the editor should allow to move selections via drag and drop.") }, 'diffEditor.renderSideBySide': { @@ -544,7 +546,7 @@ const editorConfiguration: IConfigurationNode = { if (platform.isLinux) { editorConfiguration['properties']['editor.selectionClipboard'] = { 'type': 'boolean', - 'default': DefaultConfig.editor.selectionClipboard, + 'default': EDITOR_DEFAULTS.selectionClipboard, 'description': nls.localize('selectionClipboard', "Controls if the Linux primary clipboard should be supported.") }; } diff --git a/src/vs/editor/common/config/defaultConfig.ts b/src/vs/editor/common/config/defaultConfig.ts deleted file mode 100644 index 0662f2bf9e1e0..0000000000000 --- a/src/vs/editor/common/config/defaultConfig.ts +++ /dev/null @@ -1,130 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -'use strict'; - -import * as nls from 'vs/nls'; -import * as platform from 'vs/base/common/platform'; -import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper'; -import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; - -export interface IConfiguration { - editor: IEditorOptions; -} - -export const DEFAULT_INDENTATION = { - tabSize: 4, - 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'; -const DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'Courier New\', monospace, \'Droid Sans Fallback\''; - -/** - * Determined from empirical observations. - */ -export const GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35; - -class ConfigClass implements IConfiguration { - - public editor: IEditorOptions; - - constructor() { - this.editor = { - experimentalScreenReader: true, - rulers: [], - wordSeparators: USUAL_WORD_SEPARATORS, - selectionClipboard: true, - ariaLabel: nls.localize('editorViewAccessibleLabel', "Editor content"), - lineNumbers: 'on', - selectOnLineNumbers: true, - lineNumbersMinChars: 5, - glyphMargin: true, - lineDecorationsWidth: 10, - revealHorizontalRightPadding: 30, - roundedSelection: true, - theme: 'vs', - readOnly: false, - scrollbar: { - verticalScrollbarSize: 14, - horizontal: 'auto', - useShadows: true, - verticalHasArrows: false, - horizontalHasArrows: false - }, - minimap: { - enabled: false, - renderCharacters: true, - maxColumn: 120 - }, - fixedOverflowWidgets: false, - overviewRulerLanes: 2, - overviewRulerBorder: true, - cursorBlinking: 'blink', - mouseWheelZoom: false, - cursorStyle: 'line', - mouseStyle: 'text', - fontLigatures: false, - disableTranslate3d: false, - disableMonospaceOptimizations: false, - hideCursorInOverviewRuler: false, - scrollBeyondLastLine: true, - automaticLayout: false, - wordWrap: 'off', - wordWrapColumn: 80, - wordWrapMinified: true, - wrappingIndent: 'same', - wordWrapBreakBeforeCharacters: '([{‘“〈《「『【〔([{「£¥$£¥++', - wordWrapBreakAfterCharacters: ' \t})]?|&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー’”〉》」』】〕)]}」', - wordWrapBreakObtrusiveCharacters: '.', - - // Features - hover: true, - contextmenu: true, - mouseWheelScrollSensitivity: 1, - quickSuggestions: { other: true, comments: false, strings: false }, - quickSuggestionsDelay: 10, - parameterHints: true, - iconsInSuggestions: true, - autoClosingBrackets: true, - formatOnType: false, - formatOnPaste: false, - suggestOnTriggerCharacters: true, - acceptSuggestionOnEnter: true, - acceptSuggestionOnCommitCharacter: true, - snippetSuggestions: 'inline', - emptySelectionClipboard: true, - wordBasedSuggestions: true, - suggestFontSize: 0, - suggestLineHeight: 0, - selectionHighlight: true, - occurrencesHighlight: true, - codeLens: true, - referenceInfos: true, - folding: true, - hideFoldIcons: true, - renderWhitespace: 'none', - renderControlCharacters: false, - renderIndentGuides: false, - renderLineHighlight: 'line', - useTabStops: true, - matchBrackets: true, - dragAndDrop: false, - - fontFamily: ( - platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY) - ), - fontWeight: 'normal', - fontSize: ( - platform.isMacintosh ? 12 : 14 - ), - lineHeight: 0 - }; - } -} - -export const DefaultConfig: IConfiguration = new ConfigClass(); diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 4c3c216e88f60..cd983f9dcf4e0 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -4,10 +4,12 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import * as nls from 'vs/nls'; +import * as platform from 'vs/base/common/platform'; import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { FontInfo } from 'vs/editor/common/config/fontInfo'; import { Constants } from 'vs/editor/common/core/uint'; -import { DefaultConfig } from "vs/editor/common/config/defaultConfig"; +import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper'; /** * Configuration options for editor scrollbars @@ -1730,99 +1732,6 @@ function _scrollbarVisibilityFromString(visibility: string, defaultValue: Scroll } } -/** - * @internal - */ -export const DEFAULTS: IValidatedEditorOptions = { - inDiffEditor: false, - experimentalScreenReader: DefaultConfig.editor.experimentalScreenReader, - ariaLabel: DefaultConfig.editor.ariaLabel, - rulers: DefaultConfig.editor.rulers, - wordSeparators: DefaultConfig.editor.wordSeparators, - selectionClipboard: DefaultConfig.editor.selectionClipboard, - renderLineNumbers: true, - renderCustomLineNumbers: null, - renderRelativeLineNumbers: false, - selectOnLineNumbers: DefaultConfig.editor.selectOnLineNumbers, - lineNumbersMinChars: DefaultConfig.editor.lineNumbersMinChars, - glyphMargin: DefaultConfig.editor.glyphMargin, - lineDecorationsWidth: DefaultConfig.editor.lineDecorationsWidth, - revealHorizontalRightPadding: DefaultConfig.editor.revealHorizontalRightPadding, - roundedSelection: DefaultConfig.editor.roundedSelection, - theme: DefaultConfig.editor.theme, - readOnly: DefaultConfig.editor.readOnly, - scrollbar: { - vertical: ScrollbarVisibility.Auto, - horizontal: ScrollbarVisibility.Auto, - arrowSize: 11, - useShadows: true, - verticalHasArrows: false, - horizontalHasArrows: false, - horizontalScrollbarSize: 10, - horizontalSliderSize: 10, - verticalScrollbarSize: 14, - verticalSliderSize: 14, - handleMouseWheel: true - }, - minimap: { - enabled: false, - renderCharacters: true, - maxColumn: 120 - }, - fixedOverflowWidgets: DefaultConfig.editor.fixedOverflowWidgets, - overviewRulerLanes: DefaultConfig.editor.overviewRulerLanes, - overviewRulerBorder: DefaultConfig.editor.overviewRulerBorder, - cursorBlinking: TextEditorCursorBlinkingStyle.Blink, - mouseWheelZoom: DefaultConfig.editor.mouseWheelZoom, - mouseStyle: DefaultConfig.editor.mouseStyle, - cursorStyle: TextEditorCursorStyle.Line, - fontLigatures: DefaultConfig.editor.fontLigatures, - disableTranslate3d: DefaultConfig.editor.disableTranslate3d, - disableMonospaceOptimizations: DefaultConfig.editor.disableMonospaceOptimizations, - hideCursorInOverviewRuler: DefaultConfig.editor.hideCursorInOverviewRuler, - scrollBeyondLastLine: DefaultConfig.editor.scrollBeyondLastLine, - automaticLayout: DefaultConfig.editor.automaticLayout, - wordWrap: DefaultConfig.editor.wordWrap, - wordWrapColumn: DefaultConfig.editor.wordWrapColumn, - wordWrapMinified: DefaultConfig.editor.wordWrapMinified, - wrappingIndent: WrappingIndent.Same, - wordWrapBreakBeforeCharacters: DefaultConfig.editor.wordWrapBreakBeforeCharacters, - wordWrapBreakAfterCharacters: DefaultConfig.editor.wordWrapBreakAfterCharacters, - wordWrapBreakObtrusiveCharacters: DefaultConfig.editor.wordWrapBreakObtrusiveCharacters, - stopRenderingLineAfter: 10000, - hover: DefaultConfig.editor.hover, - contextmenu: DefaultConfig.editor.contextmenu, - mouseWheelScrollSensitivity: DefaultConfig.editor.mouseWheelScrollSensitivity, - quickSuggestions: DefaultConfig.editor.quickSuggestions, - quickSuggestionsDelay: DefaultConfig.editor.quickSuggestionsDelay, - parameterHints: DefaultConfig.editor.parameterHints, - iconsInSuggestions: DefaultConfig.editor.iconsInSuggestions, - autoClosingBrackets: DefaultConfig.editor.autoClosingBrackets, - formatOnType: DefaultConfig.editor.formatOnType, - formatOnPaste: DefaultConfig.editor.formatOnPaste, - dragAndDrop: DefaultConfig.editor.dragAndDrop, - suggestOnTriggerCharacters: DefaultConfig.editor.suggestOnTriggerCharacters, - acceptSuggestionOnEnter: DefaultConfig.editor.acceptSuggestionOnEnter, - acceptSuggestionOnCommitCharacter: DefaultConfig.editor.acceptSuggestionOnCommitCharacter, - snippetSuggestions: DefaultConfig.editor.snippetSuggestions, - emptySelectionClipboard: DefaultConfig.editor.emptySelectionClipboard, - wordBasedSuggestions: DefaultConfig.editor.wordBasedSuggestions, - suggestFontSize: DefaultConfig.editor.suggestFontSize, - suggestLineHeight: DefaultConfig.editor.suggestLineHeight, - selectionHighlight: DefaultConfig.editor.selectionHighlight, - occurrencesHighlight: DefaultConfig.editor.occurrencesHighlight, - codeLens: DefaultConfig.editor.codeLens, - referenceInfos: DefaultConfig.editor.referenceInfos, - folding: DefaultConfig.editor.folding, - hideFoldIcons: DefaultConfig.editor.hideFoldIcons, - matchBrackets: DefaultConfig.editor.matchBrackets, - renderWhitespace: DefaultConfig.editor.renderWhitespace, - renderControlCharacters: DefaultConfig.editor.renderControlCharacters, - renderIndentGuides: DefaultConfig.editor.renderIndentGuides, - renderLineHighlight: DefaultConfig.editor.renderLineHighlight, - useTabStops: DefaultConfig.editor.useTabStops, -}; - /** * @internal */ @@ -2371,3 +2280,124 @@ export class EditorLayoutProvider { }); } } + +const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace'; +const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace'; +const DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'Courier New\', monospace, \'Droid Sans Fallback\''; + +/** + * @internal + */ +export const EDITOR_FONT_DEFAULTS = { + fontFamily: ( + platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY) + ), + fontWeight: 'normal', + fontSize: ( + platform.isMacintosh ? 12 : 14 + ), + lineHeight: 0, +}; + +/** + * @internal + */ +export const EDITOR_MODEL_DEFAULTS = { + tabSize: 4, + insertSpaces: true, + detectIndentation: true, + trimAutoWhitespace: true +}; + +/** + * @internal + */ +export const EDITOR_DEFAULTS: IValidatedEditorOptions = { + inDiffEditor: false, + experimentalScreenReader: true, + ariaLabel: nls.localize('editorViewAccessibleLabel', "Editor content"), + rulers: [], + wordSeparators: USUAL_WORD_SEPARATORS, + selectionClipboard: true, + renderLineNumbers: true, + renderCustomLineNumbers: null, + renderRelativeLineNumbers: false, + selectOnLineNumbers: true, + lineNumbersMinChars: 5, + glyphMargin: true, + lineDecorationsWidth: 10, + revealHorizontalRightPadding: 30, + roundedSelection: true, + theme: 'vs', + readOnly: false, + scrollbar: { + vertical: ScrollbarVisibility.Auto, + horizontal: ScrollbarVisibility.Auto, + arrowSize: 11, + useShadows: true, + verticalHasArrows: false, + horizontalHasArrows: false, + horizontalScrollbarSize: 10, + horizontalSliderSize: 10, + verticalScrollbarSize: 14, + verticalSliderSize: 14, + handleMouseWheel: true + }, + minimap: { + enabled: false, + renderCharacters: true, + maxColumn: 120 + }, + fixedOverflowWidgets: false, + overviewRulerLanes: 2, + overviewRulerBorder: true, + cursorBlinking: TextEditorCursorBlinkingStyle.Blink, + mouseWheelZoom: false, + mouseStyle: 'text', + cursorStyle: TextEditorCursorStyle.Line, + fontLigatures: false, + disableTranslate3d: false, + disableMonospaceOptimizations: false, + hideCursorInOverviewRuler: false, + scrollBeyondLastLine: true, + automaticLayout: false, + wordWrap: 'off', + wordWrapColumn: 80, + wordWrapMinified: true, + wrappingIndent: WrappingIndent.Same, + wordWrapBreakBeforeCharacters: '([{‘“〈《「『【〔([{「£¥$£¥++', + wordWrapBreakAfterCharacters: ' \t})]?|&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー’”〉》」』】〕)]}」', + wordWrapBreakObtrusiveCharacters: '.', + stopRenderingLineAfter: 10000, + hover: true, + contextmenu: true, + mouseWheelScrollSensitivity: 1, + quickSuggestions: { other: true, comments: false, strings: false }, + quickSuggestionsDelay: 10, + parameterHints: true, + iconsInSuggestions: true, + autoClosingBrackets: true, + formatOnType: false, + formatOnPaste: false, + dragAndDrop: false, + suggestOnTriggerCharacters: true, + acceptSuggestionOnEnter: true, + acceptSuggestionOnCommitCharacter: true, + snippetSuggestions: 'inline', + emptySelectionClipboard: true, + wordBasedSuggestions: true, + suggestFontSize: 0, + suggestLineHeight: 0, + selectionHighlight: true, + occurrencesHighlight: true, + codeLens: true, + referenceInfos: true, + folding: true, + hideFoldIcons: true, + matchBrackets: true, + renderWhitespace: 'none', + renderControlCharacters: false, + renderIndentGuides: false, + renderLineHighlight: 'line', + useTabStops: true, +}; diff --git a/src/vs/editor/common/config/fontInfo.ts b/src/vs/editor/common/config/fontInfo.ts index a7d1b36d47fca..947c51bf1b996 100644 --- a/src/vs/editor/common/config/fontInfo.ts +++ b/src/vs/editor/common/config/fontInfo.ts @@ -4,8 +4,15 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { DefaultConfig, GOLDEN_LINE_HEIGHT_RATIO } from 'vs/editor/common/config/defaultConfig'; +import * as platform from 'vs/base/common/platform'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; +import { EDITOR_FONT_DEFAULTS } from "vs/editor/common/config/editorOptions"; + +/** + * Determined from empirical observations. + * @internal + */ +const GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35; function safeParseFloat(n: number | string, defaultValue: number): number { if (typeof n === 'number') { @@ -59,13 +66,13 @@ export class BareFontInfo { lineHeight?: number | string; }, zoomLevel: number): BareFontInfo { - let fontFamily = _string(opts.fontFamily, DefaultConfig.editor.fontFamily); - let fontWeight = _string(opts.fontWeight, DefaultConfig.editor.fontWeight); + let fontFamily = _string(opts.fontFamily, EDITOR_FONT_DEFAULTS.fontFamily); + let fontWeight = _string(opts.fontWeight, EDITOR_FONT_DEFAULTS.fontWeight); - let fontSize = safeParseFloat(opts.fontSize, DefaultConfig.editor.fontSize); + let fontSize = safeParseFloat(opts.fontSize, EDITOR_FONT_DEFAULTS.fontSize); fontSize = clamp(fontSize, 0, 100); if (fontSize === 0) { - fontSize = DefaultConfig.editor.fontSize; + fontSize = EDITOR_FONT_DEFAULTS.fontSize; } let lineHeight = safeParseInt(opts.lineHeight, 0); diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index 3bc7ddc2490cb..a84d56ad65b17 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -11,7 +11,7 @@ import { Range, IRange } 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, DEFAULT_TRIM_AUTO_WHITESPACE } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_MODEL_DEFAULTS } from "vs/editor/common/config/editorOptions"; import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer'; import { IndentRange, computeRanges } from 'vs/editor/common/model/indentRanges'; import { TextModelSearch, SearchParams } from 'vs/editor/common/model/textModelSearch'; @@ -32,11 +32,11 @@ export class TextModel implements editorCommon.ITextModel { private static MODEL_TOKENIZATION_LIMIT = 20 * 1024 * 1024; // 20 MB public static DEFAULT_CREATION_OPTIONS: editorCommon.ITextModelCreationOptions = { - tabSize: DEFAULT_INDENTATION.tabSize, - insertSpaces: DEFAULT_INDENTATION.insertSpaces, + tabSize: EDITOR_MODEL_DEFAULTS.tabSize, + insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces, detectIndentation: false, defaultEOL: editorCommon.DefaultEndOfLine.LF, - trimAutoWhitespace: DEFAULT_TRIM_AUTO_WHITESPACE, + trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace, }; public static createFromString(text: string, options: editorCommon.ITextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS): TextModel { diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 9bbb35747dc5b..ad1b9ba8fc6f5 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -21,7 +21,7 @@ import { IMode, LanguageIdentifier } from 'vs/editor/common/modes'; import { IModelService } from 'vs/editor/common/services/modelService'; import * as platform from 'vs/base/common/platform'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_MODEL_DEFAULTS } from "vs/editor/common/config/editorOptions"; import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegistry'; import { IRawTextSource, TextSource, RawTextSource } from 'vs/editor/common/model/textSource'; import * as textModelEvents from 'vs/editor/common/model/textModelEvents'; @@ -223,7 +223,7 @@ export class ModelServiceImpl implements IModelService { } private static _readModelOptions(config: IRawConfig): editorCommon.ITextModelCreationOptions { - let tabSize = DEFAULT_INDENTATION.tabSize; + let tabSize = EDITOR_MODEL_DEFAULTS.tabSize; if (config.editor && typeof config.editor.tabSize !== 'undefined') { let parsedTabSize = parseInt(config.editor.tabSize, 10); if (!isNaN(parsedTabSize)) { @@ -231,7 +231,7 @@ export class ModelServiceImpl implements IModelService { } } - let insertSpaces = DEFAULT_INDENTATION.insertSpaces; + let insertSpaces = EDITOR_MODEL_DEFAULTS.insertSpaces; if (config.editor && typeof config.editor.insertSpaces !== 'undefined') { insertSpaces = (config.editor.insertSpaces === 'false' ? false : Boolean(config.editor.insertSpaces)); } @@ -244,12 +244,12 @@ export class ModelServiceImpl implements IModelService { newDefaultEOL = editorCommon.DefaultEndOfLine.LF; } - let trimAutoWhitespace = DEFAULT_TRIM_AUTO_WHITESPACE; + let trimAutoWhitespace = EDITOR_MODEL_DEFAULTS.trimAutoWhitespace; if (config.editor && typeof config.editor.trimAutoWhitespace !== 'undefined') { trimAutoWhitespace = (config.editor.trimAutoWhitespace === 'false' ? false : Boolean(config.editor.trimAutoWhitespace)); } - let detectIndentation = DEFAULT_INDENTATION.detectIndentation; + let detectIndentation = EDITOR_MODEL_DEFAULTS.detectIndentation; if (config.editor && typeof config.editor.detectIndentation !== 'undefined') { detectIndentation = (config.editor.detectIndentation === 'false' ? false : Boolean(config.editor.detectIndentation)); } diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts index 35a4b56d09691..19d31c7d4053d 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts @@ -30,7 +30,6 @@ import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; import { Range, IRange } from 'vs/editor/common/core/range'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { Model } from 'vs/editor/common/model/model'; @@ -591,7 +590,13 @@ export class ReferenceWidget extends PeekViewWidget { var options: IEditorOptions = { scrollBeyondLastLine: false, - scrollbar: DefaultConfig.editor.scrollbar, + scrollbar: { + verticalScrollbarSize: 14, + horizontal: 'auto', + useShadows: true, + verticalHasArrows: false, + horizontalHasArrows: false + }, overviewRulerLanes: 2, fixedOverflowWidgets: true, minimap: { diff --git a/src/vs/editor/contrib/suggest/browser/suggest.ts b/src/vs/editor/contrib/suggest/browser/suggest.ts index 6ca956304cf31..1e79d2e180b03 100644 --- a/src/vs/editor/contrib/suggest/browser/suggest.ts +++ b/src/vs/editor/contrib/suggest/browser/suggest.ts @@ -15,14 +15,14 @@ import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import { ISuggestResult, ISuggestSupport, ISuggestion, SuggestRegistry } from 'vs/editor/common/modes'; import { Position, IPosition } from 'vs/editor/common/core/position'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_DEFAULTS } from "vs/editor/common/config/editorOptions"; export const Context = { Visible: new RawContextKey('suggestWidgetVisible', false), MultipleSuggestions: new RawContextKey('suggestWidgetMultipleSuggestions', false), MakesTextEdit: new RawContextKey('suggestionMakesTextEdit', true), AcceptOnKey: new RawContextKey('suggestionSupportsAcceptOnKey', true), - AcceptSuggestionsOnEnter: new RawContextKey('acceptSuggestionOnEnter', DefaultConfig.editor.acceptSuggestionOnEnter) + AcceptSuggestionsOnEnter: new RawContextKey('acceptSuggestionOnEnter', EDITOR_DEFAULTS.acceptSuggestionOnEnter) }; export interface ISuggestionItem { diff --git a/src/vs/editor/editor.main.ts b/src/vs/editor/editor.main.ts index a0cf669373aa3..a06d77657e258 100644 --- a/src/vs/editor/editor.main.ts +++ b/src/vs/editor/editor.main.ts @@ -14,12 +14,12 @@ import 'vs/editor/contrib/inspectTokens/browser/inspectTokens'; import { createMonacoBaseAPI } from 'vs/editor/common/standalone/standaloneBase'; import { createMonacoEditorAPI } from 'vs/editor/browser/standalone/standaloneEditor'; import { createMonacoLanguagesAPI } from 'vs/editor/browser/standalone/standaloneLanguages'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_DEFAULTS, WrappingIndent } from "vs/editor/common/config/editorOptions"; // Set defaults for standalone editor -DefaultConfig.editor.wrappingIndent = 'none'; -DefaultConfig.editor.folding = false; -DefaultConfig.editor.glyphMargin = false; +EDITOR_DEFAULTS.wrappingIndent = WrappingIndent.None; +EDITOR_DEFAULTS.folding = false; +EDITOR_DEFAULTS.glyphMargin = false; var global: any = self; global.monaco = createMonacoBaseAPI(); diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index 9773fc9163ea1..e0bf3b5262935 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -11,14 +11,13 @@ import { ICommonCodeEditor, IEditorContribution, IModel } from 'vs/editor/common import { editorAction, ServicesAccessor, EditorAction, commonEditorContribution } from 'vs/editor/common/editorCommonExtensions'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { Disposable } from 'vs/base/common/lifecycle'; import { IMessageService } from 'vs/platform/message/common/message'; import Severity from 'vs/base/common/severity'; import URI from 'vs/base/common/uri'; -import { InternalEditorOptions } from 'vs/editor/common/config/editorOptions'; +import { InternalEditorOptions, EDITOR_DEFAULTS } from 'vs/editor/common/config/editorOptions'; const transientWordWrapState = 'transientWordWrapState'; const isWordWrapMinifiedKey = 'isWordWrapMinified'; @@ -67,7 +66,7 @@ function readWordWrapState(model: IModel, configurationService: IConfigurationSe const _transientState = readTransientState(model, codeEditorService); return { configuredWordWrap: _configuredWordWrap, - configuredWordWrapMinified: (typeof _configuredWordWrapMinified.value === 'undefined' ? DefaultConfig.editor.wordWrapMinified : _configuredWordWrapMinified.value), + configuredWordWrapMinified: (typeof _configuredWordWrapMinified.value === 'undefined' ? EDITOR_DEFAULTS.wordWrapMinified : _configuredWordWrapMinified.value), transientState: _transientState }; } diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 88e1f59a9fd30..1e5cae2592b05 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -27,7 +27,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import debugActions = require('vs/workbench/parts/debug/browser/debugActions'); import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { OpenNextRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction } from 'vs/workbench/browser/parts/editor/editorActions'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_FONT_DEFAULTS } from "vs/editor/common/config/editorOptions"; import { registerColors } from './terminalColorRegistry'; let configurationRegistry = Registry.as(Extensions.Configuration); @@ -96,7 +96,7 @@ configurationRegistry.registerConfiguration({ 'terminal.integrated.fontSize': { 'description': nls.localize('terminal.integrated.fontSize', "Controls the font size in pixels of the terminal."), 'type': 'number', - 'default': DefaultConfig.editor.fontSize + 'default': EDITOR_FONT_DEFAULTS.fontSize }, 'terminal.integrated.lineHeight': { 'description': nls.localize('terminal.integrated.lineHeight', "Controls the line height of the terminal, this number is multipled by the terminal font size to get the actual line-height in pixels."), diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts index b356edb05eb44..fd87efa9993b0 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import * as platform from 'vs/base/common/platform'; -import { IConfiguration as IEditorConfiguration, DefaultConfig } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_FONT_DEFAULTS, IEditorOptions } from "vs/editor/common/config/editorOptions"; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration'; import { IChoiceService } from 'vs/platform/message/common/message'; @@ -14,6 +14,10 @@ import { ITerminalConfiguration, ITerminalConfigHelper, ITerminalFont, IShellLau import { Severity } from 'vs/editor/common/standalone/standaloneBase'; import { TPromise } from 'vs/base/common/winjs.base'; +interface IEditorConfiguration { + editor: IEditorOptions; +} + interface IFullTerminalConfiguration { terminal: { integrated: ITerminalConfiguration; @@ -86,7 +90,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper { const fontFamily = terminalConfig.fontFamily || editorConfig.fontFamily; let fontSize = this._toInteger(terminalConfig.fontSize, 0); if (fontSize <= 0) { - fontSize = DefaultConfig.editor.fontSize; + fontSize = EDITOR_FONT_DEFAULTS.fontSize; } let lineHeight = terminalConfig.lineHeight <= 0 ? DEFAULT_LINE_HEIGHT : terminalConfig.lineHeight; if (!lineHeight) { diff --git a/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts b/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts index 0943c00e0fd0d..285bc9025adb6 100644 --- a/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts @@ -10,7 +10,7 @@ import { IConfigurationService, getConfigurationValue } from 'vs/platform/config import { Platform } from 'vs/base/common/platform'; import { TPromise } from 'vs/base/common/winjs.base'; import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; +import { EDITOR_FONT_DEFAULTS } from "vs/editor/common/config/editorOptions"; class MockConfigurationService implements IConfigurationService { @@ -97,7 +97,7 @@ suite('Workbench - TerminalConfigHelper', () => { }); configHelper = new TerminalConfigHelper(Platform.Linux, configurationService, null, null, null); configHelper.panelContainer = fixture; - assert.equal(configHelper.getFont().fontSize, `${DefaultConfig.editor.fontSize}px`, 'The default editor font size should be used when editor.fontSize is 0 and terminal.integrated.fontSize not set'); + assert.equal(configHelper.getFont().fontSize, `${EDITOR_FONT_DEFAULTS.fontSize}px`, 'The default editor font size should be used when editor.fontSize is 0 and terminal.integrated.fontSize not set'); configurationService = new MockConfigurationService({ editor: { @@ -113,7 +113,7 @@ suite('Workbench - TerminalConfigHelper', () => { }); configHelper = new TerminalConfigHelper(Platform.Linux, configurationService, null, null, null); configHelper.panelContainer = fixture; - assert.equal(configHelper.getFont().fontSize, `${DefaultConfig.editor.fontSize}px`, 'The default editor font size should be used when editor.fontSize is < 0 and terminal.integrated.fontSize not set'); + assert.equal(configHelper.getFont().fontSize, `${EDITOR_FONT_DEFAULTS.fontSize}px`, 'The default editor font size should be used when editor.fontSize is < 0 and terminal.integrated.fontSize not set'); }); test('TerminalConfigHelper - getFont lineHeight', function () { diff --git a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts index 7da8192ba260a..640439add9a22 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts @@ -11,7 +11,6 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import * as strings from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; -import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; import { $, Dimension, Builder } from 'vs/base/browser/builder'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { EditorOptions } from 'vs/workbench/common/editor'; @@ -418,7 +417,13 @@ export class WalkThroughPart extends BaseEditor { return { ...isObject(config) ? config : Object.create(null), scrollBeyondLastLine: false, - scrollbar: DefaultConfig.editor.scrollbar, + scrollbar: { + verticalScrollbarSize: 14, + horizontal: 'auto', + useShadows: true, + verticalHasArrows: false, + horizontalHasArrows: false + }, overviewRulerLanes: 3, fixedOverflowWidgets: true, lineNumbersMinChars: 1,