Skip to content

[pull] main from microsoft:main #150

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

Merged
merged 6 commits into from
Jun 24, 2025
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
1 change: 1 addition & 0 deletions build/lib/stylelint/vscode-known-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"--vscode-chat-requestBackground",
"--vscode-chat-requestBorder",
"--vscode-chat-requestBubbleBackground",
"--vscode-chat-requestBubbleHoverBackground",
"--vscode-chat-requestCodeBorder",
"--vscode-chat-slashCommandBackground",
"--vscode-chat-slashCommandForeground",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.102.0",
"distro": "7ce718aa7d6b04351dae613ead2c3e31d6e59e4f",
"distro": "ae33edbae267b91c1360906732e4b0eebdbff862",
"author": {
"name": "Microsoft Corporation"
},
Expand Down
1 change: 1 addition & 0 deletions src/vs/base/browser/ui/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IListVirtualDelegate<T> {

export interface IListElementRenderDetails {
readonly height?: number;
readonly onScroll?: boolean;
}

export interface IListRenderer<T, TTemplateData> {
Expand Down
10 changes: 5 additions & 5 deletions src/vs/base/browser/ui/list/listView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ export class ListView<T> implements IListView<T> {

// Render

protected render(previousRenderRange: IRange, renderTop: number, renderHeight: number, renderLeft: number | undefined, scrollWidth: number | undefined, updateItemsInDOM: boolean = false): void {
protected render(previousRenderRange: IRange, renderTop: number, renderHeight: number, renderLeft: number | undefined, scrollWidth: number | undefined, updateItemsInDOM: boolean = false, onScroll: boolean = false): void {
const renderRange = this.getRenderRange(renderTop, renderHeight);

const rangesToInsert = Range.relativeComplement(renderRange, previousRenderRange).reverse();
Expand All @@ -914,7 +914,7 @@ export class ListView<T> implements IListView<T> {
this.cache.transact(() => {
for (const range of rangesToRemove) {
for (let i = range.start; i < range.end; i++) {
this.removeItemFromDOM(i);
this.removeItemFromDOM(i, onScroll);
}
}

Expand Down Expand Up @@ -1041,7 +1041,7 @@ export class ListView<T> implements IListView<T> {
item.row!.domNode.classList.toggle('drop-target', item.dropTarget);
}

private removeItemFromDOM(index: number): void {
private removeItemFromDOM(index: number, onScroll?: boolean): void {
const item = this.items[index];
item.dragStartDisposable.dispose();
item.checkedDisposable.dispose();
Expand All @@ -1050,7 +1050,7 @@ export class ListView<T> implements IListView<T> {
const renderer = this.renderers.get(item.templateId);

if (renderer && renderer.disposeElement) {
renderer.disposeElement(item.element, index, item.row.templateData, { height: item.size });
renderer.disposeElement(item.element, index, item.row.templateData, { height: item.size, onScroll });
}

this.cache.release(item.row);
Expand Down Expand Up @@ -1151,7 +1151,7 @@ export class ListView<T> implements IListView<T> {
private onScroll(e: ScrollEvent): void {
try {
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth, undefined, true);

if (this.supportDynamicHeights) {
this._rerender(e.scrollTop, e.height, e.inSmoothScrolling);
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/environment/common/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface INativeEnvironmentService extends IEnvironmentService {
appSettingsHome: URI;
tmpDir: URI;
userDataPath: string;
machineSettingsResource: URI;

// --- extensions
extensionsPath: string;
Expand Down
3 changes: 3 additions & 0 deletions src/vs/platform/environment/common/environmentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export abstract class AbstractNativeEnvironmentService implements INativeEnviron
@memoize
get sync(): 'on' | 'off' | undefined { return this.args.sync; }

@memoize
get machineSettingsResource(): URI { return joinPath(URI.file(join(this.userDataPath, 'Machine')), 'settings.json'); }

@memoize
get workspaceStorageHome(): URI { return joinPath(this.appSettingsHome, 'workspaceStorage'); }

Expand Down
52 changes: 11 additions & 41 deletions src/vs/platform/mcp/common/mcpManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,16 @@
*--------------------------------------------------------------------------------------------*/

import { CancellationToken } from '../../../base/common/cancellation.js';
import { IStringDictionary } from '../../../base/common/collections.js';
import { Event } from '../../../base/common/event.js';
import { URI } from '../../../base/common/uri.js';
import { SortBy, SortOrder } from '../../extensionManagement/common/extensionManagement.js';
import { createDecorator } from '../../instantiation/common/instantiation.js';
import { IMcpServerConfiguration, IMcpServerVariable } from './mcpPlatformTypes.js';

export interface IScannedMcpServers {
servers?: IStringDictionary<IScannedMcpServer>;
inputs?: IMcpServerVariable[];
}

export interface IScannedMcpServer {
readonly id: string;
readonly name: string;
readonly version: string;
readonly gallery?: boolean;
readonly config: IMcpServerConfiguration;
}
import { IMcpServerConfiguration } from './mcpPlatformTypes.js';

export interface ILocalMcpServer {
readonly name: string;
readonly config: IMcpServerConfiguration;
readonly version: string;
readonly mcpResource: URI;
readonly location?: URI;
readonly id?: string;
readonly displayName?: string;
Expand Down Expand Up @@ -133,15 +118,6 @@ export interface IQueryOptions {
sortOrder?: SortOrder;
}

export const IMcpGalleryService = createDecorator<IMcpGalleryService>('IMcpGalleryService');
export interface IMcpGalleryService {
readonly _serviceBrand: undefined;
isEnabled(): boolean;
query(options?: IQueryOptions, token?: CancellationToken): Promise<IGalleryMcpServer[]>;
getManifest(extension: IGalleryMcpServer, token: CancellationToken): Promise<IMcpServerManifest>;
getReadme(extension: IGalleryMcpServer, token: CancellationToken): Promise<string>;
}

export interface InstallMcpServerEvent {
readonly name: string;
readonly source?: IGalleryMcpServer;
Expand Down Expand Up @@ -171,19 +147,14 @@ export interface DidUninstallMcpServerEvent {
readonly workspaceScoped?: boolean;
}

export type InstallOptions = {
packageType?: PackageType;
mcpResource?: URI;
};

export type UninstallOptions = {
mcpResource?: URI;
};

export interface IMcpServer {
name: string;
config: IMcpServerConfiguration;
inputs?: IMcpServerVariable[];
export const IMcpGalleryService = createDecorator<IMcpGalleryService>('IMcpGalleryService');
export interface IMcpGalleryService {
readonly _serviceBrand: undefined;
isEnabled(): boolean;
query(options?: IQueryOptions, token?: CancellationToken): Promise<IGalleryMcpServer[]>;
getManifest(extension: IGalleryMcpServer, token: CancellationToken): Promise<IMcpServerManifest>;
getReadme(extension: IGalleryMcpServer, token: CancellationToken): Promise<string>;
}

export const IMcpManagementService = createDecorator<IMcpManagementService>('IMcpManagementService');
Expand All @@ -193,10 +164,9 @@ export interface IMcpManagementService {
readonly onDidInstallMcpServers: Event<readonly InstallMcpServerResult[]>;
readonly onUninstallMcpServer: Event<UninstallMcpServerEvent>;
readonly onDidUninstallMcpServer: Event<DidUninstallMcpServerEvent>;
getInstalled(mcpResource?: URI): Promise<ILocalMcpServer[]>;
install(server: IMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;
installFromGallery(server: IGalleryMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;
uninstall(server: ILocalMcpServer, options?: UninstallOptions): Promise<void>;
getInstalled(): Promise<ILocalMcpServer[]>;
installFromGallery(server: IGalleryMcpServer, packageType: PackageType): Promise<void>;
uninstall(server: ILocalMcpServer): Promise<void>;
}

export const mcpGalleryServiceUrlConfig = 'chat.mcp.gallery.serviceUrl';
25 changes: 16 additions & 9 deletions src/vs/platform/mcp/common/mcpManagementCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,39 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IConfigurationService } from '../../configuration/common/configuration.js';
import { ILogger } from '../../log/common/log.js';
import { IMcpServerConfiguration } from './mcpPlatformTypes.js';
import { IMcpManagementService } from './mcpManagement.js';
import { IMcpConfiguration, IMcpConfigurationHTTP, IMcpConfigurationStdio, McpConfigurationServer } from './mcpPlatformTypes.js';

type ValidatedConfig = { name: string; config: IMcpServerConfiguration };
type ValidatedConfig = { name: string; config: IMcpConfigurationStdio | IMcpConfigurationHTTP };

export class McpManagementCli {
constructor(
private readonly _logger: ILogger,
@IMcpManagementService private readonly _mcpManagementService: IMcpManagementService,
@IConfigurationService private readonly _userConfigurationService: IConfigurationService,
) { }

async addMcpDefinitions(
definitions: string[],
) {
const configs = definitions.map((config) => this.validateConfiguration(config));
await this.updateMcpInResource(configs);
await this.updateMcpInConfig(this._userConfigurationService, configs);
this._logger.info(`Added MCP servers: ${configs.map(c => c.name).join(', ')}`);
}

private async updateMcpInResource(configs: ValidatedConfig[]) {
await Promise.all(configs.map(({ name, config }) => this._mcpManagementService.install({ name, config })));
private async updateMcpInConfig(service: IConfigurationService, configs: ValidatedConfig[]) {
const mcp = service.getValue<IMcpConfiguration>('mcp') || { servers: {} };
mcp.servers ??= {};

for (const config of configs) {
mcp.servers[config.name] = config.config;
}

await service.updateValue('mcp', mcp);
}

private validateConfiguration(config: string): ValidatedConfig {
let parsed: IMcpServerConfiguration & { name: string };
let parsed: McpConfigurationServer & { name: string };
try {
parsed = JSON.parse(config);
} catch (e) {
Expand All @@ -44,7 +51,7 @@ export class McpManagementCli {
}

const { name, ...rest } = parsed;
return { name, config: rest as IMcpServerConfiguration };
return { name, config: rest as IMcpConfigurationStdio | IMcpConfigurationHTTP };
}
}

Expand Down
134 changes: 0 additions & 134 deletions src/vs/platform/mcp/common/mcpManagementIpc.ts

This file was deleted.

Loading
Loading