Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -102,6 +102,11 @@ export interface IEditorMinimapOptions {
* Defaults to false.
*/
enabled?: boolean;
/**
* Control the side of the minimap in editor.
* Defaults to 'right'.
*/
side?: 'right' | 'left';
/**
* Control the rendering of the minimap slider.
* Defaults to 'mouseover'.
@@ -256,6 +261,10 @@ export interface IEditorOptions {
* Defaults to 'line'.
*/
cursorStyle?: string;
/**
* Control the width of the cursor when cursorStyle is set to 'line'
*/
cursorWidth?: number;
/**
* Enable font ligatures.
* Defaults to false.
@@ -448,6 +457,10 @@ export interface IEditorOptions {
* Enable word based suggestions. Defaults to 'true'
*/
wordBasedSuggestions?: boolean;
/**
* The history mode for suggestions.
*/
suggestSelection?: string;
/**
* The font size for the suggest widget.
* Defaults to the editor font size.
@@ -736,6 +749,7 @@ export interface InternalEditorScrollbarOptions {
export interface InternalEditorMinimapOptions {
readonly enabled: boolean;
readonly side: 'right' | 'left';
readonly showSlider: 'always' | 'mouseover';
readonly renderCharacters: boolean;
readonly maxColumn: number;
@@ -786,6 +800,7 @@ export interface InternalEditorViewOptions {
readonly cursorBlinking: TextEditorCursorBlinkingStyle;
readonly mouseWheelZoom: boolean;
readonly cursorStyle: TextEditorCursorStyle;
readonly cursorWidth: number;
readonly hideCursorInOverviewRuler: boolean;
readonly scrollBeyondLastLine: boolean;
readonly smoothScrolling: boolean;
@@ -816,6 +831,7 @@ export interface EditorContribOptions {
readonly acceptSuggestionOnCommitCharacter: boolean;
readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
readonly wordBasedSuggestions: boolean;
readonly suggestSelection: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
readonly suggestFontSize: number;
readonly suggestLineHeight: number;
readonly selectionHighlight: boolean;
@@ -1014,6 +1030,7 @@ export class InternalEditorOptions {
&& a.contentWidth === b.contentWidth
&& a.contentHeight === b.contentHeight
&& a.renderMinimap === b.renderMinimap
&& a.minimapLeft === b.minimapLeft
&& a.minimapWidth === b.minimapWidth
&& a.viewportColumn === b.viewportColumn
&& a.verticalScrollbarWidth === b.verticalScrollbarWidth
@@ -1054,6 +1071,7 @@ export class InternalEditorOptions {
&& a.cursorBlinking === b.cursorBlinking
&& a.mouseWheelZoom === b.mouseWheelZoom
&& a.cursorStyle === b.cursorStyle
&& a.cursorWidth === b.cursorWidth
&& a.hideCursorInOverviewRuler === b.hideCursorInOverviewRuler
&& a.scrollBeyondLastLine === b.scrollBeyondLastLine
&& a.smoothScrolling === b.smoothScrolling
@@ -1095,6 +1113,7 @@ export class InternalEditorOptions {
private static _equalsMinimapOptions(a: InternalEditorMinimapOptions, b: InternalEditorMinimapOptions): boolean {
return (
a.enabled === b.enabled
&& a.side === b.side
&& a.showSlider === b.showSlider
&& a.renderCharacters === b.renderCharacters
&& a.maxColumn === b.maxColumn
@@ -1162,6 +1181,7 @@ export class InternalEditorOptions {
&& a.acceptSuggestionOnCommitCharacter === b.acceptSuggestionOnCommitCharacter
&& a.snippetSuggestions === b.snippetSuggestions
&& a.wordBasedSuggestions === b.wordBasedSuggestions
&& a.suggestSelection === b.suggestSelection
&& a.suggestFontSize === b.suggestFontSize
&& a.suggestLineHeight === b.suggestLineHeight
&& a.selectionHighlight === b.selectionHighlight
@@ -1282,6 +1302,10 @@ export interface EditorLayoutInfo {
*/
readonly contentHeight: number;
/**
* The position for the minimap
*/
readonly minimapLeft: number;
/**
* The width of the minimap
*/
@@ -1547,6 +1571,7 @@ export class EditorOptionsValidator {
}
return {
enabled: _boolean(opts.enabled, defaults.enabled),
side: _stringSet<'right' | 'left'>(opts.side, defaults.side, ['right', 'left']),
showSlider: _stringSet<'always' | 'mouseover'>(opts.showSlider, defaults.showSlider, ['always', 'mouseover']),
renderCharacters: _boolean(opts.renderCharacters, defaults.renderCharacters),
maxColumn: _clampedInt(opts.maxColumn, defaults.maxColumn, 1, 10000),
@@ -1647,6 +1672,7 @@ export class EditorOptionsValidator {
cursorBlinking: _cursorBlinkingStyleFromString(opts.cursorBlinking, defaults.cursorBlinking),
mouseWheelZoom: _boolean(opts.mouseWheelZoom, defaults.mouseWheelZoom),
cursorStyle: _cursorStyleFromString(opts.cursorStyle, defaults.cursorStyle),
cursorWidth: _clampedInt(opts.cursorWidth, defaults.cursorWidth, 0, Number.MAX_VALUE),
hideCursorInOverviewRuler: _boolean(opts.hideCursorInOverviewRuler, defaults.hideCursorInOverviewRuler),
scrollBeyondLastLine: _boolean(opts.scrollBeyondLastLine, defaults.scrollBeyondLastLine),
smoothScrolling: _boolean(opts.smoothScrolling, defaults.smoothScrolling),
@@ -1686,6 +1712,7 @@ export class EditorOptionsValidator {
acceptSuggestionOnCommitCharacter: _boolean(opts.acceptSuggestionOnCommitCharacter, defaults.acceptSuggestionOnCommitCharacter),
snippetSuggestions: _stringSet<'top' | 'bottom' | 'inline' | 'none'>(opts.snippetSuggestions, defaults.snippetSuggestions, ['top', 'bottom', 'inline', 'none']),
wordBasedSuggestions: _boolean(opts.wordBasedSuggestions, defaults.wordBasedSuggestions),
suggestSelection: _stringSet<'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'>(opts.suggestSelection, defaults.suggestSelection, ['first', 'recentlyUsed', 'recentlyUsedByPrefix']),
suggestFontSize: _clampedInt(opts.suggestFontSize, defaults.suggestFontSize, 0, 1000),
suggestLineHeight: _clampedInt(opts.suggestLineHeight, defaults.suggestLineHeight, 0, 1000),
selectionHighlight: _boolean(opts.selectionHighlight, defaults.selectionHighlight),
@@ -1749,6 +1776,7 @@ export class InternalEditorOptionsFactory {
cursorBlinking: opts.viewInfo.cursorBlinking,
mouseWheelZoom: opts.viewInfo.mouseWheelZoom,
cursorStyle: opts.viewInfo.cursorStyle,
cursorWidth: opts.viewInfo.cursorWidth,
hideCursorInOverviewRuler: opts.viewInfo.hideCursorInOverviewRuler,
scrollBeyondLastLine: opts.viewInfo.scrollBeyondLastLine,
smoothScrolling: opts.viewInfo.smoothScrolling,
@@ -1761,6 +1789,7 @@ export class InternalEditorOptionsFactory {
scrollbar: opts.viewInfo.scrollbar,
minimap: {
enabled: (accessibilityIsOn ? false : opts.viewInfo.minimap.enabled), // DISABLED WHEN SCREEN READER IS ATTACHED
side: opts.viewInfo.minimap.side,
renderCharacters: opts.viewInfo.minimap.renderCharacters,
showSlider: opts.viewInfo.minimap.showSlider,
maxColumn: opts.viewInfo.minimap.maxColumn
@@ -1784,6 +1813,7 @@ export class InternalEditorOptionsFactory {
acceptSuggestionOnCommitCharacter: opts.contribInfo.acceptSuggestionOnCommitCharacter,
snippetSuggestions: opts.contribInfo.snippetSuggestions,
wordBasedSuggestions: opts.contribInfo.wordBasedSuggestions,
suggestSelection: opts.contribInfo.suggestSelection,
suggestFontSize: opts.contribInfo.suggestFontSize,
suggestLineHeight: opts.contribInfo.suggestLineHeight,
selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
@@ -1842,6 +1872,7 @@ export class InternalEditorOptionsFactory {
scrollbarArrowSize: opts.viewInfo.scrollbar.arrowSize,
verticalScrollbarHasArrows: opts.viewInfo.scrollbar.verticalHasArrows,
minimap: opts.viewInfo.minimap.enabled,
minimapSide: opts.viewInfo.minimap.side,
minimapRenderCharacters: opts.viewInfo.minimap.renderCharacters,
minimapMaxColumn: opts.viewInfo.minimap.maxColumn,
pixelRatio: env.pixelRatio
@@ -1974,6 +2005,7 @@ export interface IEditorLayoutProviderOpts {
horizontalScrollbarHeight: number;
minimap: boolean;
minimapSide: string;
minimapRenderCharacters: boolean;
minimapMaxColumn: number;
pixelRatio: number;
@@ -1999,6 +2031,7 @@ export class EditorLayoutProvider {
const scrollbarArrowSize = _opts.scrollbarArrowSize | 0;
const horizontalScrollbarHeight = _opts.horizontalScrollbarHeight | 0;
const minimap = _opts.minimap;
const minimapSide = _opts.minimapSide;
const minimapRenderCharacters = _opts.minimapRenderCharacters;
const minimapMaxColumn = _opts.minimapMaxColumn | 0;
const pixelRatio = _opts.pixelRatio;
@@ -2014,17 +2047,19 @@ export class EditorLayoutProvider {
glyphMarginWidth = lineHeight;
}
const glyphMarginLeft = 0;
const lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
const decorationsLeft = lineNumbersLeft + lineNumbersWidth;
const contentLeft = decorationsLeft + lineDecorationsWidth;
let glyphMarginLeft = 0;
let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
let decorationsLeft = lineNumbersLeft + lineNumbersWidth;
let contentLeft = decorationsLeft + lineDecorationsWidth;
const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;
let renderMinimap: RenderMinimap;
let minimapLeft: number;
let minimapWidth: number;
let contentWidth: number;
if (!minimap) {
minimapLeft = 0;
minimapWidth = 0;
renderMinimap = RenderMinimap.None;
contentWidth = remainingWidth;
@@ -2056,6 +2091,16 @@ export class EditorLayoutProvider {
minimapWidth = Math.floor(minimapMaxColumn * minimapCharWidth);
}
contentWidth = remainingWidth - minimapWidth;
if (minimapSide === 'left') {
minimapLeft = 0;
glyphMarginLeft += minimapWidth;
lineNumbersLeft += minimapWidth;
decorationsLeft += minimapWidth;
contentLeft += minimapWidth;
} else {
minimapLeft = outerWidth - minimapWidth - verticalScrollbarWidth;
}
}
const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth) / typicalHalfwidthCharacterWidth));
@@ -2083,6 +2128,7 @@ export class EditorLayoutProvider {
contentHeight: outerHeight,
renderMinimap: renderMinimap,
minimapLeft: minimapLeft,
minimapWidth: minimapWidth,
viewportColumn: viewportColumn,
@@ -2172,6 +2218,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
cursorBlinking: TextEditorCursorBlinkingStyle.Blink,
mouseWheelZoom: false,
cursorStyle: TextEditorCursorStyle.Line,
cursorWidth: 0,
hideCursorInOverviewRuler: false,
scrollBeyondLastLine: true,
smoothScrolling: false,
@@ -2198,6 +2245,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
minimap: {
// {{SQL CARBON EDIT}}
enabled: false,
side: 'right',
showSlider: 'mouseover',
renderCharacters: true,
maxColumn: 120
@@ -2221,6 +2269,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
acceptSuggestionOnCommitCharacter: true,
snippetSuggestions: 'inline',
wordBasedSuggestions: true,
suggestSelection: 'recentlyUsed',
suggestFontSize: 0,
suggestLineHeight: 0,
selectionHighlight: true,
@@ -2232,7 +2281,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
find: {
seedSearchStringFromSelection: true,
autoFindInSelection: false,
globalFindClipboard: true
globalFindClipboard: false
},
colorDecorators: true,
lightbulbEnabled: true