diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..7253a5ceee --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +min-release-age=7 diff --git a/src/@types/vscode.proposed.chatParticipantPrivate.d.ts b/src/@types/vscode.proposed.chatParticipantPrivate.d.ts index 02d7fb91dc..7ce7747060 100644 --- a/src/@types/vscode.proposed.chatParticipantPrivate.d.ts +++ b/src/@types/vscode.proposed.chatParticipantPrivate.d.ts @@ -242,6 +242,9 @@ declare module 'vscode' { /** Whether this request was initiated by the system rather than the user. */ readonly isSystemInitiated?: boolean; + /** When returned in session history, omit the request row but keep its response visible. */ + isRequestHidden?: boolean; + /** * @hidden */ diff --git a/src/@types/vscode.proposed.contribAccessibilityHelpContent.d.ts b/src/@types/vscode.proposed.contribAccessibilityHelpContent.d.ts index c04a0c65e5..f98c55d6c3 100644 --- a/src/@types/vscode.proposed.contribAccessibilityHelpContent.d.ts +++ b/src/@types/vscode.proposed.contribAccessibilityHelpContent.d.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// empty placeholder declaration for the `accessibilityHelpContent`-property of the `views`-contribution +// empty placeholder declaration for the `accessibilityHelpContent`-property of the `views`- and `customEditors`-contributions // https://github.com/microsoft/vscode/issues/209855 @meganrogge /** - * View contributions can include an `accessibilityHelpContent` property that provides help content for screen readers - * when the accessibility help dialog is invoked by the user with focus in the view. + * View and custom editor contributions can include an `accessibilityHelpContent` property that provides help content + * for screen readers when the accessibility help dialog is invoked by the user with focus in the view or custom editor. * * The content is provided as a markdown string and can contain commands that will be resolved along with their keybindings. */ diff --git a/src/@types/vscode.proposed.externalUriOpener.d.ts b/src/@types/vscode.proposed.externalUriOpener.d.ts index 142bf8a313..b32a52a491 100644 --- a/src/@types/vscode.proposed.externalUriOpener.d.ts +++ b/src/@types/vscode.proposed.externalUriOpener.d.ts @@ -52,6 +52,24 @@ declare module 'vscode' { Preferred = 3, } + /** + * Result returned by {@link ExternalUriOpener.canOpenExternalUri} when an opener also maps + * the external uri to a resource uri handled by the editor. + */ + export interface ExternalUriOpenerMatch { + /** + * Priority indicating if the opener can open the external uri. + */ + readonly priority: ExternalUriOpenerPriority; + + /** + * Optional resource uri to open instead of invoking {@link ExternalUriOpener.openExternalUri}. + * The editor opens this uri through its editor and opener infrastructure, honoring placement + * gestures (such as opening to the side) and editor resolution automatically. + */ + readonly targetUri?: Uri; + } + /** * Handles opening uris to external resources, such as http(s) links. * @@ -69,14 +87,15 @@ declare module 'vscode' { * not yet gone through port forwarding. * @param token Cancellation token indicating that the result is no longer needed. * - * @return Priority indicating if the opener can open the external uri. + * @return Priority indicating if the opener can open the external uri, or a match object + * carrying both priority and a `targetUri` for the editor to open directly. */ - canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | Thenable; + canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | ExternalUriOpenerMatch | Thenable; /** * Open a uri. * - * This is invoked when: + * This is invoked when {@link canOpenExternalUri} does not provide a `targetUri` and: * * - The user clicks a link which does not have an assigned opener. In this case, first `canOpenExternalUri` * is called and if the user selects this opener, then `openExternalUri` is called. @@ -90,7 +109,7 @@ declare module 'vscode' { * * @return Thenable indicating that the opening has completed. */ - openExternalUri(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable | void; + openExternalUri?(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable | void; } /** @@ -161,6 +180,11 @@ declare module 'vscode' { * standard external opener to be used. */ readonly allowContributedOpeners?: boolean | string; + + /** + * Opens the uri to the side of the active editor group when handled inside the editor. + */ + readonly openToSide?: boolean; } namespace env { diff --git a/src/test/github/externalUriOpener.test.ts b/src/test/github/externalUriOpener.test.ts index ed2c03fca6..b1f9300de3 100644 --- a/src/test/github/externalUriOpener.test.ts +++ b/src/test/github/externalUriOpener.test.ts @@ -17,6 +17,12 @@ import { PullRequestOverviewPanel } from '../../github/pullRequestOverview'; import { MockExtensionContext } from '../mocks/mockExtensionContext'; import { MockTelemetry } from '../mocks/mockTelemetry'; +type OpenerWithOpenExternalUri = vscode.ExternalUriOpener & Required>; + +function assertHasOpenExternalUri(opener: vscode.ExternalUriOpener): asserts opener is OpenerWithOpenExternalUri { + assert.strictEqual(typeof opener.openExternalUri, 'function'); +} + describe('GitHubIssueOrPullRequestExternalUriOpener', () => { let sandbox: SinonSandbox; @@ -34,10 +40,11 @@ describe('GitHubIssueOrPullRequestExternalUriOpener', () => { const credentialStore = new CredentialStore(telemetry, context); const repositoriesManager = new RepositoriesManager(credentialStore, telemetry); const folderRepositoryManagerResolver = new FolderRepositoryManagerResolver(context, repositoriesManager, telemetry); - let opener: vscode.ExternalUriOpener | undefined; + let opener: OpenerWithOpenExternalUri | undefined; let registration: vscode.Disposable | undefined; let cancellation: vscode.CancellationTokenSource | undefined; sandbox.stub(vscode.window, 'registerExternalUriOpener').callsFake((_id, value) => { + assertHasOpenExternalUri(value); opener = value; return new vscode.Disposable(() => undefined); }); @@ -91,10 +98,11 @@ describe('GitHubIssueOrPullRequestExternalUriOpener', () => { const credentialStore = new CredentialStore(telemetry, context); const repositoriesManager = new RepositoriesManager(credentialStore, telemetry); const folderRepositoryManagerResolver = new FolderRepositoryManagerResolver(context, repositoriesManager, telemetry); - let opener: vscode.ExternalUriOpener | undefined; + let opener: OpenerWithOpenExternalUri | undefined; let registration: vscode.Disposable | undefined; let cancellation: vscode.CancellationTokenSource | undefined; sandbox.stub(vscode.window, 'registerExternalUriOpener').callsFake((_id, value) => { + assertHasOpenExternalUri(value); opener = value; return new vscode.Disposable(() => undefined); }); @@ -134,7 +142,7 @@ describe('GitHubIssueOrPullRequestExternalUriOpener', () => { const panel = kind === 'pullRequest' ? PullRequestOverviewPanel : IssueOverviewPanel; const uri = vscode.Uri.parse(`https://github.com/aaa/bbb/${kind === 'pullRequest' ? 'pull' : 'issues'}/1000`); let context: MockExtensionContext; - let opener: vscode.ExternalUriOpener; + let opener: OpenerWithOpenExternalUri; let cancellation: vscode.CancellationTokenSource; let resolveModel: (model: undefined) => void; let rejectModel: (error: Error) => void; @@ -152,6 +160,7 @@ describe('GitHubIssueOrPullRequestExternalUriOpener', () => { cancellation = new vscode.CancellationTokenSource(); context.subscriptions.push(credentialStore, repositoriesManager, resolver, cancellation); sandbox.stub(vscode.window, 'registerExternalUriOpener').callsFake((_id, value) => { + assertHasOpenExternalUri(value); opener = value; return new vscode.Disposable(() => undefined); });