Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -9,7 +9,7 @@ import { coalesce } from 'vs/base/common/arrays';
import { onUnexpectedExternalError } from 'vs/base/common/errors';
import { TPromise } from 'vs/base/common/winjs.base';
import { IReadOnlyModel } from 'vs/editor/common/editorCommon';
import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
import { Hover, HoverProviderRegistry } from 'vs/editor/common/modes';
import { asWinJsPromise } from 'vs/base/common/async';
import { Position } from 'vs/editor/common/core/position';
@@ -38,4 +38,4 @@ export function getHover(model: IReadOnlyModel, position: Position): TPromise<Ho
return TPromise.join(promises).then(() => coalesce(values));
}
CommonEditorRegistry.registerDefaultLanguageCommand('_executeHoverProvider', getHover);
registerDefaultLanguageCommand('_executeHoverProvider', getHover);

View File

@@ -27,14 +27,6 @@
max-width: 500px;
}
/*
* https://github.com/Microsoft/monaco-editor/issues/417
* Safari 10.1, fails inherit correct visibility from parent when we change the visibility of parent element from hidden to inherit, in this particular case.
*/
.monaco-editor-hover .monaco-scrollable-element {
visibility: visible;
}
.monaco-editor-hover .hover-row {
padding: 4px 5px;
}
@@ -74,4 +66,4 @@
.monaco-editor-hover .monaco-tokenized-source {
white-space: pre-wrap;
word-break: break-all;
}
}

View File

