Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from microsoft:main #368

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/policy-watcher": "^1.1.8",
"@vscode/proxy-agent": "^0.27.0",
"@vscode/proxy-agent": "^0.28.0",
"@vscode/ripgrep": "^1.15.9",
"@vscode/spdlog": "^0.15.0",
"@vscode/sqlite3": "5.1.8-vscode",
Expand Down
8 changes: 4 additions & 4 deletions remote/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@parcel/watcher": "2.5.0",
"@vscode/deviceid": "^0.1.1",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/proxy-agent": "^0.27.0",
"@vscode/proxy-agent": "^0.28.0",
"@vscode/ripgrep": "^1.15.9",
"@vscode/spdlog": "^0.15.0",
"@vscode/tree-sitter-wasm": "^0.0.4",
Expand Down
10 changes: 6 additions & 4 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1783,9 +1783,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
else if (!hidden && !this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar)) {
const viewletToOpen = this.paneCompositeService.getLastActivePaneCompositeId(ViewContainerLocation.Sidebar);
if (viewletToOpen) {
const viewlet = this.paneCompositeService.openPaneComposite(viewletToOpen, ViewContainerLocation.Sidebar);
const viewlet = this.paneCompositeService.openPaneComposite(viewletToOpen, ViewContainerLocation.Sidebar, true);
if (!viewlet) {
this.paneCompositeService.openPaneComposite(this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id, ViewContainerLocation.Sidebar);
this.paneCompositeService.openPaneComposite(this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id, ViewContainerLocation.Sidebar, true);
}
}
}
Expand Down Expand Up @@ -1931,7 +1931,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

if (panelToOpen) {
this.paneCompositeService.openPaneComposite(panelToOpen, ViewContainerLocation.Panel);
const focus = !skipLayout;
this.paneCompositeService.openPaneComposite(panelToOpen, ViewContainerLocation.Panel, focus);
}
}

Expand Down Expand Up @@ -2030,7 +2031,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

if (panelToOpen) {
this.paneCompositeService.openPaneComposite(panelToOpen, ViewContainerLocation.AuxiliaryBar);
const focus = !skipLayout;
this.paneCompositeService.openPaneComposite(panelToOpen, ViewContainerLocation.AuxiliaryBar, focus);
}
}

Expand Down
16 changes: 11 additions & 5 deletions src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/c
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextViewService } from '../../../../platform/contextview/browser/contextView.js';
import { fillInSymbolsDragData } from '../../../../platform/dnd/browser/dnd.js';
import { fillInSymbolsDragData, LocalSelectionTransfer } from '../../../../platform/dnd/browser/dnd.js';
import { FileKind, IFileService, IFileStat } from '../../../../platform/files/common/files.js';
import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
import { InstantiationService } from '../../../../platform/instantiation/common/instantiationService.js';
Expand All @@ -39,7 +39,7 @@ import { EditorResourceAccessor, IEditorPartOptions, SideBySideEditor } from '..
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
import { ACTIVE_GROUP, ACTIVE_GROUP_TYPE, IEditorService, SIDE_GROUP, SIDE_GROUP_TYPE } from '../../../services/editor/common/editorService.js';
import { IOutline } from '../../../services/outline/browser/outline.js';
import { fillEditorsDragData } from '../../dnd.js';
import { DraggedEditorIdentifier, fillEditorsDragData } from '../../dnd.js';
import { DEFAULT_LABELS_CONTAINER, ResourceLabels } from '../../labels.js';
import { BreadcrumbsConfig, IBreadcrumbsService } from './breadcrumbs.js';
import { BreadcrumbsModel, FileElement, OutlineElement2 } from './breadcrumbsModel.js';
Expand Down Expand Up @@ -105,7 +105,7 @@ class OutlineItem extends BreadcrumbsItem {
this._disposables.add(toDisposable(() => { renderer.disposeTemplate(template); }));

if (element instanceof OutlineElement && outline.uri) {
this._disposables.add(this._instantiationService.invokeFunction(accessor => createBreadcrumbDndObserver(accessor, container, element.symbol.name, { symbol: element.symbol, uri: outline.uri! })));
this._disposables.add(this._instantiationService.invokeFunction(accessor => createBreadcrumbDndObserver(accessor, container, element.symbol.name, { symbol: element.symbol, uri: outline.uri! }, this.model, this.options.dragEditor)));
}
}
}
Expand Down Expand Up @@ -151,12 +151,12 @@ class FileItem extends BreadcrumbsItem {
container.classList.add(FileKind[this.element.kind].toLowerCase());
this._disposables.add(label);

this._disposables.add(this._instantiationService.invokeFunction(accessor => createBreadcrumbDndObserver(accessor, container, basename(this.element.uri), this.element.uri)));
this._disposables.add(this._instantiationService.invokeFunction(accessor => createBreadcrumbDndObserver(accessor, container, basename(this.element.uri), this.element.uri, this.model, this.options.dragEditor)));
}
}


