Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -13,7 +13,7 @@ import { equalsIgnoreCase } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IOpener, IOpenerService, IValidator } from 'vs/platform/opener/common/opener';
import { IOpener, IOpenerService, IValidator, IExternalUriResolver } from 'vs/platform/opener/common/opener';
export class OpenerService extends Disposable implements IOpenerService {
@@ -21,6 +21,7 @@ export class OpenerService extends Disposable implements IOpenerService {
private readonly _openers = new LinkedList<IOpener>();
private readonly _validators = new LinkedList<IValidator>();
private readonly _resolvers = new LinkedList<IExternalUriResolver>();
constructor(
@ICodeEditorService private readonly _editorService: ICodeEditorService,
@@ -39,6 +40,11 @@ export class OpenerService extends Disposable implements IOpenerService {
return { dispose: remove };
}
registerExternalUriResolver(resolver: IExternalUriResolver): IDisposable {
const remove = this._resolvers.push(resolver);
return { dispose: remove };
}
async open(resource: URI, options?: { openToSide?: boolean, openExternal?: boolean }): Promise<boolean> {
// no scheme ?!?
if (!resource.scheme) {
@@ -118,7 +124,11 @@ export class OpenerService extends Disposable implements IOpenerService {
}
}
private _doOpenExternal(resource: URI): Promise<boolean> {
private async _doOpenExternal(resource: URI): Promise<boolean> {
for (const resolver of this._resolvers.toArray()) {
resource = await resolver.resolveExternalUri(resource);
}
dom.windowOpenNoOpener(encodeURI(resource.toString(true)));
return Promise.resolve(true);

View File

@@ -101,15 +101,6 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
}
const modelLineNumber = modelPosition.lineNumber;
if (!this._renderFinalNewline) {
const lineCount = this._context.model.getLineCount();
const lineContent = this._context.model.getLineContent(modelLineNumber);
if (modelLineNumber === lineCount && lineContent === '') {
return '';
}
}
if (this._renderCustomLineNumbers) {
return this._renderCustomLineNumbers(modelLineNumber);
}
@@ -146,10 +137,19 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const common = '<div class="' + LineNumbersOverlay.CLASS_NAME + lineHeightClassName + '" style="left:' + this._lineNumbersLeft.toString() + 'px;width:' + this._lineNumbersWidth.toString() + 'px;">';
const lineCount = this._context.model.getLineCount();
const output: string[] = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
if (!this._renderFinalNewline) {
if (lineNumber === lineCount && this._context.model.getLineLength(lineNumber) === 0) {
// Do not render last (empty) line
output[lineIndex] = '';
continue;
}
}
const renderLineNumber = this._getLineRenderLineNumber(lineNumber);
if (renderLineNumber) {

View File

@@ -179,7 +179,7 @@ export class ShiftCommand implements ICommand {
}
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);
if (lineNumber === startLine) {
if (lineNumber === startLine && !this._selection.isEmpty()) {
// Force the startColumn to stay put because we're inserting after it
this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);
}
@@ -226,7 +226,7 @@ export class ShiftCommand implements ICommand {
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), '');
} else {
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);
if (lineNumber === startLine) {
if (lineNumber === startLine && !this._selection.isEmpty()) {
// Force the startColumn to stay put because we're inserting after it
this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);
}

View File

@@ -5,7 +5,7 @@
/* Checkbox */
.monaco-checkbox .label {
.monaco-checkbox .codicon-selection {
width: 12px;
height: 12px;
border: 1px solid black;
@@ -24,7 +24,7 @@
border: 0;
}
.monaco-checkbox .checkbox:checked + .label {
.monaco-checkbox .checkbox:checked + .codicon-selection {
background-color: black;
}
@@ -166,6 +166,9 @@
background-position: center center;
background-repeat: no-repeat;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.monaco-editor .find-widget .button:not(.disabled):hover {
@@ -200,14 +203,6 @@
display: none;
}
.monaco-editor .find-widget .previous {
background-image: url('images/chevron-previous-light.svg');
}
.monaco-editor .find-widget .next {
background-image: url('images/chevron-next-light.svg');
}
.monaco-editor .find-widget .disabled {
opacity: 0.3;
cursor: default;
@@ -221,54 +216,32 @@
margin-left: 3px;
}
.monaco-editor .find-widget .monaco-checkbox .label {
content: '';
display: inline-block;
background-repeat: no-repeat;
background-position: center;
background-image: url('images/find-selection-light.svg');
.monaco-editor .find-widget .monaco-checkbox .codicon-selection {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border: none;
}
.monaco-editor .find-widget .monaco-checkbox .checkbox:disabled + .label {
.monaco-editor .find-widget .monaco-checkbox .checkbox:disabled + .codicon-selection {
opacity: 0.3;
cursor: default;
}
.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled) + .label {
.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled) + .codicon-selection {
cursor: pointer;
}
.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .label {
.monaco-editor .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .codicon-selection {
background-color: #DDD;
}
.monaco-editor .find-widget .monaco-checkbox .checkbox:checked + .label {
.monaco-editor .find-widget .monaco-checkbox .checkbox:checked + .codicon-selection {
background-color: rgba(100, 100, 100, 0.2);
}
.monaco-editor .find-widget .close-fw {
background-image: url('images/close-light.svg');
}
.monaco-editor .find-widget .expand {
background-image: url('images/tree-expanded-light.svg');
}
.monaco-editor .find-widget .collapse {
background-image: url('images/tree-collapsed-light.svg');
}
.monaco-editor .find-widget .replace {
background-image: url('images/replace-light.svg');
}
.monaco-editor .find-widget .replace-all {
background-image: url('images/replace-all-light.svg');
}
.monaco-editor .find-widget > .replace-part {
display: none;
}
@@ -329,52 +302,13 @@
margin-left: -4px;
}
.monaco-editor.hc-black .find-widget .previous,
.monaco-editor.vs-dark .find-widget .previous {
background-image: url('images/chevron-previous-dark.svg');
}
.monaco-editor.hc-black .find-widget .next,
.monaco-editor.vs-dark .find-widget .next {
background-image: url('images/chevron-next-dark.svg');
}
.monaco-editor.hc-black .find-widget .monaco-checkbox .label,
.monaco-editor.vs-dark .find-widget .monaco-checkbox .label {
background-image: url('images/find-selection-dark.svg');
}
.monaco-editor.vs-dark .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .label {
.monaco-editor.vs-dark .find-widget .monaco-checkbox .checkbox:not(:disabled):hover:before + .codicon-selection {
background-color: rgba(255, 255, 255, 0.1);
}
.monaco-editor.hc-black .find-widget .close-fw,
.monaco-editor.vs-dark .find-widget .close-fw {
background-image: url('images/close-dark.svg');
}
.monaco-editor.hc-black .find-widget .replace,
.monaco-editor.vs-dark .find-widget .replace {
background-image: url('images/replace-dark.svg');
}
.monaco-editor.hc-black .find-widget .replace-all,
.monaco-editor.vs-dark .find-widget .replace-all {
background-image: url('images/replace-all-dark.svg');
}
.monaco-editor.hc-black .find-widget .expand,
.monaco-editor.vs-dark .find-widget .expand {
background-image: url('images/tree-expanded-dark.svg');
}
.monaco-editor.hc-black .find-widget .collapse,
.monaco-editor.vs-dark .find-widget .collapse {
background-image: url('images/tree-collapsed-dark.svg');
}
.monaco-editor.hc-black .find-widget .button:not(.disabled):hover,
.monaco-editor.vs-dark .find-widget .button:not(.disabled):hover {
.monaco-editor.vs-dark .find-widget .button:not(.disabled):hover,
.monaco-editor.vs-dark .find-widget .monaco-checkbox:not(.disabled):hover {
background-color: rgba(255, 255, 255, 0.1);
}
@@ -384,6 +318,6 @@
left: 2px;
}
.monaco-editor.hc-black .find-widget .monaco-checkbox .checkbox:checked + .label {
.monaco-editor.hc-black .find-widget .monaco-checkbox .checkbox:checked + .codicon-selection {
background-color: rgba(255, 255, 255, 0.1);
}

View File

@@ -453,8 +453,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this._replaceAllBtn.setEnabled(this._isVisible && this._isReplaceVisible && findInputIsNonEmpty);
dom.toggleClass(this._domNode, 'replaceToggled', this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('collapse', !this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('expand', this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('codicon-chevron-right', !this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('codicon-chevron-down', this._isReplaceVisible);
this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);
let canReplace = !this._codeEditor.getOption(EditorOption.readOnly);
@@ -642,6 +642,10 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
if (!this._isVisible) {
return;
}
if (!dom.isInDOM(this._domNode)) {
// the widget is not in the DOM
return;
}
const layoutInfo = this._codeEditor.getLayoutInfo();
const editorContentWidth = layoutInfo.contentWidth;
@@ -951,7 +955,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Previous button
this._prevBtn = this._register(new SimpleButton({
label: NLS_PREVIOUS_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.PreviousMatchFindAction),
className: 'previous',
className: 'codicon codicon-arrow-up',
onTrigger: () => {
this._codeEditor.getAction(FIND_IDS.PreviousMatchFindAction).run().then(undefined, onUnexpectedError);
}
@@ -960,7 +964,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Next button
this._nextBtn = this._register(new SimpleButton({
label: NLS_NEXT_MATCH_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.NextMatchFindAction),
className: 'next',
className: 'codicon codicon-arrow-down',
onTrigger: () => {
this._codeEditor.getAction(FIND_IDS.NextMatchFindAction).run().then(undefined, onUnexpectedError);
}
@@ -1000,7 +1004,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Close button
this._closeBtn = this._register(new SimpleButton({
label: NLS_CLOSE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.CloseFindWidgetCommand),
className: 'close-fw',
className: 'codicon codicon-close',
onTrigger: () => {
this._state.change({ isRevealed: false, searchScope: null }, false);
},
@@ -1063,7 +1067,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Replace one button
this._replaceBtn = this._register(new SimpleButton({
label: NLS_REPLACE_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceOneAction),
className: 'replace',
className: 'codicon codicon-replace',
onTrigger: () => {
this._controller.replace();
},
@@ -1078,7 +1082,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Replace all button
this._replaceAllBtn = this._register(new SimpleButton({
label: NLS_REPLACE_ALL_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.ReplaceAllAction),
className: 'replace-all',
className: 'codicon codicon-replace-all',
onTrigger: () => {
this._controller.replaceAll();
}
@@ -1098,7 +1102,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Toggle replace button
this._toggleReplaceBtn = this._register(new SimpleButton({
label: NLS_TOGGLE_REPLACE_MODE_BTN_LABEL,
className: 'toggle left',
className: 'codicon toggle left',
onTrigger: () => {
this._state.change({ isReplaceRevealed: !this._isReplaceVisible }, false);
if (this._isReplaceVisible) {
@@ -1108,8 +1112,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this._showViewZone();
}
}));
this._toggleReplaceBtn.toggleClass('expand', this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('collapse', !this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('codicon-chevron-down', this._isReplaceVisible);
this._toggleReplaceBtn.toggleClass('codicon-chevron-right', !this._isReplaceVisible);
this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);
// Widget
@@ -1227,7 +1231,7 @@ class SimpleCheckbox extends Widget {
this._checkbox.tabIndex = -1;
this._label = document.createElement('label');
this._label.className = 'label';
this._label.className = 'codicon codicon-selection';
// Connect the label and the checkbox. Checkbox will get checked when the label receives a click.
this._label.htmlFor = this._checkbox.id;
this._label.tabIndex = -1;

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0719 8.00005L5.71461 12.3574L6.33333 12.9761L11 8.30941V7.69069L6.33333 3.02402L5.71461 3.64274L10.0719 8.00005Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 287 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0719 8.00005L5.71461 12.3574L6.33333 12.9761L11 8.30941V7.69069L6.33333 3.02402L5.71461 3.64274L10.0719 8.00005Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 287 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.97603 10.0719L12.3333 5.7146L12.9521 6.33332L8.28539 11L7.66667 11L3 6.33332L3.61872 5.7146L7.97603 10.0719Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.97603 10.0719L12.3333 5.7146L12.9521 6.33332L8.28539 11L7.66667 11L3 6.33332L3.61872 5.7146L7.97603 10.0719Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 282 B

View File

@@ -37,6 +37,10 @@
margin: 8px 0;
}
.monaco-editor-hover p > code {
font-family: var(--monaco-monospace-font);
}
.monaco-editor-hover hr {
margin-top: 4px;
margin-bottom: -6px;

View File

@@ -928,6 +928,28 @@ suite('Editor Contrib - Line Operations', () => {
model.dispose();
});
test('issue #80736: Indenting while the cursor is at the start of a line of text causes the added spaces or tab to be selected', () => {
const model = createTextModel(
[
'Some text'
].join('\n'),
{
insertSpaces: false,
}
);
withTestCodeEditor(null, { model: model }, (editor) => {
const indentLinesAction = new IndentLinesAction();
editor.setPosition(new Position(1, 1));
indentLinesAction.run(null!, editor);
assert.equal(model.getLineContent(1), '\tSome text');
assert.deepEqual(editor.getSelection(), new Selection(1, 2, 1, 2));
});
model.dispose();
});
test('issue #62112: Delete line does not work properly when multiple cursors are on line', () => {
const TEXT = [
'a',

View File

@@ -332,7 +332,12 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget,
private updateMaxHeight(): void {
const height = Math.max(this.editor.getLayoutInfo().height / 4, 250);
this.element.style.maxHeight = `${height}px`;
const maxHeight = `${height}px`;
this.element.style.maxHeight = maxHeight;
const wrapper = this.element.getElementsByClassName('wrapper') as HTMLCollectionOf<HTMLElement>;
if (wrapper.length) {
wrapper[0].style.maxHeight = maxHeight;
}
}
}

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 8.70708L11.6465 12.3535L12.3536 11.6464L8.70711 7.99998L12.3536 4.35353L11.6465 3.64642L8.00001 7.29287L4.35356 3.64642L3.64645 4.35353L7.2929 7.99998L3.64645 11.6464L4.35356 12.3535L8.00001 8.70708Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 379 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 8.70708L11.6465 12.3535L12.3536 11.6464L8.70711 7.99998L12.3536 4.35353L11.6465 3.64642L8.00001 7.29287L4.35356 3.64642L3.64645 4.35353L7.2929 7.99998L3.64645 11.6464L4.35356 12.3535L8.00001 8.70708Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 379 B

View File

@@ -56,10 +56,6 @@
margin: 0;
}
.monaco-editor .peekview-widget .head .peekview-actions .action-label.icon.close-peekview-action {
background: url('close-light.svg') center center no-repeat;
}
.monaco-editor .peekview-widget > .body {
border-top: 1px solid;
position: relative;
@@ -68,25 +64,20 @@
/* Dark Theme */
/* High Contrast Theme */
.monaco-editor.hc-black .peekview-widget .head .peekview-actions .action-label.icon.close-peekview-action,
.monaco-editor.vs-dark .peekview-widget .head .peekview-actions .action-label.icon.close-peekview-action {
background: url('close-dark.svg') center center no-repeat;
}
.monaco-editor .peekview-widget .peekview-actions .icon.chevron-up {
.monaco-editor .peekview-widget .peekview-actions .codicon.chevron-up {
background: url('chevron-previous-light.svg') center center no-repeat;
}
.vs-dark .monaco-editor .peekview-widget .peekview-actions .icon.chevron-up,
.hc-black .monaco-editor .peekview-widget .peekview-actions .icon.chevron-up {
.vs-dark .monaco-editor .peekview-widget .peekview-actions .codicon.chevron-up,
.hc-black .monaco-editor .peekview-widget .peekview-actions .codicon.chevron-up {
background: url('chevron-previous-dark.svg') center center no-repeat;
}
.monaco-editor .peekview-widget .peekview-actions .icon.chevron-down {
.monaco-editor .peekview-widget .peekview-actions .codicon.chevron-down {
background: url('chevron-next-light.svg') center center no-repeat;
}
.vs-dark .monaco-editor .peekview-widget .peekview-actions .icon.chevron-down,
.hc-black .monaco-editor .peekview-widget .peekview-actions .icon.chevron-down {
.vs-dark .monaco-editor .peekview-widget .peekview-actions .codicon.chevron-down,
.hc-black .monaco-editor .peekview-widget .peekview-actions .codicon.chevron-down {
background: url('chevron-next-dark.svg') center center no-repeat;
}
}

View File

@@ -168,7 +168,7 @@ export abstract class PeekViewWidget extends ZoneWidget {
this._actionbarWidget = new ActionBar(actionsContainer, actionBarOptions);
this._disposables.add(this._actionbarWidget);
this._actionbarWidget.push(new Action('peekview.close', nls.localize('label.close', "Close"), 'close-peekview-action', true, () => {
this._actionbarWidget.push(new Action('peekview.close', nls.localize('label.close', "Close"), 'codicon-close', true, () => {
this.dispose();
return Promise.resolve();
}), { label: false, icon: true });

View File

@@ -53,6 +53,10 @@
padding-left: 20px;
}
.monaco-editor .suggest-widget > .details p > code {
font-family: var(--monaco-monospace-font);
}
/* Styles for Message element for when widget is loading or is empty */
.monaco-editor .suggest-widget > .message {
padding-left: 22px;

View File

@@ -186,6 +186,10 @@ export class SimpleDialogService implements IDialogService {
public show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions): Promise<IShowResult> {
return Promise.resolve({ choice: 0 });
}
public about(): Promise<void> {
return Promise.resolve(undefined);
}
}
export class SimpleNotificationService implements INotificationService {

View File

@@ -92,7 +92,7 @@ suite('Editor Commands - ShiftCommand', () => {
'',
'123'
],
new Selection(1, 1, 1, 2)
new Selection(1, 2, 1, 2)
);
});