Skip to content

Commit eb85b51

Browse files
committed
Merge remote-tracking branch 'origin/main' into connor4312/sampling-1
2 parents 553d42e + d95f4bd commit eb85b51

File tree

61 files changed

+759
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+759
-506
lines changed

src/vs/base/common/codiconsLibrary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,5 +598,5 @@ export const codiconsLibrary = {
598598
keyboardTabBelow: register('keyboard-tab-below', 0xec45),
599599
gitPullRequestDone: register('git-pull-request-done', 0xec46),
600600
mcp: register('mcp', 0xec47),
601-
extensionLarge: register('extension-large', 0xec48),
601+
extensionsLarge: register('extensions-large', 0xec48),
602602
} as const;

src/vs/base/common/oauth.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export interface IAuthorizationProtectedResourceMetadata {
2020
*/
2121
resource: string;
2222

23+
/**
24+
* OPTIONAL. Human-readable name of the protected resource intended for display to the end user.
25+
*/
26+
resource_name?: string;
27+
2328
/**
2429
* OPTIONAL. JSON array containing a list of OAuth authorization server issuer identifiers.
2530
*/

src/vs/editor/common/config/editorOptions.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,13 @@ class EditorEnumOption<K extends EditorOption, T extends string, V> extends Base
13571357
}
13581358
}
13591359

1360+
function stringArray(value: any, defaultValue: string[]): string[] {
1361+
if (!Array.isArray(value)) {
1362+
return defaultValue;
1363+
}
1364+
return value.map(item => String(item));
1365+
}
1366+
13601367
//#endregion
13611368

13621369
//#region autoIndent
@@ -4274,6 +4281,16 @@ export interface IInlineSuggestOptions {
42744281
*/
42754282
useMultiLineGhostText?: boolean;
42764283
};
4284+
4285+
/**
4286+
* @internal
4287+
*/
4288+
experimental?: {
4289+
/**
4290+
* @internal
4291+
*/
4292+
suppressInlineSuggestions?: string[];
4293+
};
42774294
}
42784295

42794296
type RequiredRecursive<T> = {
@@ -4305,6 +4322,9 @@ class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, I
43054322
allowCodeShifting: 'always',
43064323
useMultiLineGhostText: true
43074324
},
4325+
experimental: {
4326+
suppressInlineSuggestions: [],
4327+
},
43084328
};
43094329

43104330
super(
@@ -4336,6 +4356,12 @@ class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, I
43364356
default: defaults.suppressSuggestions,
43374357
description: nls.localize('inlineSuggest.suppressSuggestions', "Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")
43384358
},
4359+
'editor.inlineSuggest.experimental.suppressInlineSuggestions': {
4360+
type: 'array',
4361+
tags: ['experimental', 'onExp'],
4362+
items: { type: 'string' },
4363+
description: nls.localize('inlineSuggest.suppressInlineSuggestions', "Suppresses inline completions for specified extension IDs.")
4364+
},
43394365
'editor.inlineSuggest.fontFamily': {
43404366
type: 'string',
43414367
default: defaults.fontFamily,
@@ -4389,6 +4415,9 @@ class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, I
43894415
renderSideBySide: stringSet(input.edits?.renderSideBySide, this.defaultValue.edits.renderSideBySide, ['never', 'auto']),
43904416
useMultiLineGhostText: boolean(input.edits?.useMultiLineGhostText, this.defaultValue.edits.useMultiLineGhostText),
43914417
},
4418+
experimental: {
4419+
suppressInlineSuggestions: stringArray(input.experimental?.suppressInlineSuggestions, this.defaultValue.experimental.suppressInlineSuggestions),
4420+
},
43924421
};
43934422
}
43944423
}

