Skip to content
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 .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min-release-age=7
3 changes: 3 additions & 0 deletions src/@types/vscode.proposed.chatParticipantPrivate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
32 changes: 28 additions & 4 deletions src/@types/vscode.proposed.externalUriOpener.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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<ExternalUriOpenerPriority>;
canOpenExternalUri(uri: Uri, token: CancellationToken): ExternalUriOpenerPriority | ExternalUriOpenerMatch | Thenable<ExternalUriOpenerPriority | ExternalUriOpenerMatch>;

/**
* 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.
Expand All @@ -90,7 +109,7 @@ declare module 'vscode' {
*
* @return Thenable indicating that the opening has completed.
*/
openExternalUri(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable<void> | void;
openExternalUri?(resolvedUri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): Thenable<void> | void;
}

/**
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 12 additions & 3 deletions src/test/github/externalUriOpener.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import { PullRequestOverviewPanel } from '../../github/pullRequestOverview';
import { MockExtensionContext } from '../mocks/mockExtensionContext';
import { MockTelemetry } from '../mocks/mockTelemetry';

type OpenerWithOpenExternalUri = vscode.ExternalUriOpener & Required<Pick<vscode.ExternalUriOpener, 'openExternalUri'>>;

function assertHasOpenExternalUri(opener: vscode.ExternalUriOpener): asserts opener is OpenerWithOpenExternalUri {
assert.strictEqual(typeof opener.openExternalUri, 'function');
}

describe('GitHubIssueOrPullRequestExternalUriOpener', () => {
let sandbox: SinonSandbox;

Expand All @@ -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);
});
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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;
Expand All @@ -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);
});
Expand Down
Loading