Skip to content

Commit

Permalink
Merge branch 'main' into merogge/normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Feb 6, 2025
2 parents bfe15c6 + cf46a56 commit fdb43cc
Show file tree
Hide file tree
Showing 238 changed files with 4,878 additions and 1,396 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Next: **[Try it out!](#try-it)**

You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer][def]. Here's how to do it.

1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).

> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
Expand Down
6 changes: 3 additions & 3 deletions .github/classifier.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@
"sash-widget": {"assign": ["joaomoreno"]},
"scm": {"assign": ["lszomoru"]},
"screencast-mode": {"assign": ["joaomoreno"]},
"search": {"assign": ["roblourens"]},
"search-api": {"assign": ["roblourens"]},
"search-editor": {"assign": ["roblourens"]},
"search": {"assign": ["osortega"]},
"search-api": {"assign": ["osortega"]},
"search-editor": {"assign": ["osortega"]},
"search-replace": {"assign": ["sandy081"]},
"semantic-tokens": {"assign": ["alexdima", "aeschli"]},
"server": {"assign": ["alexdima"]},
Expand Down
2 changes: 1 addition & 1 deletion build/gulpfile.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
importIgnorePattern: /\.css$/,
destRoot: path.join(root, 'out-editor-src'),
redirects: {
'@vscode/tree-sitter-wasm': '../node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter-web',
'@vscode/tree-sitter-wasm': '../node_modules/@vscode/tree-sitter-wasm/wasm/web-tree-sitter',
}
});
});
Expand Down
6 changes: 0 additions & 6 deletions cli/src/commands/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ pub struct ServeWebArgs {
/// Specifies the directory that server data is kept in.
#[clap(long)]
pub server_data_dir: Option<String>,
/// Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.
#[clap(long)]
pub user_data_dir: Option<String>,
/// Set the root path for extensions.
#[clap(long)]
pub extensions_dir: Option<String>,
}