@@ -14,21 +14,19 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IModeService } from 'vs/editor/common/services/modeService';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { editorAction, ServicesAccessor, EditorAction } from 'vs/editor/common/editorCommonExtensions';
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions';
import { ModesContentHoverWidget } from './modesContentHover';
import { ModesGlyphHoverWidget } from './modesGlyphHover';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { editorHoverHighlight, editorHoverBackground, editorHoverBorder, textLinkForeground, textCodeBlockBackground } from 'vs/platform/theme/common/colorRegistry';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/browser/markdownRenderer';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
@editorContribution
export class ModesHoverController implements editorCommon.IEditorContribution {
private static ID = 'editor.contrib.hover';
private static readonly ID = 'editor.contrib.hover';
private _editor: ICodeEditor;
private _toUnhook: IDisposable[];
@@ -36,16 +34,30 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
private _contentWidget: ModesContentHoverWidget;
private _glyphWidget: ModesGlyphHoverWidget;
get contentWidget(): ModesContentHoverWidget {
if (!this._contentWidget) {
this._createHoverWidget();
}
return this._contentWidget;
}
get glyphWidget(): ModesGlyphHoverWidget {
if (!this._glyphWidget) {
this._createHoverWidget();
}
return this._glyphWidget;
}
private _isMouseDown: boolean;
private _hoverClicked: boolean;
static get(editor: editorCommon.ICommonCodeEditor): ModesHoverController {
static get(editor: ICodeEditor): ModesHoverController {
return editor.getContribution<ModesHoverController>(ModesHoverController.ID);
}
constructor(editor: ICodeEditor,
@IOpenerService openerService: IOpenerService,
@IModeService modeService: IModeService
@IOpenerService private _openerService: IOpenerService,
@IModeService private _modeService: IModeService
) {
this._editor = editor;
@@ -65,15 +77,12 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
this._hideWidgets();
}
}));
const renderer = new MarkdownRenderer(editor, modeService, openerService);
this._contentWidget = new ModesContentHoverWidget(editor, renderer);
this._glyphWidget = new ModesGlyphHoverWidget(editor, renderer);
}
}
private _onModelDecorationsChanged(): void {
this._contentWidget.onModelDecorationsChanged();
this._glyphWidget.onModelDecorationsChanged();
this.contentWidget.onModelDecorationsChanged();
this.glyphWidget.onModelDecorationsChanged();
}
private _onEditorMouseDown(mouseEvent: IEditorMouseEvent): void {
@@ -107,7 +116,7 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
var targetType = mouseEvent.target.type;
var stopKey = platform.isMacintosh ? 'metaKey' : 'ctrlKey';
if (this._isMouseDown && this._hoverClicked && this._contentWidget.isColorPickerVisible()) {
if (this._isMouseDown && this._hoverClicked && this.contentWidget.isColorPickerVisible()) {
return;
}
@@ -122,11 +131,11 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
}
if (this._editor.getConfiguration().contribInfo.hover && targetType === MouseTargetType.CONTENT_TEXT) {
this._glyphWidget.hide();
this._contentWidget.startShowingAt(mouseEvent.target.range, false);
this.glyphWidget.hide();
this.contentWidget.startShowingAt(mouseEvent.target.range, false);
} else if (targetType === MouseTargetType.GUTTER_GLYPH_MARGIN) {
this._contentWidget.hide();
this._glyphWidget.startShowingAt(mouseEvent.target.position.lineNumber);
this.contentWidget.hide();
this.glyphWidget.startShowingAt(mouseEvent.target.position.lineNumber);
} else {
this._hideWidgets();
}
@@ -140,7 +149,7 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
}
private _hideWidgets(): void {
if (this._isMouseDown && this._hoverClicked && this._contentWidget.isColorPickerVisible()) {
if (!this._contentWidget || (this._isMouseDown && this._hoverClicked && this._contentWidget.isColorPickerVisible())) {
return;
}
@@ -148,8 +157,14 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
this._contentWidget.hide();
}
private _createHoverWidget() {
const renderer = new MarkdownRenderer(this._editor, this._modeService, this._openerService);
this._contentWidget = new ModesContentHoverWidget(this._editor, renderer);
this._glyphWidget = new ModesGlyphHoverWidget(this._editor, renderer);
}
public showContentHover(range: Range, focus: boolean): void {
this._contentWidget.startShowingAt(range, focus);
this.contentWidget.startShowingAt(range, focus);
}
public getId(): string {
@@ -169,7 +184,6 @@ export class ModesHoverController implements editorCommon.IEditorContribution {
}
}
@editorAction
class ShowHoverAction extends EditorAction {
constructor() {
@@ -185,7 +199,7 @@ class ShowHoverAction extends EditorAction {
});
}
public run(accessor: ServicesAccessor, editor: editorCommon.ICommonCodeEditor): void {
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
let controller = ModesHoverController.get(editor);
if (!controller) {
return;
@@ -196,6 +210,9 @@ class ShowHoverAction extends EditorAction {
}
}
registerEditorContribution(ModesHoverController);
registerEditorAction(ShowHoverAction);
// theming
registerThemingParticipant((theme, collector) => {
let editorHoverHighlightColor = theme.getColor(editorHoverHighlight);

View File

@@ -79,10 +79,6 @@ export class HoverOperation<Result> {
this._progressCallback = progress;
}
public getComputer(): IHoverComputer<Result> {
return this._computer;
}
private _getHoverTimeMillis(): number {
if (this._computer.getHoverTimeMillis) {
return this._computer.getHoverTimeMillis();
@@ -186,4 +182,3 @@ export class HoverOperation<Result> {
}
}

View File

@@ -11,18 +11,18 @@ import { IRange, Range } from 'vs/editor/common/core/range';
import { Position } from 'vs/editor/common/core/position';
import { HoverProviderRegistry, Hover, IColor, DocumentColorProvider } from 'vs/editor/common/modes';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { getHover } from '../common/hover';
import { getHover } from 'vs/editor/contrib/hover/getHover';
import { HoverOperation, IHoverComputer } from './hoverOperation';
import { ContentHoverWidget } from './hoverWidgets';
import { IMarkdownString, MarkdownString, isEmptyMarkdownString, markedStringsEquals } from 'vs/base/common/htmlContent';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/browser/markdownRenderer';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
import { ColorPickerModel } from 'vs/editor/contrib/colorPicker/browser/colorPickerModel';
import { ColorPickerWidget } from 'vs/editor/contrib/colorPicker/browser/colorPickerWidget';
import { ColorDetector } from 'vs/editor/contrib/colorPicker/browser/colorDetector';
import { ColorPickerModel } from 'vs/editor/contrib/colorPicker/colorPickerModel';
import { ColorPickerWidget } from 'vs/editor/contrib/colorPicker/colorPickerWidget';
import { ColorDetector } from 'vs/editor/contrib/colorPicker/colorDetector';
import { Color, RGBA } from 'vs/base/common/color';
import { IDisposable, empty as EmptyDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
import { getColorPresentations } from 'vs/editor/contrib/colorPicker/common/color';
import { getColorPresentations } from 'vs/editor/contrib/colorPicker/color';
const $ = dom.$;
class ColorHover {
@@ -295,7 +295,8 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
// update column from which to show
var renderColumn = Number.MAX_VALUE,
highlightRange = messages[0].range,
fragment = document.createDocumentFragment();
fragment = document.createDocumentFragment(),
isEmptyHoverContent = true;
let containColorPicker = false;
messages.forEach((msg) => {
@@ -312,6 +313,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
.forEach(contents => {
const renderedContents = this._markdownRenderer.render(contents);
fragment.appendChild($('div.hover-row', null, renderedContents));
isEmptyHoverContent = false;
});
} else {
containColorPicker = true;
@@ -392,7 +394,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
// show
if (!containColorPicker) {
if (!containColorPicker && !isEmptyHoverContent) {
this.showAt(new Position(renderRange.startLineNumber, renderColumn), this._shouldFocus);
this.updateContents(fragment);
}
@@ -405,7 +407,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this._isChangingDecorations = false;
}
private static _DECORATION_OPTIONS = ModelDecorationOptions.register({
private static readonly _DECORATION_OPTIONS = ModelDecorationOptions.register({
className: 'hoverHighlight'
});
}

View File

@@ -8,7 +8,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { HoverOperation, IHoverComputer } from './hoverOperation';
import { GlyphHoverWidget } from './hoverWidgets';
import { $ } from 'vs/base/browser/dom';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/browser/markdownRenderer';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
import { IMarkdownString, isEmptyMarkdownString } from 'vs/base/common/htmlContent';
export interface IHoverMessage {
@@ -84,7 +84,7 @@ class MarginComputer implements IHoverComputer<IHoverMessage[]> {
export class ModesGlyphHoverWidget extends GlyphHoverWidget {
public static ID = 'editor.contrib.modesGlyphHoverWidget';
public static readonly ID = 'editor.contrib.modesGlyphHoverWidget';
private _messages: IHoverMessage[];
private _lastLineNumber: number;