src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class InlineCompletionsModel extends Disposable {
7070
private readonly _suggestPreviewEnabled;
7171
private readonly _suggestPreviewMode;
7272
private readonly _inlineSuggestMode;
73+
private readonly _suppressedInlineCompletionGroupIds;
7374
private readonly _inlineEditsEnabled;
7475
private readonly _inlineEditsShowCollapsedEnabled;
7576

@@ -103,6 +104,7 @@ export class InlineCompletionsModel extends Disposable {
103104
this._suggestPreviewEnabled = this._editorObs.getOption(EditorOption.suggest).map(v => v.preview);
104105
this._suggestPreviewMode = this._editorObs.getOption(EditorOption.suggest).map(v => v.previewMode);
105106
this._inlineSuggestMode = this._editorObs.getOption(EditorOption.inlineSuggest).map(v => v.mode);
107+
this._suppressedInlineCompletionGroupIds = this._editorObs.getOption(EditorOption.inlineSuggest).map(v => new Set(v.experimental.suppressInlineSuggestions));
106108
this._inlineEditsEnabled = this._editorObs.getOption(EditorOption.inlineSuggest).map(v => !!v.edits.enabled);
107109
this._inlineEditsShowCollapsedEnabled = this._editorObs.getOption(EditorOption.inlineSuggest).map(s => s.edits.showCollapsed);
108110
this._lastShownInlineCompletionInfo = undefined;
@@ -220,8 +222,10 @@ export class InlineCompletionsModel extends Disposable {
220222
const userJumpedToActiveCompletion = this._jumpedToId.map(jumpedTo => !!jumpedTo && jumpedTo === this._inlineCompletionItems.get()?.inlineEdit?.semanticId);
221223

222224
const providers = changeSummary.provider ? [changeSummary.provider] : this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel);
225+
const suppressedProviderGroupIds = this._suppressedInlineCompletionGroupIds.get();
226+
const availableProviders = providers.filter(provider => !(provider.groupId && suppressedProviderGroupIds.has(provider.groupId)));
223227

224-
return this._source.fetch(providers, cursorPosition, context, itemToPreserve?.identity, changeSummary.shouldDebounce, userJumpedToActiveCompletion, !!changeSummary.provider);
228+
return this._source.fetch(availableProviders, cursorPosition, context, itemToPreserve?.identity, changeSummary.shouldDebounce, userJumpedToActiveCompletion, !!changeSummary.provider);
225229
});
226230
this._inlineCompletionItems = derivedOpts({ owner: this }, reader => {
227231
const c = this._source.inlineCompletions.read(reader);

src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,14 @@ export class InlineEditsView extends Disposable {
357357
if (
358358
isSingleInnerEdit
359359
&& this._useCodeShifting.read(reader) !== 'never'
360-
&& isSingleLineInsertionAfterPosition(diff, inlineEdit.cursorPosition)
361360
) {
362-
return 'insertionInline';
361+
if (isSingleLineInsertionAfterPosition(diff, inlineEdit.cursorPosition)) {
362+
return 'insertionInline';
363+
}
364+
365+
// If we have a single line insertion before the cursor position, we do not want to move the cursor by inserting
366+
// the suggestion inline. Use a line replacement view instead
367+
return 'lineReplacement';
363368
}
364369

365370
const innerValues = inner.map(m => ({ original: inlineEdit.originalText.getValueOfRange(m.originalRange), modified: newText.getValueOfRange(m.modifiedRange) }));

src/vs/platform/mcp/common/mcpPlatformTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface IMcpConfigurationStdio extends IMcpConfigurationCommon {
3232
args?: readonly string[];
3333
env?: Record<string, string | number | null>;
3434
envFile?: string;
35+
cwd?: string;
3536
}
3637

3738
export interface IMcpConfigurationHTTP extends IMcpConfigurationCommon {

src/vs/workbench/api/browser/mainThreadAuthentication.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,18 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
113113
this._register(authenticationService.registerAuthenticationProviderHostDelegate({
114114
// Prefer Node.js extension hosts when they're available. No CORS issues etc.
115115
priority: extHostContext.extensionHostKind === ExtensionHostKind.LocalWebWorker ? 0 : 1,
116-
create: async (serverMetadata) => {
116+
create: async (serverMetadata, resource) => {
117117
const clientId = this.dynamicAuthProviderStorageService.getClientId(serverMetadata.issuer);
118118
let initialTokens: (IAuthorizationTokenResponse & { created_at: number })[] | undefined = undefined;
119119
if (clientId) {
120120
initialTokens = await this.dynamicAuthProviderStorageService.getSessionsForDynamicAuthProvider(serverMetadata.issuer, clientId);
121121
}
122-
return this._proxy.$registerDynamicAuthProvider(serverMetadata, clientId, initialTokens);
122+
return await this._proxy.$registerDynamicAuthProvider(
123+
serverMetadata,
124+
resource,
125+
clientId,
126+
initialTokens
127+
);
123128
}
124129
}));
125130
}
@@ -260,7 +265,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
260265

261266
private async doGetSession(providerId: string, scopes: string[], extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined> {
262267
const issuer = URI.revive(options.issuer);
263-
const sessions = await this.authenticationService.getSessions(providerId, scopes, options.account, true, issuer);
268+
const sessions = await this.authenticationService.getSessions(providerId, scopes, { account: options.account, issuer }, true);
264269
const provider = this.authenticationService.getProvider(providerId);
265270

266271
// Error cases

src/vs/workbench/api/browser/mainThreadMcp.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IExtHostContext, extHostNamedCustomer } from '../../services/extensions
2424
import { Proxied } from '../../services/extensions/common/proxyIdentifier.js';
2525
import { ExtHostContext, ExtHostMcpShape, MainContext, MainThreadMcpShape } from '../common/extHost.protocol.js';
2626
import { CancellationError } from '../../../base/common/errors.js';
27-
import { IAuthorizationServerMetadata } from '../../../base/common/oauth.js';
27+
import { IAuthorizationProtectedResourceMetadata, IAuthorizationServerMetadata } from '../../../base/common/oauth.js';
2828

2929
@extHostNamedCustomer(MainContext.MainThreadMcp)
3030
export class MainThreadMcp extends Disposable implements MainThreadMcpShape {
@@ -138,7 +138,7 @@ export class MainThreadMcp extends Disposable implements MainThreadMcpShape {
138138
this._servers.get(id)?.pushMessage(message);
139139
}
140140

141-
async $getTokenFromServerMetadata(id: number, metadata: IAuthorizationServerMetadata): Promise<string | undefined> {
141+
async $getTokenFromServerMetadata(id: number, metadata: IAuthorizationServerMetadata, resource: IAuthorizationProtectedResourceMetadata | undefined): Promise<string | undefined> {
142142
const server = this._serverDefinitions.get(id);
143143
if (!server) {
144144
return undefined;
@@ -149,13 +149,13 @@ export class MainThreadMcp extends Disposable implements MainThreadMcpShape {
149149
const scopesSupported = metadata.scopes_supported || [];
150150
let providerId = await this._authenticationService.getOrActivateProviderIdForIssuer(issuer);
151151
if (!providerId) {
152-
const provider = await this._authenticationService.createDynamicAuthenticationProvider(metadata);
152+
const provider = await this._authenticationService.createDynamicAuthenticationProvider(metadata, resource);
153153
if (!provider) {
154154
return undefined;
155155
}
156156
providerId = provider.id;
157157
}
158-
const sessions = await this._authenticationService.getSessions(providerId, scopesSupported, undefined, true, issuer);
158+
const sessions = await this._authenticationService.getSessions(providerId, scopesSupported, { issuer }, true);
159159
const accountNamePreference = this.authenticationMcpServersService.getAccountPreference(server.id, providerId);
160160
let matchingAccountPreferenceSession: AuthenticationSession | undefined;
161161
if (accountNamePreference) {
@@ -235,8 +235,8 @@ export class MainThreadMcp extends Disposable implements MainThreadMcpShape {
235235

236236
private async loginPrompt(mcpLabel: string, providerLabel: string, recreatingSession: boolean): Promise<boolean> {
237237
const message = recreatingSession
238-
? nls.localize('confirmRelogin', "The MCP Server '{0}' wants you to sign in again using {1}.", mcpLabel, providerLabel)
239-
: nls.localize('confirmLogin', "The MCP Server '{0}' wants to sign in using {1}.", mcpLabel, providerLabel);
238+
? nls.localize('confirmRelogin', "The MCP Server Definition '{0}' wants you to authenticate to {1}.", mcpLabel, providerLabel)
239+
: nls.localize('confirmLogin', "The MCP Server Definition '{0}' wants to authenticate to {1}.", mcpLabel, providerLabel);
240240

241241
const buttons: IPromptButton<boolean | undefined>[] = [
242242
{

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { IRelativePattern } from '../../../base/common/glob.js';
1111
import { IMarkdownString } from '../../../base/common/htmlContent.js';
1212
import { IJSONSchema } from '../../../base/common/jsonSchema.js';
1313
import { IDisposable } from '../../../base/common/lifecycle.js';
14-
import { IAuthorizationServerMetadata, IAuthorizationTokenResponse } from '../../../base/common/oauth.js';
14+
import { IAuthorizationProtectedResourceMetadata, IAuthorizationServerMetadata, IAuthorizationTokenResponse } from '../../../base/common/oauth.js';
1515
import * as performance from '../../../base/common/performance.js';
1616
import Severity from '../../../base/common/severity.js';
1717
import { ThemeColor, ThemeIcon } from '../../../base/common/themables.js';
@@ -1988,7 +1988,7 @@ export interface ExtHostAuthenticationShape {
19881988
$removeSession(id: string, sessionId: string): Promise<void>;
19891989
$onDidChangeAuthenticationSessions(id: string, label: string, extensionIdFilter?: string[]): Promise<void>;
19901990
$onDidUnregisterAuthenticationProvider(id: string): Promise<void>;
1991-
$registerDynamicAuthProvider(serverMetadata: IAuthorizationServerMetadata, clientId?: string, initialTokens?: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<void>;
1991+
$registerDynamicAuthProvider(serverMetadata: IAuthorizationServerMetadata, resource?: IAuthorizationProtectedResourceMetadata, clientId?: string, initialTokens?: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<string>;
19921992
$onDidChangeDynamicAuthProviderTokens(authProviderId: string, clientId: string, tokens?: (IAuthorizationTokenResponse & { created_at: number })[]): Promise<void>;
19931993
}
19941994

@@ -3017,7 +3017,7 @@ export interface MainThreadMcpShape {
30173017
$onDidReceiveMessage(id: number, message: string): void;
30183018
$upsertMcpCollection(collection: McpCollectionDefinition.FromExtHost, servers: McpServerDefinition.Serialized[]): void;
30193019
$deleteMcpCollection(collectionId: string): void;
3020-
$getTokenFromServerMetadata(id: number, metadata: IAuthorizationServerMetadata): Promise<string | undefined>;
3020+
$getTokenFromServerMetadata(id: number, metadata: IAuthorizationServerMetadata, resource: IAuthorizationProtectedResourceMetadata | undefined): Promise<string | undefined>;
30213021
}
30223022

30233023
export interface ExtHostLocalizationShape {

0 commit comments

Comments
 (0)