Merge from vscode 073a24de05773f2261f89172987002dc0ae2f1cd (#9711)

This commit is contained in:
Anthony Dresser
2020-03-24 00:24:15 -07:00
committed by GitHub
parent 29741d684e
commit 89ef1b0c2e
226 changed files with 6161 additions and 3288 deletions

View File

@@ -37,13 +37,14 @@ export class GotoLineQuickAccessProvider extends AbstractGotoLineQuickAccessProv
return this.editorService.activeTextEditorControl;
}
protected gotoLocation(editor: IEditor, options: { range: IRange, keyMods: IKeyMods, forceSideBySide?: boolean }): void {
protected gotoLocation(editor: IEditor, options: { range: IRange, keyMods: IKeyMods, forceSideBySide?: boolean, preserveFocus?: boolean }): void {
// Check for sideBySide use
if ((options.keyMods.ctrlCmd || options.forceSideBySide) && this.editorService.activeEditor) {
this.editorService.openEditor(this.editorService.activeEditor, {
selection: options.range,
pinned: options.keyMods.alt || this.configuration.openEditorPinned
pinned: options.keyMods.alt || this.configuration.openEditorPinned,
preserveFocus: options.preserveFocus
}, SIDE_GROUP);
}
@@ -58,5 +59,5 @@ Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessPro
ctor: GotoLineQuickAccessProvider,
prefix: AbstractGotoLineQuickAccessProvider.PREFIX,
placeholder: localize('gotoLineQuickAccessPlaceholder', "Type the line number and optional column to go to (e.g. 42:5 for line 42 and column 5)."),
helpEntries: [{ description: localize('gotoLineQuickAccess', "Go to Line"), needsEditor: true }]
helpEntries: [{ description: localize('gotoLineQuickAccess', "Go to Line/Column"), needsEditor: true }]
});

View File