#[derive(Args, Debug, Clone)]
Expand Down
8 changes: 0 additions & 8 deletions cli/src/commands/serve_web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,6 @@ impl ConnectionManager {
cmd.arg("--server-data-dir");
cmd.arg(a);
}
if let Some(a) = &args.args.user_data_dir {
cmd.arg("--user-data-dir");
cmd.arg(a);
}
if let Some(a) = &args.args.extensions_dir {
cmd.arg("--extensions-dir");
cmd.arg(a);
}
if args.args.without_connection_token {
cmd.arg("--without-connection-token");
}
Expand Down
1 change: 0 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export default tseslint.config(
{
// Files should (only) be removed from the list they adopt the leak detector
'exclude': [
'src/vs/editor/contrib/codeAction/test/browser/codeActionModel.test.ts',
'src/vs/platform/configuration/test/common/configuration.test.ts',
'src/vs/platform/opener/test/common/opener.test.ts',
'src/vs/platform/registry/test/common/platform.test.ts',
Expand Down
16 changes: 15 additions & 1 deletion extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@
"category": "Git",
"enablement": "!operationInProgress"
},
{
"command": "git.deleteRemoteBranch",
"title": "%command.deleteRemoteBranch%",
"category": "Git",
"enablement": "!operationInProgress"
},
{
"command": "git.renameBranch",
"title": "%command.renameBranch%",
Expand Down Expand Up @@ -1224,6 +1230,10 @@
"command": "git.deleteBranch",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
},
{
"command": "git.deleteRemoteBranch",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
},
{
"command": "git.renameBranch",
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
Expand Down Expand Up @@ -2066,7 +2076,7 @@
},
{
"command": "git.graph.deleteBranch",
"when": "scmProvider == git && scmHistoryItemRef =~ /^refs\\/heads\\//",
"when": "scmProvider == git && scmHistoryItemRef =~ /^refs\\/heads\\/|^refs\\/remotes\\//",
"group": "2_branch@2"
},
{
Expand Down Expand Up @@ -2437,6 +2447,10 @@
"command": "git.deleteBranch",
"group": "3_modify@2"
},
{
"command": "git.deleteRemoteBranch",
"group": "3_modify@3"
},
{
"command": "git.publish",
"group": "4_publish@1"
Expand Down
1 change: 1 addition & 0 deletions extensions/git/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"command.branch": "Create Branch...",
"command.branchFrom": "Create Branch From...",
"command.deleteBranch": "Delete Branch...",
"command.deleteRemoteBranch": "Delete Remote Branch...",
"command.renameBranch": "Rename Branch...",
"command.cherryPick": "Cherry Pick...",
"command.cherryPickAbort": "Abort Cherry Pick",
Expand Down
81 changes: 69 additions & 12 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ class CheckoutTagItem extends RefItem {
class BranchDeleteItem extends RefItem {

async run(repository: Repository, force?: boolean): Promise<void> {
if (this.ref.name) {
await repository.deleteBranch(this.ref.name, force);
if (this.ref.type === RefType.Head && this.refName) {
await repository.deleteBranch(this.refName, force);
} else if (this.ref.type === RefType.RemoteHead && this.refRemote && this.refName) {
const refName = this.refName.substring(this.refRemote.length + 1);
await repository.deleteRemoteRef(this.refRemote, refName, { force });
}
}
}
Expand All @@ -178,7 +181,7 @@ class RemoteTagDeleteItem extends RefItem {

async run(repository: Repository, remote: string): Promise<void> {
if (this.ref.name) {
await repository.deleteRemoteTag(remote, this.ref.name);
await repository.deleteRemoteRef(remote, this.ref.name);
}
}
}
Expand Down Expand Up @@ -2883,7 +2886,7 @@ export class CommandCenter {

@command('git.deleteBranch', { repository: true })
async deleteBranch(repository: Repository, name: string | undefined, force?: boolean): Promise<void> {
await this._deleteBranch(repository, name, force);
await this._deleteBranch(repository, undefined, name, { remote: false, force });
}

@command('git.graph.deleteBranch', { repository: true })
Expand All @@ -2893,22 +2896,76 @@ export class CommandCenter {
return;
}

await this._deleteBranch(repository, historyItemRef.name);
// Local branch
if (historyItemRef.id.startsWith('refs/heads/')) {
if (historyItemRef.id === repository.historyProvider.currentHistoryItemRef?.id) {
window.showInformationMessage(l10n.t('The active branch cannot be deleted.'));
return;
}

await this._deleteBranch(repository, undefined, historyItemRef.name, { remote: false });
return;
}

// Remote branch
if (historyItemRef.id === repository.historyProvider.currentHistoryItemRemoteRef?.id) {
window.showInformationMessage(l10n.t('The remote branch of the active branch cannot be deleted.'));
return;
}

const index = historyItemRef.name.indexOf('/');
if (index === -1) {
return;
}

const remoteName = historyItemRef.name.substring(0, index);
const refName = historyItemRef.name.substring(index + 1);

await this._deleteBranch(repository, remoteName, refName, { remote: true });
}

@command('git.deleteRemoteBranch', { repository: true })
async deleteRemoteBranch(repository: Repository): Promise<void> {
await this._deleteBranch(repository, undefined, undefined, { remote: true });
}

private async _deleteBranch(repository: Repository, name: string | undefined, force?: boolean): Promise<void> {
private async _deleteBranch(repository: Repository, remote: string | undefined, name: string | undefined, options: { remote: boolean; force?: boolean }): Promise<void> {
let run: (force?: boolean) => Promise<void>;
if (typeof name === 'string') {

if (!options.remote && typeof name === 'string') {
// Local branch
run = force => repository.deleteBranch(name!, force);
} else if (options.remote && typeof remote === 'string' && typeof name === 'string') {
// Remote branch
run = force => repository.deleteRemoteRef(remote, name!, { force });
} else {
const getBranchPicks = async () => {
const refs = await repository.getRefs({ pattern: 'refs/heads' });
const currentHead = repository.HEAD && repository.HEAD.name;
const pattern = options.remote ? 'refs/remotes' : 'refs/heads';
const refs = await repository.getRefs({ pattern });

const refsToExclude: string[] = [];
if (options.remote) {
refsToExclude.push('origin/HEAD');

return refs.filter(ref => ref.name !== currentHead).map(ref => new BranchDeleteItem(ref));
if (repository.HEAD?.upstream) {
// Current branch's upstream
refsToExclude.push(`${repository.HEAD.upstream.remote}/${repository.HEAD.upstream.name}`);
}
} else {
if (repository.HEAD?.name) {
// Current branch
refsToExclude.push(repository.HEAD.name);
}
}

return refs.filter(ref => ref.name && !refsToExclude.includes(ref.name))
.map(ref => new BranchDeleteItem(ref));
};

const placeHolder = l10n.t('Select a branch to delete');
const placeHolder = !options.remote
? l10n.t('Select a branch to delete')
: l10n.t('Select a remote branch to delete');

const choice = await this.pickRef<BranchDeleteItem>(getBranchPicks(), placeHolder);

if (!choice || !choice.refName) {
Expand All @@ -2919,7 +2976,7 @@ export class CommandCenter {
}

try {
await run(force);
await run(options.force);
} catch (err) {
if (err.gitErrorCode !== GitErrorCodes.BranchNotFullyMerged) {
throw err;
Expand Down
12 changes: 9 additions & 3 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1927,8 +1927,14 @@ export class Repository {
await this.exec(args);
}

async deleteRemoteTag(remoteName: string, tagName: string): Promise<void> {
const args = ['push', '--delete', remoteName, tagName];
async deleteRemoteRef(remoteName: string, refName: string, options?: { force?: boolean }): Promise<void> {
const args = ['push', remoteName, '--delete'];

if (options?.force) {
args.push('--force');
}

args.push(refName);
await this.exec(args);
}

Expand Down Expand Up @@ -2753,7 +2759,7 @@ export class Repository {
return {
type: RefType.Head,
name: branchName,
upstream: upstream ? {
upstream: upstream !== '' && status !== '[gone]' ? {
name: upstreamRef ? upstreamRef.substring(11) : upstream.substring(index + 1),
remote: remoteName ? remoteName : upstream.substring(0, index)
} : undefined,
Expand Down
8 changes: 4 additions & 4 deletions extensions/git/src/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const enum OperationKind {
Config = 'Config',
DeleteBranch = 'DeleteBranch',
DeleteRef = 'DeleteRef',
DeleteRemoteTag = 'DeleteRemoteTag',
DeleteRemoteRef = 'DeleteRemoteRef',
DeleteTag = 'DeleteTag',
Diff = 'Diff',
Fetch = 'Fetch',
Expand Down Expand Up @@ -67,7 +67,7 @@ export const enum OperationKind {

export type Operation = AddOperation | ApplyOperation | BlameOperation | BranchOperation | CheckIgnoreOperation | CherryPickOperation |
CheckoutOperation | CheckoutTrackingOperation | CleanOperation | CommitOperation | ConfigOperation | DeleteBranchOperation |
DeleteRefOperation | DeleteRemoteTagOperation | DeleteTagOperation | DiffOperation | FetchOperation | FindTrackingBranchesOperation |
DeleteRefOperation | DeleteRemoteRefOperation | DeleteTagOperation | DiffOperation | FetchOperation | FindTrackingBranchesOperation |
GetBranchOperation | GetBranchesOperation | GetCommitTemplateOperation | GetObjectDetailsOperation | GetObjectFilesOperation | GetRefsOperation |
GetRemoteRefsOperation | HashObjectOperation | IgnoreOperation | LogOperation | LogFileOperation | MergeOperation | MergeAbortOperation |
MergeBaseOperation | MergeContinueOperation | MoveOperation | PostCommitCommandOperation | PullOperation | PushOperation | RemoteOperation |
Expand All @@ -89,7 +89,7 @@ export type CommitOperation = BaseOperation & { kind: OperationKind.Commit };
export type ConfigOperation = BaseOperation & { kind: OperationKind.Config };
export type DeleteBranchOperation = BaseOperation & { kind: OperationKind.DeleteBranch };
export type DeleteRefOperation = BaseOperation & { kind: OperationKind.DeleteRef };
export type DeleteRemoteTagOperation = BaseOperation & { kind: OperationKind.DeleteRemoteTag };
export type DeleteRemoteRefOperation = BaseOperation & { kind: OperationKind.DeleteRemoteRef };
export type DeleteTagOperation = BaseOperation & { kind: OperationKind.DeleteTag };
export type DiffOperation = BaseOperation & { kind: OperationKind.Diff };
export type FetchOperation = BaseOperation & { kind: OperationKind.Fetch };
Expand Down Expand Up @@ -147,7 +147,7 @@ export const Operation = {
Config: (readOnly: boolean) => ({ kind: OperationKind.Config, blocking: false, readOnly, remote: false, retry: false, showProgress: false } as ConfigOperation),
DeleteBranch: { kind: OperationKind.DeleteBranch, blocking: false, readOnly: false, remote: false, retry: false, showProgress: true } as DeleteBranchOperation,
DeleteRef: { kind: OperationKind.DeleteRef, blocking: false, readOnly: false, remote: false, retry: false, showProgress: true } as DeleteRefOperation,
DeleteRemoteTag: { kind: OperationKind.DeleteRemoteTag, blocking: false, readOnly: false, remote: true, retry: false, showProgress: true } as DeleteRemoteTagOperation,
DeleteRemoteRef: { kind: OperationKind.DeleteRemoteRef, blocking: false, readOnly: false, remote: true, retry: false, showProgress: true } as DeleteRemoteRefOperation,
DeleteTag: { kind: OperationKind.DeleteTag, blocking: false, readOnly: false, remote: false, retry: false, showProgress: true } as DeleteTagOperation,
Diff: { kind: OperationKind.Diff, blocking: false, readOnly: true, remote: false, retry: false, showProgress: false } as DiffOperation,
Fetch: (showProgress: boolean) => ({ kind: OperationKind.Fetch, blocking: false, readOnly: false, remote: true, retry: true, showProgress } as FetchOperation),
Expand Down
4 changes: 2 additions & 2 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,8 @@ export class Repository implements Disposable {
await this.run(Operation.DeleteTag, () => this.repository.deleteTag(name));
}

async deleteRemoteTag(remoteName: string, tagName: string): Promise<void> {
await this.run(Operation.DeleteRemoteTag, () => this.repository.deleteRemoteTag(remoteName, tagName));
async deleteRemoteRef(remoteName: string, refName: string, options?: { force?: boolean }): Promise<void> {
await this.run(Operation.DeleteRemoteRef, () => this.repository.deleteRemoteRef(remoteName, refName, options));
}

async checkout(treeish: string, opts?: { detached?: boolean; pullBeforeCheckout?: boolean }): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion extensions/ipynb/src/notebookModelStoreSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const noop = () => {
};

/**
* Code here is used to ensure the Notebook Model is in sync the the ipynb JSON file.
* Code here is used to ensure the Notebook Model is in sync the ipynb JSON file.
* E.g. assume you add a new cell, this new cell will not have any metadata at all.
* However when we save the ipynb, the metadata will be an empty object `{}`.
* Now thats completely different from the metadata os being `empty/undefined` in the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import * as vscode from 'vscode';
import { Utils } from 'vscode-uri';
import { Command } from '../commandManager';
import { createUriListSnippet, linkEditKind, mediaFileExtensions } from '../languageFeatures/copyFiles/shared';
import { createUriListSnippet, linkEditKind } from '../languageFeatures/copyFiles/shared';
import { mediaFileExtensions } from '../util/mimes';
import { coalesce } from '../util/arrays';
import { getParentDocumentUri } from '../util/document';
import { Schemes } from '../util/schemes';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import * as vscode from 'vscode';
import { IMdParser } from '../../markdownEngine';
import { coalesce } from '../../util/arrays';
import { getParentDocumentUri } from '../../util/document';
import { Mime, mediaMimes } from '../../util/mimes';
import { getMediaKindForMime, MediaKind, Mime, rootMediaMimesTypes } from '../../util/mimes';
import { Schemes } from '../../util/schemes';
import { UriList } from '../../util/uriList';
import { NewFilePathGenerator } from './newFilePathGenerator';
import { DropOrPasteEdit, createInsertUriListEdit, createUriListSnippet, getSnippetLabelAndKind, baseLinkEditKind, linkEditKind, audioEditKind, videoEditKind, imageEditKind } from './shared';
import { audioEditKind, baseLinkEditKind, createInsertUriListEdit, createUriListSnippet, DropOrPasteEdit, getSnippetLabelAndKind, imageEditKind, linkEditKind, videoEditKind } from './shared';
import { InsertMarkdownLink, shouldInsertMarkdownLinkByDefault } from './smartDropOrPaste';
import { UriList } from '../../util/uriList';

enum CopyFilesSettings {
Never = 'never',
Expand All @@ -33,7 +33,7 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v
public static readonly mimeTypes = [
Mime.textUriList,
'files',
...mediaMimes,
...Object.values(rootMediaMimesTypes).map(type => `${type}/*`),
];

private readonly _yieldTo = [
Expand Down Expand Up @@ -206,12 +206,14 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v

interface FileEntry {
readonly uri: vscode.Uri;
readonly kind: MediaKind;
readonly newFile?: { readonly contents: vscode.DataTransferFile; readonly overwrite: boolean };
}

const pathGenerator = new NewFilePathGenerator();
const fileEntries = coalesce(await Promise.all(Array.from(dataTransfer, async ([mime, item]): Promise<FileEntry | undefined> => {
if (!mediaMimes.has(mime)) {
const mediaKind = getMediaKindForMime(mime);
if (!mediaKind) {
return;
}

Expand All @@ -224,15 +226,15 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v
// If the file is already in a workspace, we don't want to create a copy of it
const workspaceFolder = vscode.workspace.getWorkspaceFolder(file.uri);
if (workspaceFolder) {
return { uri: file.uri };
return { uri: file.uri, kind: mediaKind };
}
}

const newFile = await pathGenerator.getNewFilePath(document, file, token);
if (!newFile) {
return;
}
return { uri: newFile.uri, newFile: { contents: file, overwrite: newFile.overwrite } };
return { uri: newFile.uri, kind: mediaKind, newFile: { contents: file, overwrite: newFile.overwrite } };
})));
if (!fileEntries.length) {
return;
Expand Down
Loading

0 comments on commit fdb43cc

Please sign in to comment.