Merge branch 'main' into tyriar/181900_2

This commit is contained in:
Daniel Imms 2024-04-01 09:40:56 -07:00 committed by GitHub
commit ee037b328f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 137 additions and 65 deletions

View file

@ -63,7 +63,8 @@
"core-ci-pr": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js core-ci-pr",
"extensions-ci": "node --max-old-space-size=8095 ./node_modules/gulp/bin/gulp.js extensions-ci",
"extensions-ci-pr": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js extensions-ci-pr",
"perf": "node scripts/code-perf.js"
"perf": "node scripts/code-perf.js",
"update-build-ts-version": "yarn add typescript@next && tsc -p ./build/tsconfig.build.json"
},
"dependencies": {
"@microsoft/1ds-core-js": "^3.2.13",
@ -209,7 +210,7 @@
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"tsec": "0.2.7",
"typescript": "^5.5.0-dev.20240318",
"typescript": "^5.5.0-dev.20240401",
"typescript-formatter": "7.1.0",
"util": "^0.12.4",
"vscode-nls-dev": "^3.3.1",

View file

@ -5,6 +5,8 @@
import { stripIcons } from 'vs/base/common/iconLabels';
import { IEditor } from 'vs/editor/common/editorCommon';
import { ILocalizedString } from 'vs/nls';
import { isLocalizedString } from 'vs/platform/action/common/action';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@ -38,9 +40,18 @@ export abstract class AbstractEditorCommandsQuickAccessProvider extends Abstract
const editorCommandPicks: ICommandQuickPick[] = [];
for (const editorAction of activeTextEditorControl.getSupportedActions()) {
let commandDescription: undefined | ILocalizedString;
if (editorAction.metadata?.description) {
if (isLocalizedString(editorAction.metadata.description)) {
commandDescription = editorAction.metadata.description;
} else {
commandDescription = { original: editorAction.metadata.description, value: editorAction.metadata.description };
}
}
editorCommandPicks.push({
commandId: editorAction.id,
commandAlias: editorAction.alias,
commandDescription,
label: stripIcons(editorAction.label) || editorAction.id,
});
}

View file

@ -1186,6 +1186,20 @@ class ContentReferencesListPool extends Disposable {
getWidgetAriaLabel: () => localize('usedReferences', "Used References")
},
dnd: {
getDragURI: ({ reference }: IChatContentReference) => {
if ('variableName' in reference) {
return null;
} else if (URI.isUri(reference)) {
return reference.toString();
} else {
return reference.uri.toString();
}
},
dispose: () => { },
onDragOver: () => false,
drop: () => { },
},
});
return list;

View file