function createBreadcrumbDndObserver(accessor: ServicesAccessor, container: HTMLElement, label: string, item: URI | { symbol: DocumentSymbol; uri: URI }): IDisposable {
function createBreadcrumbDndObserver(accessor: ServicesAccessor, container: HTMLElement, label: string, item: URI | { symbol: DocumentSymbol; uri: URI }, model: BreadcrumbsModel, dragEditor: boolean): IDisposable {
const instantiationService = accessor.get(IInstantiationService);

container.draggable = true;
Expand All @@ -183,6 +183,11 @@ function createBreadcrumbDndObserver(accessor: ServicesAccessor, container: HTML
kind: item.symbol.kind
}], event);
}

if (dragEditor && model.editor && model.editor?.input) {
const editorTransfer = LocalSelectionTransfer.getInstance<DraggedEditorIdentifier>();
editorTransfer.setData([new DraggedEditorIdentifier({ editor: model.editor.input, groupId: model.editor.group.id })], DraggedEditorIdentifier.prototype);
}
});

// Create drag image and remove when dropped
Expand All @@ -209,6 +214,7 @@ export interface IBreadcrumbsControlOptions {
readonly showSymbolIcons: boolean;
readonly showDecorationColors: boolean;
readonly showPlaceholder: boolean;
readonly dragEditor: boolean;
readonly widgetStyles?: IBreadcrumbsWidgetStyles;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/editor/breadcrumbsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class BreadcrumbsModel {

constructor(
readonly resource: URI,
editor: IEditorPane | undefined,
readonly editor: IEditorPane | undefined,
@IConfigurationService configurationService: IConfigurationService,
@IWorkspaceContextService private readonly _workspaceService: IWorkspaceContextService,
@IOutlineService private readonly _outlineService: IOutlineService,
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/browser/parts/editor/editorTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export class EditorTitleControl extends Themable {
showFileIcons: true,
showSymbolIcons: true,
showDecorationColors: false,
showPlaceholder: true
showPlaceholder: true,
dragEditor: false,
}));

// Breadcrumbs enablement & visibility change have an impact on layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class SingleEditorTabsControl extends EditorTabsControl {
showSymbolIcons: true,
showDecorationColors: false,
widgetStyles: { ...defaultBreadcrumbsWidgetStyles, breadcrumbsBackground: Color.transparent.toString() },
showPlaceholder: false
showPlaceholder: false,
dragEditor: true,
}));
this._register(this.breadcrumbsControlFactory.onDidEnablementChange(() => this.handleBreadcrumbsEnablementChange()));
titleContainer.classList.toggle('breadcrumbs', Boolean(this.breadcrumbsControl));
Expand Down
28 changes: 10 additions & 18 deletions src/vs/workbench/contrib/chat/browser/chatSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { IViewDescriptorService, ViewContainerLocation } from '../../../common/v
import { IActivityService, ProgressBadge } from '../../../services/activity/common/activity.js';
import { AuthenticationSession, IAuthenticationExtensionsService, IAuthenticationService } from '../../../services/authentication/common/authentication.js';
import { IWorkbenchExtensionEnablementService } from '../../../services/extensionManagement/common/extensionManagement.js';
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
import { IWorkbenchLayoutService, Parts } from '../../../services/layout/browser/layoutService.js';
import { IViewsService } from '../../../services/views/common/viewsService.js';
import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js';
Expand Down Expand Up @@ -1018,7 +1017,6 @@ class ChatSetupContext extends Disposable {
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IStorageService private readonly storageService: IStorageService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IExtensionService private readonly extensionService: IExtensionService,
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
@ILogService private readonly logService: ILogService,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
Expand All @@ -1030,25 +1028,19 @@ class ChatSetupContext extends Disposable {
}

private async checkExtensionInstallation(): Promise<void> {
this._register(this.extensionService.onDidChangeExtensions(result => {
for (const extension of result.removed) {
if (ExtensionIdentifier.equals(defaultChat.extensionId, extension.identifier)) {
this.update({ installed: false });
break;
}
}

for (const extension of result.added) {
if (ExtensionIdentifier.equals(defaultChat.extensionId, extension.identifier)) {
this.update({ installed: true });
break;
}
// Await extensions to be ready to be queries
await this.extensionsWorkbenchService.queryLocal();

// Listen to change and process extensions once
this._register(Event.runAndSubscribe(this.extensionsWorkbenchService.onChange, (e) => {
if (e && !ExtensionIdentifier.equals(e.identifier.id, defaultChat.extensionId)) {
return; // unrelated event
}
}));

const extensions = await this.extensionsWorkbenchService.queryLocal();
const defaultChatExtension = extensions.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.extensionId));
this.update({ installed: !!defaultChatExtension?.local && this.extensionEnablementService.isEnabled(defaultChatExtension.local) });
const defaultChatExtension = this.extensionsWorkbenchService.local.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.extensionId));
this.update({ installed: !!defaultChatExtension?.local && this.extensionEnablementService.isEnabled(defaultChatExtension.local) });
}));
}

