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
19 changes: 19 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ src/vs/base/browser/ui/list/** @joaomoreno @benibenj
src/vs/base/browser/ui/sash/** @joaomoreno @benibenj
src/vs/base/browser/ui/splitview/** @joaomoreno @benibenj
src/vs/base/browser/ui/grid/** @joaomoreno @benibenj
src/bootstrap-cli.ts @bpasero @deepak1556
src/bootstrap-esm.ts @bpasero @deepak1556
src/bootstrap-fork.ts @bpasero @deepak1556
src/bootstrap-import.ts @bpasero @deepak1556
src/bootstrap-meta.ts @bpasero @deepak1556
src/bootstrap-node.ts @bpasero @deepak1556
src/bootstrap-server.ts @bpasero @deepak1556
src/cli.ts @bpasero @deepak1556
src/main.ts @bpasero @deepak1556
src/server-cli.ts @bpasero @deepak1556
src/server-main.ts @bpasero @deepak1556
src/vs/base/parts/sandbox/** @bpasero @deepak1556
src/vs/base/parts/storage/** @bpasero @deepak1556
src/vs/platform/backup/** @bpasero
src/vs/platform/files/** @bpasero @deepak1556
src/vs/base/node/pfs.ts @bpasero @deepak1556
src/vs/code/** @bpasero @deepak1556
src/vs/workbench/services/textfile/** @bpasero
src/vs/workbench/services/workingCopy/** @bpasero

# ensure the API police is aware of changes to the vscode-dts file
# this is only about the final API, not about proposed API changes
Expand Down
27 changes: 25 additions & 2 deletions extensions/github-authentication/src/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ interface IFlowTriggerOptions {
* The specific auth provider to use for the flow.
*/
signInProvider?: GitHubSocialSignInProvider;
/**
* Extra parameters to include in the OAuth flow.
*/
extraAuthorizeParameters?: Record<string, string>;
/**
* The Uri that the OAuth flow will redirect to. (i.e. vscode.dev/redirect)
*/
Expand Down Expand Up @@ -180,6 +184,7 @@ class UrlHandlerFlow implements IFlow {
enterpriseUri,
nonce,
signInProvider,
extraAuthorizeParameters,
uriHandler,
existingLogin,
logger,
Expand Down Expand Up @@ -210,6 +215,11 @@ class UrlHandlerFlow implements IFlow {
if (signInProvider) {
searchParams.append('provider', signInProvider);
}
if (extraAuthorizeParameters) {
for (const [key, value] of Object.entries(extraAuthorizeParameters)) {
searchParams.append(key, value);
}
}

// The extra toString, parse is apparently needed for env.openExternal
// to open the correct URL.
Expand Down Expand Up @@ -259,6 +269,7 @@ class LocalServerFlow implements IFlow {
callbackUri,
enterpriseUri,
signInProvider,
extraAuthorizeParameters,
existingLogin,
logger
}: IFlowTriggerOptions): Promise<string> {
Expand All @@ -285,6 +296,11 @@ class LocalServerFlow implements IFlow {
if (signInProvider) {
searchParams.append('provider', signInProvider);
}
if (extraAuthorizeParameters) {
for (const [key, value] of Object.entries(extraAuthorizeParameters)) {
searchParams.append(key, value);
}
}

const loginUrl = baseUri.with({
path: '/login/oauth/authorize',
Expand Down Expand Up @@ -332,7 +348,7 @@ class DeviceCodeFlow implements IFlow {
supportsSupportedClients: true,
supportsUnsupportedClients: true
};
async trigger({ scopes, baseUri, signInProvider, logger }: IFlowTriggerOptions) {
async trigger({ scopes, baseUri, signInProvider, extraAuthorizeParameters, logger }: IFlowTriggerOptions) {
logger.info(`Trying device code flow... (${scopes})`);

// Get initial device code
Expand Down Expand Up @@ -369,9 +385,16 @@ class DeviceCodeFlow implements IFlow {
await env.clipboard.writeText(json.user_code);

let open = Uri.parse(json.verification_uri);
const query = new URLSearchParams(open.query);
if (signInProvider) {
const query = new URLSearchParams(open.query);
query.set('provider', signInProvider);
}
if (extraAuthorizeParameters) {
for (const [key, value] of Object.entries(extraAuthorizeParameters)) {
query.set(key, value);
}
}
if (signInProvider || extraAuthorizeParameters) {
open = open.with({ query: query.toString() });
}
const uriToOpen = await env.asExternalUri(open);
Expand Down
28 changes: 26 additions & 2 deletions extensions/github-authentication/src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ interface GitHubAuthenticationProviderOptions extends vscode.AuthenticationProvi
* leaving it up to the user to choose the social sign-in provider on the sign-in page.
*/
readonly provider?: GitHubSocialSignInProvider;
readonly extraAuthorizeParameters?: Record<string, string>;
}

function isGitHubAuthenticationProviderOptions(object: any): object is GitHubAuthenticationProviderOptions {
if (!object || typeof object !== 'object') {
throw new Error('Options are not an object');
}
if (object.provider !== undefined && !isSocialSignInProvider(object.provider)) {
throw new Error(`Provider is invalid: ${object.provider}`);
}
if (object.extraAuthorizeParameters !== undefined) {
if (!object.extraAuthorizeParameters || typeof object.extraAuthorizeParameters !== 'object') {
throw new Error('Extra parameters must be a record of string keys and string values.');
}
for (const [key, value] of Object.entries(object.extraAuthorizeParameters)) {
if (typeof key !== 'string' || typeof value !== 'string') {
throw new Error('Extra parameters must be a record of string keys and string values.');
}
}
}
return true;
}

export class UriEventHandler extends vscode.EventEmitter<vscode.Uri> implements vscode.UriHandler {
Expand Down Expand Up @@ -338,12 +359,15 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid
scopes: JSON.stringify(scopes),
});

if (options && !isGitHubAuthenticationProviderOptions(options)) {
throw new Error('Invalid options');
}
const sessions = await this._sessionsPromise;
const loginWith = options?.account?.label;
const signInProvider = isSocialSignInProvider(options?.provider) ? options.provider : undefined;
const signInProvider = options?.provider;
this._logger.info(`Logging in with${signInProvider ? ` ${signInProvider}, ` : ''} '${loginWith ? loginWith : 'any'}' account...`);
const scopeString = sortedScopes.join(' ');
const token = await this._githubServer.login(scopeString, signInProvider, loginWith);
const token = await this._githubServer.login(scopeString, signInProvider, options?.extraAuthorizeParameters, loginWith);
const session = await this.tokenToSession(token, scopes);
this.afterSessionLoad(session);

Expand Down
5 changes: 3 additions & 2 deletions extensions/github-authentication/src/githubServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const REDIRECT_URL_STABLE = 'https://vscode.dev/redirect';
const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect';

export interface IGitHubServer {
login(scopes: string, signInProvider?: GitHubSocialSignInProvider, existingLogin?: string): Promise<string>;
login(scopes: string, signInProvider?: GitHubSocialSignInProvider, extraAuthorizeParameters?: Record<string, string>, existingLogin?: string): Promise<string>;
logout(session: vscode.AuthenticationSession): Promise<void>;
getUserInfo(token: string): Promise<{ id: string; accountName: string }>;
sendAdditionalTelemetryInfo(session: vscode.AuthenticationSession): Promise<void>;
Expand Down Expand Up @@ -87,7 +87,7 @@ export class GitHubServer implements IGitHubServer {
return this._isNoCorsEnvironment;
}

public async login(scopes: string, signInProvider?: GitHubSocialSignInProvider, existingLogin?: string): Promise<string> {
public async login(scopes: string, signInProvider?: GitHubSocialSignInProvider, extraAuthorizeParameters?: Record<string, string>, existingLogin?: string): Promise<string> {
this._logger.info(`Logging in for the following scopes: ${scopes}`);

// Used for showing a friendlier message to the user when the explicitly cancel a flow.
Expand Down Expand Up @@ -136,6 +136,7 @@ export class GitHubServer implements IGitHubServer {
callbackUri,
nonce,
signInProvider,
extraAuthorizeParameters,
baseUri: this.baseUri,
logger: this._logger,
uriHandler: this._uriHandler,
Expand Down
9 changes: 5 additions & 4 deletions extensions/javascript/snippets/javascript.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@
"prefix": "forin",
"body": [
"for (const ${1:key} in ${2:object}) {",
"\tif (Object.prototype.hasOwnProperty.call(${2:object}, ${1:key})) {",
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
"\t\t$TM_SELECTED_TEXT$0",
"\t}",
"\tif (!Object.hasOwn(${2:object}, ${1:key})) continue;",
"\t",
"\tconst ${3:element} = ${2:object}[${1:key}];",
"\t",
"\t$TM_SELECTED_TEXT$0",
"}"
],
"description": "For-In Loop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@
"prefix": "forin",
"body": [
"for (const ${1:key} in ${2:object}) {",
"\tif (Object.prototype.hasOwnProperty.call(${2:object}, ${1:key})) {",
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
"\t\t$TM_SELECTED_TEXT$0",
"\t}",
"\tif (!Object.hasOwn(${2:object}, ${1:key})) continue;",
"\t",
"\tconst ${3:element} = ${2:object}[${1:key}];",
"\t",
"\t$TM_SELECTED_TEXT$0",
"}"
],
"description": "For-In Loop"
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
private actionItem: HTMLElement | null = null;

private _onDidChangeVisibility = this._register(new Emitter<boolean>());
readonly onDidChangeVisibility = this._onDidChangeVisibility.event;
get onDidChangeVisibility() { return this._onDidChangeVisibility.event; }

protected override readonly options: IDropdownMenuActionViewItemOptions;

Expand Down
14 changes: 7 additions & 7 deletions src/vs/base/browser/ui/findinput/findInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ export class FindInput extends Widget {
public readonly inputBox: HistoryInputBox;

private readonly _onDidOptionChange = this._register(new Emitter<boolean>());
public readonly onDidOptionChange: Event<boolean /* via keyboard */> = this._onDidOptionChange.event;
public get onDidOptionChange(): Event<boolean /* via keyboard */> { return this._onDidOptionChange.event; }

private readonly _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
public readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
public get onKeyDown(): Event<IKeyboardEvent> { return this._onKeyDown.event; }

private readonly _onMouseDown = this._register(new Emitter<IMouseEvent>());
public readonly onMouseDown: Event<IMouseEvent> = this._onMouseDown.event;
public get onMouseDown(): Event<IMouseEvent> { return this._onMouseDown.event; }

private readonly _onInput = this._register(new Emitter<void>());
public readonly onInput: Event<void> = this._onInput.event;
public get onInput(): Event<void> { return this._onInput.event; }

private readonly _onKeyUp = this._register(new Emitter<IKeyboardEvent>());
public readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
public get onKeyUp(): Event<IKeyboardEvent> { return this._onKeyUp.event; }

private _onCaseSensitiveKeyDown = this._register(new Emitter<IKeyboardEvent>());
public readonly onCaseSensitiveKeyDown: Event<IKeyboardEvent> = this._onCaseSensitiveKeyDown.event;
public get onCaseSensitiveKeyDown(): Event<IKeyboardEvent> { return this._onCaseSensitiveKeyDown.event; }

private _onRegexKeyDown = this._register(new Emitter<IKeyboardEvent>());
public readonly onRegexKeyDown: Event<IKeyboardEvent> = this._onRegexKeyDown.event;
public get onRegexKeyDown(): Event<IKeyboardEvent> { return this._onRegexKeyDown.event; }

constructor(parent: HTMLElement | null, contextViewProvider: IContextViewProvider | undefined, options: IFindInputOptions) {
super();
Expand Down
12 changes: 6 additions & 6 deletions src/vs/base/browser/ui/findinput/replaceInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ export class ReplaceInput extends Widget {
public inputBox: HistoryInputBox;

private readonly _onDidOptionChange = this._register(new Emitter<boolean>());
public readonly onDidOptionChange: Event<boolean /* via keyboard */> = this._onDidOptionChange.event;
public get onDidOptionChange(): Event<boolean /* via keyboard */> { return this._onDidOptionChange.event; }

private readonly _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
public readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
public get onKeyDown(): Event<IKeyboardEvent> { return this._onKeyDown.event; }

private readonly _onMouseDown = this._register(new Emitter<IMouseEvent>());
public readonly onMouseDown: Event<IMouseEvent> = this._onMouseDown.event;
public get onMouseDown(): Event<IMouseEvent> { return this._onMouseDown.event; }

private readonly _onInput = this._register(new Emitter<void>());
public readonly onInput: Event<void> = this._onInput.event;
public get onInput(): Event<void> { return this._onInput.event; }

private readonly _onKeyUp = this._register(new Emitter<IKeyboardEvent>());
public readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
public get onKeyUp(): Event<IKeyboardEvent> { return this._onKeyUp.event; }

private _onPreserveCaseKeyDown = this._register(new Emitter<IKeyboardEvent>());
public readonly onPreserveCaseKeyDown: Event<IKeyboardEvent> = this._onPreserveCaseKeyDown.event;
public get onPreserveCaseKeyDown(): Event<IKeyboardEvent> { return this._onPreserveCaseKeyDown.event; }

constructor(parent: HTMLElement | null, contextViewProvider: IContextViewProvider | undefined, private readonly _showOptionButtons: boolean, options: IReplaceInputOptions) {
super();
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/inputbox/inputBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ export class InputBox extends Widget {
private readonly hover: MutableDisposable<IDisposable> = this._register(new MutableDisposable());

private _onDidChange = this._register(new Emitter<string>());
public readonly onDidChange: Event<string> = this._onDidChange.event;
public get onDidChange(): Event<string> { return this._onDidChange.event; }

private _onDidHeightChange = this._register(new Emitter<number>());
public readonly onDidHeightChange: Event<number> = this._onDidHeightChange.event;
public get onDidHeightChange(): Event<number> { return this._onDidHeightChange.event; }

constructor(container: HTMLElement, contextViewProvider: IContextViewProvider | undefined, options: IInputOptions) {
super();
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Trait<T> implements ISpliceable<boolean>, IDisposable {
protected sortedIndexes: number[] = [];

private readonly _onChange = new Emitter<ITraitChangeEvent>();
readonly onChange: Event<ITraitChangeEvent> = this._onChange.event;
get onChange(): Event<ITraitChangeEvent> { return this._onChange.event; }

get name(): string { return this._trait; }

Expand Down Expand Up @@ -676,7 +676,7 @@ export class MouseController<T> implements IDisposable {
private readonly disposables = new DisposableStore();

private readonly _onPointer = this.disposables.add(new Emitter<IListMouseEvent<T>>());
readonly onPointer: Event<IListMouseEvent<T>> = this._onPointer.event;
get onPointer() { return this._onPointer.event; }

constructor(protected list: List<T>) {
if (list.options.multipleSelectionSupport !== false) {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/scrollbar/scrollableElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ export abstract class AbstractScrollableElement extends Widget {
private _inertialSpeed: { X: number; Y: number } = { X: 0, Y: 0 };

private readonly _onScroll = this._register(new Emitter<ScrollEvent>());
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
public get onScroll(): Event<ScrollEvent> { return this._onScroll.event; }

private readonly _onWillScroll = this._register(new Emitter<ScrollEvent>());
public readonly onWillScroll: Event<ScrollEvent> = this._onWillScroll.event;
public get onWillScroll(): Event<ScrollEvent> { return this._onWillScroll.event; }

public get options(): Readonly<ScrollableElementResolvedOptions> {
return this._options;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/toggle/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ export class ToggleActionViewItem extends BaseActionViewItem {
export class Toggle extends Widget {

private readonly _onChange = this._register(new Emitter<boolean>());
readonly onChange: Event<boolean /* via keyboard */> = this._onChange.event;
get onChange(): Event<boolean /* via keyboard */> { return this._onChange.event; }

private readonly _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
get onKeyDown(): Event<IKeyboardEvent> { return this._onKeyDown.event; }

private readonly _opts: IToggleOpts;
private _icon: ThemeIcon | undefined;
Expand Down
1 change: 0 additions & 1 deletion src/vs/base/browser/ui/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class ToolBar extends Disposable {

private _onDidChangeDropdownVisibility = this._register(new EventMultiplexer<boolean>());
get onDidChangeDropdownVisibility() { return this._onDidChangeDropdownVisibility.event; }

private readonly disposables = this._register(new DisposableStore());

constructor(container: HTMLElement, contextMenuProvider: IContextMenuProvider, options: IToolBarOptions = { orientation: ActionsOrientation.HORIZONTAL }) {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/languageFeatureRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class LanguageFeatureRegistry<T> {
private readonly _entries: Entry<T>[] = [];

private readonly _onDidChange = new Emitter<number>();
readonly onDidChange = this._onDidChange.event;
get onDidChange() { return this._onDidChange.event; }

constructor(private readonly _notebookInfoResolver?: NotebookInfoResolver) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PieceTreeTextBuffer extends Disposable implements ITextBuffer {
private _mightContainNonBasicASCII: boolean;

private readonly _onDidChangeContent: Emitter<void> = this._register(new Emitter<void>());
public readonly onDidChangeContent: Event<void> = this._onDidChangeContent.event;
public get onDidChangeContent(): Event<void> { return this._onDidChangeContent.event; }

constructor(chunks: StringBuffer[], BOM: string, eol: '\r\n' | '\n', containsRTL: boolean, containsUnusualLineTerminators: boolean, isBasicASCII: boolean, eolNormalized: boolean) {
super();
Expand Down
8 changes: 4 additions & 4 deletions src/vs/editor/common/model/textModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,18 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }

private readonly _onDidChangeOptions: Emitter<IModelOptionsChangedEvent> = this._register(new Emitter<IModelOptionsChangedEvent>());
public readonly onDidChangeOptions: Event<IModelOptionsChangedEvent> = this._onDidChangeOptions.event;
public get onDidChangeOptions(): Event<IModelOptionsChangedEvent> { return this._onDidChangeOptions.event; }

private readonly _onDidChangeAttached: Emitter<void> = this._register(new Emitter<void>());
public readonly onDidChangeAttached: Event<void> = this._onDidChangeAttached.event;
public get onDidChangeAttached(): Event<void> { return this._onDidChangeAttached.event; }

private readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());

private readonly _onDidChangeLineHeight: Emitter<ModelLineHeightChangedEvent> = this._register(new Emitter<ModelLineHeightChangedEvent>());
public readonly onDidChangeLineHeight: Event<ModelLineHeightChangedEvent> = this._onDidChangeLineHeight.event;
public get onDidChangeLineHeight(): Event<ModelLineHeightChangedEvent> { return this._onDidChangeLineHeight.event; }

private readonly _onDidChangeFont: Emitter<ModelFontChangedEvent> = this._register(new Emitter<ModelFontChangedEvent>());
public readonly onDidChangeFont: Event<ModelFontChangedEvent> = this._onDidChangeFont.event;
public get onDidChangeFont(): Event<ModelFontChangedEvent> { return this._onDidChangeFont.event; }

private readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());
public onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/folding/browser/folding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export class RangesLimitReporter extends Disposable implements FoldingLimitRepor
}

private _onDidChange = this._register(new Emitter<void>());
public readonly onDidChange: Event<void> = this._onDidChange.event;
public get onDidChange(): Event<void> { return this._onDidChange.event; }

private _computed: number = 0;
private _limited: number | false = false;
Expand Down
Loading
Loading