@@ -4,15 +4,19 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { IKeyMods } from 'vs/platform/quickinput/common/quickInput';
import { IKeyMods, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IRange } from 'vs/editor/common/core/range';
import { Registry } from 'vs/platform/registry/common/platform';
import { IQuickAccessRegistry, Extensions } from 'vs/platform/quickinput/common/quickAccess';
import { AbstractGotoSymbolQuickAccessProvider } from 'vs/editor/contrib/quickAccess/gotoSymbolQuickAccess';
import { AbstractGotoSymbolQuickAccessProvider, IGotoSymbolQuickPickItem } from 'vs/editor/contrib/quickAccess/gotoSymbolQuickAccess';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor';
import { ITextModel } from 'vs/editor/common/model';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { timeout } from 'vs/base/common/async';
import { CancellationToken } from 'vs/base/common/cancellation';
export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccessProvider {
@@ -40,13 +44,14 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
return this.editorService.activeTextEditorControl;
}
protected gotoLocation(editor: IEditor, options: { range: IRange, keyMods: IKeyMods, forceSideBySide?: boolean }): void {
protected gotoLocation(editor: IEditor, options: { range: IRange, keyMods: IKeyMods, forceSideBySide?: boolean, preserveFocus?: boolean }): void {
// Check for sideBySide use
if ((options.keyMods.ctrlCmd || options.forceSideBySide) && this.editorService.activeEditor) {
this.editorService.openEditor(this.editorService.activeEditor, {
selection: options.range,
pinned: options.keyMods.alt || this.configuration.openEditorPinned
pinned: options.keyMods.alt || this.configuration.openEditorPinned,
preserveFocus: options.preserveFocus
}, SIDE_GROUP);
}
@@ -55,11 +60,45 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
super.gotoLocation(editor, options);
}
}
//#region public methods to use this picker from other pickers
private static readonly SYMBOL_PICKS_TIMEOUT = 8000;
async getSymbolPicks(model: ITextModel, filter: string, disposables: DisposableStore, token: CancellationToken): Promise<Array<IGotoSymbolQuickPickItem | IQuickPickSeparator>> {
// If the registry does not know the model, we wait for as long as
// the registry knows it. This helps in cases where a language
// registry was not activated yet for providing any symbols.
// To not wait forever, we eventually timeout though.
const result = await Promise.race([
this.waitForLanguageSymbolRegistry(model, disposables),
timeout(GotoSymbolQuickAccessProvider.SYMBOL_PICKS_TIMEOUT)
]);
if (!result || token.isCancellationRequested) {
return [];
}
return this.doGetSymbolPicks(this.getDocumentSymbols(model, true, token), filter, token);
}
addDecorations(editor: IEditor, range: IRange): void {
super.addDecorations(editor, range);
}
clearDecorations(editor: IEditor): void {
super.clearDecorations(editor);
}
//#endregion
}
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
ctor: GotoSymbolQuickAccessProvider,
prefix: AbstractGotoSymbolQuickAccessProvider.PREFIX,
contextKey: 'inFileSymbolsPicker',
placeholder: localize('gotoSymbolQuickAccessPlaceholder', "Type the name of a symbol to go to."),
helpEntries: [
{ description: localize('gotoSymbolQuickAccess', "Go to Symbol in Editor"), prefix: AbstractGotoSymbolQuickAccessProvider.PREFIX, needsEditor: true },

View File

@@ -19,7 +19,6 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { DefaultSettingsEditorContribution } from 'vs/workbench/contrib/preferences/browser/preferencesEditor';
import { registerAndGetAmdImageURL } from 'vs/base/common/amd';
const transientWordWrapState = 'transientWordWrapState';
const isWordWrapMinifiedKey = 'isWordWrapMinified';
@@ -272,16 +271,12 @@ registerEditorContribution(ToggleWordWrapController.ID, ToggleWordWrapController
registerEditorAction(ToggleWordWrapAction);
const WORD_WRAP_DARK_ICON = URI.parse(registerAndGetAmdImageURL('vs/workbench/contrib/codeEditor/browser/word-wrap-dark.svg'));
const WORD_WRAP_LIGHT_ICON = URI.parse(registerAndGetAmdImageURL('vs/workbench/contrib/codeEditor/browser/word-wrap-light.svg'));
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: TOGGLE_WORD_WRAP_ID,
title: nls.localize('unwrapMinified', "Disable wrapping for this file"),
icon: {
dark: WORD_WRAP_DARK_ICON,
light: WORD_WRAP_LIGHT_ICON
id: 'codicon/word-wrap'
}
},
group: 'navigation',
@@ -297,8 +292,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
id: TOGGLE_WORD_WRAP_ID,
title: nls.localize('wrapMinified', "Enable wrapping for this file"),
icon: {
dark: WORD_WRAP_DARK_ICON,
light: WORD_WRAP_LIGHT_ICON
id: 'codicon/word-wrap'
}
},
group: 'navigation',

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="M3.86838 3.449C3.73951 3.30285 3.57724 3.18998 3.39538 3.12C3.12138 3.009 2.77238 2.97 2.34038 3.044C2.09669 3.08799 1.85836 3.15771 1.62938 3.252C1.54785 3.28668 1.46954 3.32851 1.39538 3.377L1.35238 3.407V4.463L1.52038 4.324C1.66938 4.2 1.84638 4.099 2.04738 4.021C2.24338 3.947 2.44638 3.908 2.65138 3.908C2.83938 3.908 2.98138 3.959 3.08238 4.065C3.16938 4.16 3.21938 4.313 3.22938 4.521L2.26738 4.665C2.04838 4.695 1.85738 4.751 1.69738 4.831C1.54486 4.90638 1.40941 5.01223 1.29938 5.142C1.1957 5.2675 1.11787 5.41228 1.07038 5.568C0.972926 5.89751 0.976758 6.2487 1.08138 6.576C1.13245 6.72744 1.21601 6.86588 1.32622 6.98162C1.43643 7.09736 1.57062 7.18759 1.71938 7.246C1.87438 7.309 2.04738 7.339 2.24738 7.339C2.43291 7.3427 2.61694 7.30504 2.7861 7.22876C2.95526 7.15248 3.10532 7.03949 3.22538 6.898V7.243H4.23238V4.65C4.23238 4.395 4.20238 4.166 4.14338 3.969C4.08893 3.7784 3.99527 3.60129 3.86838 3.449ZM3.23238 5.345V5.581C3.23238 5.7 3.21438 5.812 3.17738 5.922C3.14794 6.01808 3.09936 6.10722 3.03457 6.18403C2.96978 6.26085 2.89012 6.32377 2.80038 6.369C2.63942 6.44302 2.45624 6.45268 2.28838 6.396C2.23057 6.37553 2.1775 6.34355 2.13238 6.302C2.09131 6.26306 2.05923 6.21562 2.03838 6.163C2.01433 6.10398 2.00243 6.04072 2.00338 5.977C2.00338 5.9 2.01238 5.83 2.02738 5.765C2.04133 5.71228 2.06813 5.66383 2.10538 5.624C2.15016 5.57601 2.2052 5.53875 2.26638 5.515C2.36473 5.47845 2.46714 5.45394 2.57138 5.442L3.23238 5.345ZM8.28338 4.278C8.23672 4.04796 8.15439 3.82662 8.03938 3.622C7.93236 3.4367 7.78294 3.2794 7.60338 3.163C7.41073 3.04419 7.18764 2.98408 6.96138 2.99C6.7132 2.98696 6.47084 3.06528 6.27138 3.213C6.17111 3.28858 6.0822 3.37816 6.00738 3.479V1H5.08938V7.224H6.00738V6.943C6.13014 7.09519 6.29394 7.20902 6.47938 7.271C6.57738 7.303 6.68738 7.318 6.80938 7.318C7.06438 7.318 7.29238 7.258 7.48638 7.141C7.67838 7.026 7.84138 6.863 7.97238 6.655C8.11016 6.43406 8.20924 6.19125 8.26538 5.937C8.33139 5.64635 8.36361 5.34904 8.36138 5.051C8.36214 4.79133 8.336 4.53228 8.28338 4.278ZM7.42238 5.036C7.42238 5.268 7.40238 5.475 7.36338 5.649C7.32738 5.821 7.27338 5.964 7.20438 6.073C7.14898 6.17117 7.06859 6.25293 6.97138 6.31C6.88615 6.36014 6.78955 6.38774 6.6907 6.39019C6.59184 6.39264 6.49399 6.36986 6.40638 6.324C6.32419 6.27819 6.25236 6.21588 6.19538 6.141C6.13249 6.05546 6.08479 5.95973 6.05438 5.858C6.01818 5.74213 5.99997 5.62139 6.00038 5.5V4.983C6.00038 4.819 6.02038 4.669 6.05938 4.536C6.09638 4.404 6.14738 4.294 6.21638 4.2C6.2751 4.11382 6.35319 4.04259 6.44438 3.992C6.53297 3.94377 6.63253 3.91931 6.73338 3.921C6.83373 3.91811 6.93297 3.94254 7.02051 3.99168C7.10805 4.04083 7.18059 4.11283 7.23038 4.2C7.29338 4.299 7.33838 4.414 7.37338 4.554C7.40438 4.697 7.42238 4.86 7.42238 5.036ZM2.40838 9.9C2.49495 9.79816 2.60282 9.71657 2.72438 9.661C2.94238 9.561 3.27138 9.556 3.49038 9.643C3.59438 9.685 3.69438 9.743 3.81038 9.827L4.13938 10.087V8.945L4.04338 8.883C3.76373 8.7387 3.45306 8.66489 3.13838 8.668C2.83038 8.668 2.54538 8.725 2.29238 8.836C2.04238 8.946 1.82538 9.106 1.64538 9.311C1.46449 9.52067 1.32745 9.76447 1.24238 10.028C1.15238 10.3 1.10538 10.598 1.10538 10.923C1.10538 11.212 1.14838 11.484 1.23438 11.731C1.32138 11.98 1.44638 12.202 1.60838 12.383C1.76938 12.568 1.96938 12.716 2.20538 12.824C2.43738 12.928 2.69838 12.979 2.98338 12.979C3.21638 12.979 3.41738 12.951 3.59638 12.895C3.76106 12.8447 3.9179 12.7717 4.06238 12.678L4.14038 12.617V11.728L3.94038 11.823C3.91598 11.8342 3.89052 11.8429 3.86438 11.849C3.81438 11.866 3.76538 11.884 3.73638 11.898C3.70038 11.921 3.50938 11.988 3.50938 11.988C3.44938 12.012 3.36938 12.031 3.29138 12.047C3.09069 12.0915 2.88108 12.0715 2.69238 11.99C2.57431 11.9398 2.46955 11.8627 2.38638 11.765C2.29381 11.6545 2.22413 11.5267 2.18138 11.389C2.12877 11.2177 2.10313 11.0392 2.10538 10.86C2.10538 10.65 2.13338 10.461 2.18838 10.3C2.24238 10.142 2.31738 10.006 2.40838 9.9ZM14 6H10V5H14.5L15 5.5V11.5L14.5 12H7.87869L9.94976 14.0711L9.24265 14.7782L6.35356 11.8891V11.182L9.24265 8.2929L9.94976 9L7.94975 11H14V6Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

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="M3.86838 3.449C3.73951 3.30285 3.57724 3.18998 3.39538 3.12C3.12138 3.009 2.77238 2.97 2.34038 3.044C2.09669 3.08799 1.85836 3.15771 1.62938 3.252C1.54785 3.28668 1.46954 3.32851 1.39538 3.377L1.35238 3.407V4.463L1.52038 4.324C1.66938 4.2 1.84638 4.099 2.04738 4.021C2.24338 3.947 2.44638 3.908 2.65138 3.908C2.83938 3.908 2.98138 3.959 3.08238 4.065C3.16938 4.16 3.21938 4.313 3.22938 4.521L2.26738 4.665C2.04838 4.695 1.85738 4.751 1.69738 4.831C1.54486 4.90638 1.40941 5.01223 1.29938 5.142C1.1957 5.2675 1.11787 5.41228 1.07038 5.568C0.972926 5.89751 0.976758 6.2487 1.08138 6.576C1.13245 6.72744 1.21601 6.86588 1.32622 6.98162C1.43643 7.09736 1.57062 7.18759 1.71938 7.246C1.87438 7.309 2.04738 7.339 2.24738 7.339C2.43291 7.3427 2.61694 7.30504 2.7861 7.22876C2.95526 7.15248 3.10532 7.03949 3.22538 6.898V7.243H4.23238V4.65C4.23238 4.395 4.20238 4.166 4.14338 3.969C4.08893 3.7784 3.99527 3.60129 3.86838 3.449ZM3.23238 5.345V5.581C3.23238 5.7 3.21438 5.812 3.17738 5.922C3.14794 6.01808 3.09936 6.10722 3.03457 6.18403C2.96978 6.26085 2.89012 6.32377 2.80038 6.369C2.63942 6.44302 2.45624 6.45268 2.28838 6.396C2.23057 6.37553 2.1775 6.34355 2.13238 6.302C2.09131 6.26306 2.05923 6.21562 2.03838 6.163C2.01433 6.10398 2.00243 6.04072 2.00338 5.977C2.00338 5.9 2.01238 5.83 2.02738 5.765C2.04133 5.71228 2.06813 5.66383 2.10538 5.624C2.15016 5.57601 2.2052 5.53875 2.26638 5.515C2.36473 5.47845 2.46714 5.45394 2.57138 5.442L3.23238 5.345ZM8.28338 4.278C8.23672 4.04796 8.15439 3.82662 8.03938 3.622C7.93236 3.4367 7.78294 3.2794 7.60338 3.163C7.41073 3.04419 7.18764 2.98408 6.96138 2.99C6.7132 2.98696 6.47084 3.06528 6.27138 3.213C6.17111 3.28858 6.0822 3.37816 6.00738 3.479V1H5.08938V7.224H6.00738V6.943C6.13014 7.09519 6.29394 7.20902 6.47938 7.271C6.57738 7.303 6.68738 7.318 6.80938 7.318C7.06438 7.318 7.29238 7.258 7.48638 7.141C7.67838 7.026 7.84138 6.863 7.97238 6.655C8.11016 6.43406 8.20924 6.19125 8.26538 5.937C8.33139 5.64635 8.36361 5.34904 8.36138 5.051C8.36214 4.79133 8.336 4.53228 8.28338 4.278ZM7.42238 5.036C7.42238 5.268 7.40238 5.475 7.36338 5.649C7.32738 5.821 7.27338 5.964 7.20438 6.073C7.14898 6.17117 7.06859 6.25293 6.97138 6.31C6.88615 6.36014 6.78955 6.38774 6.6907 6.39019C6.59184 6.39264 6.49399 6.36986 6.40638 6.324C6.32419 6.27819 6.25236 6.21588 6.19538 6.141C6.13249 6.05546 6.08479 5.95973 6.05438 5.858C6.01818 5.74213 5.99997 5.62139 6.00038 5.5V4.983C6.00038 4.819 6.02038 4.669 6.05938 4.536C6.09638 4.404 6.14738 4.294 6.21638 4.2C6.2751 4.11382 6.35319 4.04259 6.44438 3.992C6.53297 3.94377 6.63253 3.91931 6.73338 3.921C6.83373 3.91811 6.93297 3.94254 7.02051 3.99168C7.10805 4.04083 7.18059 4.11283 7.23038 4.2C7.29338 4.299 7.33838 4.414 7.37338 4.554C7.40438 4.697 7.42238 4.86 7.42238 5.036ZM2.40838 9.9C2.49495 9.79816 2.60282 9.71657 2.72438 9.661C2.94238 9.561 3.27138 9.556 3.49038 9.643C3.59438 9.685 3.69438 9.743 3.81038 9.827L4.13938 10.087V8.945L4.04338 8.883C3.76373 8.7387 3.45306 8.66489 3.13838 8.668C2.83038 8.668 2.54538 8.725 2.29238 8.836C2.04238 8.946 1.82538 9.106 1.64538 9.311C1.46449 9.52067 1.32745 9.76447 1.24238 10.028C1.15238 10.3 1.10538 10.598 1.10538 10.923C1.10538 11.212 1.14838 11.484 1.23438 11.731C1.32138 11.98 1.44638 12.202 1.60838 12.383C1.76938 12.568 1.96938 12.716 2.20538 12.824C2.43738 12.928 2.69838 12.979 2.98338 12.979C3.21638 12.979 3.41738 12.951 3.59638 12.895C3.76106 12.8447 3.9179 12.7717 4.06238 12.678L4.14038 12.617V11.728L3.94038 11.823C3.91598 11.8342 3.89052 11.8429 3.86438 11.849C3.81438 11.866 3.76538 11.884 3.73638 11.898C3.70038 11.921 3.50938 11.988 3.50938 11.988C3.44938 12.012 3.36938 12.031 3.29138 12.047C3.09069 12.0915 2.88108 12.0715 2.69238 11.99C2.57431 11.9398 2.46955 11.8627 2.38638 11.765C2.29381 11.6545 2.22413 11.5267 2.18138 11.389C2.12877 11.2177 2.10313 11.0392 2.10538 10.86C2.10538 10.65 2.13338 10.461 2.18838 10.3C2.24238 10.142 2.31738 10.006 2.40838 9.9ZM14 6H10V5H14.5L15 5.5V11.5L14.5 12H7.87869L9.94976 14.0711L9.24265 14.7782L6.35356 11.8891V11.182L9.24265 8.2929L9.94976 9L7.94975 11H14V6Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB