getSessions
This commit is contained in:
Родитель
aa704f6f31
Коммит
fe022d4851
|
@ -332,6 +332,29 @@ The proposal can be found as [vscode.proposed.lmTools.d.ts](https://github.com/m
|
|||
|
||||
> **Note**: The API is still under active development and things will change. Also expect VS Code to ship with reasonable default tools.
|
||||
|
||||
### Authentication `getSessions` is now `getAccounts`
|
||||
|
||||
While we support Multi-account authentication providers, something that has always been missing is the ability to get all sessions and take action on a specific sessions. Previously, we had a `getSessions` API proposal that attempted to solve this... but after experimenting more and using inspiration of popular authentication libraries, we are taking a different approach to solve the issue.
|
||||
|
||||
We've moved away from the previous proposed `getSessions` API... to something that separates the concept of "Accounts" and "Sessions".
|
||||
|
||||
Extension authors looking to consume authentication sessions can run the following in order to get the `AuthenticationSessionAccountInformation`s of the accounts that the user is logged into:
|
||||
```ts
|
||||
const accounts = vscode.authentication.getAccounts('microsoft');
|
||||
```
|
||||
|
||||
From there, you can use those accounts to mint sessions specifically for those accounts:
|
||||
```ts
|
||||
const session = vscode.authentication.getSession('microsoft', scopes, { account: accounts[0] })
|
||||
```
|
||||
|
||||
> NOTE: In order for this to work, the authentication provider does need to handle a new parameter, which you can read about in the API proposal below
|
||||
|
||||
We believe that this is a much clearer way to handle multiple authentication sessions and will be able to handle a variety of scenarios that we couldn't support before.
|
||||
|
||||
The proposal can be found as [vscode.proposed.authGetSessions.d.ts](https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.authGetSessions.d.ts) which kept the previous name for this proposal to not break existing things depending on this proposal.
|
||||
|
||||
|
||||
### Comment thread reveal
|
||||
|
||||
We have added an API proposal that allows extensions that provide comments to reveal their own comment threads in the editor. This API provides options for whether to preserve focus when revealing the thread, or to focus into the thread's reply box. The proposal is available at [vscode.proposed.commentReveal.d.ts](https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts).
|
||||
|
|
Загрузка…
Ссылка в новой задаче