update(context: { installed: boolean }): Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2368,8 +2368,9 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
if (extension?.isMalicious) {
throw new Error(nls.localize('malicious', "This extension is reported to be problematic."));
}
// TODO: @sandy081 - Install the extension only on servers where it is not installed
// Do not install if requested to enable and extension is already installed
if (!(installOptions.enable && extension?.local)) {
if (installOptions.installEverywhere || !(installOptions.enable && extension?.local)) {
if (!installable) {
if (!gallery) {
const id = isString(arg) ? arg : (<IExtension>arg).identifier.id;
Expand Down Expand Up @@ -2730,10 +2731,11 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
return this.extensionManagementService.installVSIX(vsix, manifest, installOptions);
}

private installFromGallery(extension: IExtension, gallery: IGalleryExtension, installOptions?: InstallOptions): Promise<ILocalExtension> {
private installFromGallery(extension: IExtension, gallery: IGalleryExtension, installOptions?: InstallExtensionOptions): Promise<ILocalExtension> {
installOptions = installOptions ?? {};
installOptions.pinned = extension.local?.pinned || !this.shouldAutoUpdateExtension(extension);
if (extension.local) {
// TODO: @sandy081 - Install the extension only on servers where it is not installed
if (!installOptions.installEverywhere && extension.local) {
installOptions.productVersion = this.getProductVersion();
installOptions.operation = InstallOperation.Update;
return this.extensionManagementService.updateFromGallery(gallery, extension.local, installOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,32 @@ export class ShowInlineChatHintAction extends EditorAction2 {

model.tokenization.forceTokenization(position.lineNumber);
const tokens = model.tokenization.getLineTokens(position.lineNumber);
const tokenIndex = tokens.findTokenIndexAtOffset(position.column - 1);
const tokenType = tokens.getStandardTokenType(tokenIndex);

if (tokenType === StandardTokenType.Comment) {
let totalLength = 0;
let specialLength = 0;
let lastTokenType: StandardTokenType | undefined;

tokens.forEach(idx => {
const tokenType = tokens.getStandardTokenType(idx);
const startOffset = tokens.getStartOffset(idx);
const endOffset = tokens.getEndOffset(idx);
totalLength += endOffset - startOffset;

if (tokenType !== StandardTokenType.Other) {
specialLength += endOffset - startOffset;
}
lastTokenType = tokenType;
});

if (specialLength / totalLength > 0.25) {
ctrl.hide();
} else {
ctrl.show();
return;
}
if (lastTokenType === StandardTokenType.Comment) {
ctrl.hide();
return;
}
ctrl.show();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
installOptions = { ...(installOptions || {}), isMachineScoped };
}

if (installOptions.installEverywhere || (!installOptions.isMachineScoped && this.isExtensionsSyncEnabled())) {
if (!installOptions.isMachineScoped && this.isExtensionsSyncEnabled()) {
if (this.extensionManagementServerService.localExtensionManagementServer
&& !servers.includes(this.extensionManagementServerService.localExtensionManagementServer)
&& await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(gallery) === true) {
Expand Down Expand Up @@ -597,7 +597,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
}
}

private async validateAndGetExtensionManagementServersToInstall(gallery: IGalleryExtension, installOptions?: InstallOptions): Promise<IExtensionManagementServer[]> {
private async validateAndGetExtensionManagementServersToInstall(gallery: IGalleryExtension, installOptions?: IWorkbenchInstallOptions): Promise<IExtensionManagementServer[]> {

const manifest = await this.extensionGalleryService.getManifest(gallery, CancellationToken.None);
if (!manifest) {
Expand All @@ -606,8 +606,8 @@ export class ExtensionManagementService extends Disposable implements IWorkbench

const servers: IExtensionManagementServer[] = [];

// Install Language pack on local and remote servers
if (isLanguagePackExtension(manifest)) {
// Install everywhere if asked to install everywhere or if the extension is a language pack
if (installOptions?.installEverywhere || isLanguagePackExtension(manifest)) {
servers.push(...this.servers.filter(server => server !== this.extensionManagementServerService.webExtensionManagementServer));
} else {
const server = this.getExtensionManagementServerToInstall(manifest);
Expand Down
Loading