@ -17,6 +17,7 @@ import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/co
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
import { MenuId, MenuRegistry, isIMenuItem } from 'vs/platform/actions/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { isLocalizedString } from 'vs/platform/action/common/action';
export class ConfigureLanguageBasedSettingsAction extends Action {
@ -83,21 +84,33 @@ CommandsRegistry.registerCommand({
//#region --- Register a command to get all actions from the command palette
CommandsRegistry.registerCommand('_getAllCommands', function (accessor) {
const keybindingService = accessor.get(IKeybindingService);
const actions: { command: string; label: string; precondition?: string; keybinding: string }[] = [];
const actions: { command: string; label: string; keybinding: string; description?: string; precondition?: string }[] = [];
for (const editorAction of EditorExtensionsRegistry.getEditorActions()) {
const keybinding = keybindingService.lookupKeybinding(editorAction.id);
actions.push({ command: editorAction.id, label: editorAction.label, precondition: editorAction.precondition?.serialize(), keybinding: keybinding?.getLabel() ?? 'Not set' });
actions.push({
command: editorAction.id,
label: editorAction.label,
description: isLocalizedString(editorAction.metadata?.description) ? editorAction.metadata.description.value : editorAction.metadata?.description,
precondition: editorAction.precondition?.serialize(),
keybinding: keybinding?.getLabel() ?? 'Not set'
});
}
for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) {
if (isIMenuItem(menuItem)) {
const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value;
const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined;
const label = category ? `${category}: ${title}` : title;
const description = isLocalizedString(menuItem.command.metadata?.description) ? menuItem.command.metadata.description.value : menuItem.command.metadata?.description;
const keybinding = keybindingService.lookupKeybinding(menuItem.command.id);
actions.push({ command: menuItem.command.id, label, precondition: menuItem.when?.serialize(), keybinding: keybinding?.getLabel() ?? 'Not set' });
actions.push({
command: menuItem.command.id,
label,
description,
precondition: menuItem.when?.serialize(),
keybinding: keybinding?.getLabel() ?? 'Not set'
});
}
}
return actions;
});
//#endregion

View file

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Dimension, getActiveDocument } from 'vs/base/browser/dom';
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
import { Lazy } from 'vs/base/common/lazy';
import { Disposable } from 'vs/base/common/lifecycle';
import type { ThemeIcon } from 'vs/base/common/themables';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { defaultInputBoxStyles } from 'vs/platform/theme/browser/defaultStyles';
import { getIconRegistry, IconContribution } from 'vs/platform/theme/common/iconRegistry';
import { WorkbenchIconSelectBox } from 'vs/workbench/services/userDataProfile/browser/iconSelectBox';
const icons = new Lazy<IconContribution[]>(() => {
const iconDefinitions = getIconRegistry().getIcons();
const includedChars = new Set<string>();
const dedupedIcons = iconDefinitions.filter(e => {
if (!('fontCharacter' in e.defaults)) {
return false;
}
if (includedChars.has(e.defaults.fontCharacter)) {
return false;
}
includedChars.add(e.defaults.fontCharacter);
return true;
});
return dedupedIcons;
});
export class TerminalIconPicker extends Disposable {
private readonly _iconSelectBox: WorkbenchIconSelectBox;
constructor(
@IInstantiationService instantiationService: IInstantiationService,
@IHoverService private readonly _hoverService: IHoverService
) {
super();
this._iconSelectBox = instantiationService.createInstance(WorkbenchIconSelectBox, {
icons: icons.value,
inputBoxStyles: defaultInputBoxStyles,
showIconInfo: true
});
}
async pickIcons(): Promise<ThemeIcon | undefined> {
const dimension = new Dimension(486, 260);
return new Promise<ThemeIcon | undefined>(resolve => {
this._register(this._iconSelectBox.onDidSelect(e => {
resolve(e);
this._iconSelectBox.dispose();
}));
this._iconSelectBox.clearInput();
const hoverWidget = this._hoverService.showHover({
content: this._iconSelectBox.domNode,
target: getActiveDocument().body,
position: {
hoverPosition: HoverPosition.BELOW,
},
persistence: {
sticky: true,
},
appearance: {
showPointer: true
}
}, true);
if (hoverWidget) {
this._register(hoverWidget);
}
this._iconSelectBox.layout(dimension);
this._iconSelectBox.focus();
});
}
}

View file

@ -11,7 +11,7 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { AutoOpenBarrier, Promises, disposableTimeout, timeout } from 'vs/base/common/async';
import { Codicon, getAllCodicons } from 'vs/base/common/codicons';
import { Codicon } from 'vs/base/common/codicons';
import { debounce } from 'vs/base/common/decorators';
import { ErrorNoTelemetry, onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
@ -88,6 +88,7 @@ import type { IMarker, Terminal as XTermTerminal } from '@xterm/xterm';
import { AccessibilityCommandId } from 'vs/workbench/contrib/accessibility/common/accessibilityCommands';
import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings';
import { shouldPasteTerminalText } from 'vs/workbench/contrib/terminal/common/terminalClipboard';
import { TerminalIconPicker } from 'vs/workbench/contrib/terminal/browser/terminalIconPicker';
const enum Constants {
/**
@ -366,7 +367,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
@IOpenerService private readonly _openerService: IOpenerService,
@ICommandService private readonly _commandService: ICommandService,
@IAccessibilitySignalService private readonly _accessibilitySignalService: IAccessibilitySignalService,
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService,
) {
super();
@ -2171,21 +2172,15 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._onIconChanged.fire({ instance: this, userInitiated: true });
return icon;
}
type Item = IQuickPickItem & { icon: TerminalIcon };
const items: Item[] = [];
for (const icon of getAllCodicons()) {
items.push({ label: `$(${icon.id})`, description: `${icon.id}`, icon });
const iconPicker = this._scopedInstantiationService.createInstance(TerminalIconPicker);
const pickedIcon = await iconPicker.pickIcons();
iconPicker.dispose();
if (!pickedIcon) {
return undefined;
}
const result = await this._quickInputService.pick(items, {
matchOnDescription: true,
placeHolder: nls.localize('changeIcon', 'Select an icon for the terminal')
});
if (result) {
this._icon = result.icon;
this._onIconChanged.fire({ instance: this, userInitiated: true });
return this._icon;
}
return;
this._icon = pickedIcon;
this._onIconChanged.fire({ instance: this, userInitiated: true });
return pickedIcon;
}
async changeColor(color?: string, skipQuickPick?: boolean): Promise<string | undefined> {

View file

@ -31,13 +31,6 @@ export function setup() {
await terminal.assertSingleTab({ color }, true);
});
it('should update icon of the tab', async () => {
await terminal.runCommand(TerminalCommandId.CreateNewEditor);
const icon = 'symbol-method';
await terminal.runCommandWithValue(TerminalCommandIdWithValue.ChangeIcon, icon);
await terminal.assertSingleTab({ icon }, true);
});
it('should rename the tab', async () => {
await terminal.runCommand(TerminalCommandId.CreateNewEditor);
const name = 'my terminal name';

View file

@ -29,38 +29,6 @@ export function setup() {
await terminal.assertTerminalGroups([[{}], [{}]]);
});
it('should update color of the single tab', async () => {
await terminal.createTerminal();
const color = 'Cyan';
await terminal.runCommandWithValue(TerminalCommandIdWithValue.ChangeColor, color);
await terminal.assertSingleTab({ color });
});
it('should update color of the tab in the tabs list', async () => {
await terminal.createTerminal();
await terminal.runCommand(TerminalCommandId.Split);
await terminal.waitForTerminalText(lines => lines.some(line => line.length > 0), undefined, 1);
const color = 'Cyan';
await terminal.runCommandWithValue(TerminalCommandIdWithValue.ChangeColor, color);
await terminal.assertTerminalGroups([[{}, { color }]]);
});
it('should update icon of the single tab', async () => {
await terminal.createTerminal();
const icon = 'symbol-method';
await terminal.runCommandWithValue(TerminalCommandIdWithValue.ChangeIcon, icon);
await terminal.assertSingleTab({ icon });
});
it('should update icon of the tab in the tabs list', async () => {
await terminal.createTerminal();
await terminal.runCommand(TerminalCommandId.Split);
await terminal.waitForTerminalText(lines => lines.some(line => line.length > 0), undefined, 1);
const icon = 'symbol-method';
await terminal.runCommandWithValue(TerminalCommandIdWithValue.ChangeIcon, icon);
await terminal.assertTerminalGroups([[{}, { icon }]]);
});
it('should rename the single tab', async () => {
await terminal.createTerminal();
const name = 'my terminal name';

View file

@ -9654,10 +9654,10 @@ typescript@^4.7.4:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
typescript@^5.5.0-dev.20240318:
version "5.5.0-dev.20240318"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.0-dev.20240318.tgz#b2fc9454fed98e8952ba524dee0cde991a752afe"
integrity sha512-NLUk3mN8h9UWmeFns5dhiRIIZffmDePNOMPwwr36tYoJikteOGLNCOOcCP2Yvc+cOzl/mkBOUaEngUBGYRJBGw==
typescript@^5.5.0-dev.20240401:
version "5.5.0-dev.20240401"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.0-dev.20240401.tgz#b2a38039c786a64eda2e801f1ff8a2562cd9f8a0"
integrity sha512-YeImidiTV9afClWslA8QLyJTTU6PQ5oWyeBSS04yjoVelrK2kpPPtJdnGLooOdzfFRgtZhGIxRIffDen8X93vw==
typical@^4.0.0:
version "4.0.0"