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 extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"contribSourceControlTitleMenu",
"contribViewsWelcome",
"editSessionIdentityProvider",
"findFiles2",
"quickDiffProvider",
"quickPickSortByLabel",
"scmActionButton",
Expand Down
89 changes: 28 additions & 61 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as fs from 'fs';
import * as fsPromises from 'fs/promises';
import * as path from 'path';
import picomatch from 'picomatch';
import { CancellationError, CancellationToken, CancellationTokenSource, Command, commands, Disposable, Event, EventEmitter, FileDecoration, FileType, l10n, LogLevel, LogOutputChannel, Memento, ProgressLocation, ProgressOptions, QuickDiffProvider, RelativePattern, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, TabInputNotebookDiff, TabInputTextDiff, TabInputTextMultiDiff, ThemeColor, ThemeIcon, Uri, window, workspace, WorkspaceEdit } from 'vscode';
import { CancellationError, CancellationToken, CancellationTokenSource, Command, commands, Disposable, Event, EventEmitter, ExcludeSettingOptions, FileDecoration, FileType, l10n, LogLevel, LogOutputChannel, Memento, ProgressLocation, ProgressOptions, QuickDiffProvider, RelativePattern, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, TabInputNotebookDiff, TabInputTextDiff, TabInputTextMultiDiff, ThemeColor, ThemeIcon, Uri, window, workspace, WorkspaceEdit } from 'vscode';
import { ActionButton } from './actionButton';
import { ApiRepository } from './api/api1';
import { Branch, BranchQuery, Change, CommitOptions, DiffChange, FetchOptions, ForcePushMode, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status } from './api/git';
Expand Down Expand Up @@ -1896,62 +1896,28 @@ export class Repository implements Disposable {
return new Set<string>();
}

try {
// Expand the glob patterns
const matchedFiles = new Set<string>();
for (const pattern of worktreeIncludeFiles) {
for await (const file of fsPromises.glob(pattern, { cwd: this.root })) {
matchedFiles.add(file);
}
}

// Collect unique directories from all the matched files. Check
// first whether directories are ignored in order to limit the
// number of git check-ignore calls.
const directoriesToCheck = new Set<string>();
for (const file of matchedFiles) {
let parent = path.dirname(file);
while (parent && parent !== '.') {
directoriesToCheck.add(path.join(this.root, parent));
parent = path.dirname(parent);
}
}

const gitIgnoredDirectories = await this.checkIgnore(Array.from(directoriesToCheck));

// Files under a git ignored directory are ignored
const gitIgnoredFiles = new Set<string>();
const filesToCheck: string[] = [];

for (const file of matchedFiles) {
const fullPath = path.join(this.root, file);
let parent = path.dirname(fullPath);
let isUnderIgnoredDir = false;

while (parent !== this.root && parent.length > this.root.length) {
if (gitIgnoredDirectories.has(parent)) {
isUnderIgnoredDir = true;
break;
}
parent = path.dirname(parent);
}
const filePattern = worktreeIncludeFiles
.map(pattern => new RelativePattern(this.root, pattern));

if (isUnderIgnoredDir) {
gitIgnoredFiles.add(fullPath);
} else {
filesToCheck.push(fullPath);
}
}
// Get all files matching the globs (no ignore files applied)
const allFiles = await workspace.findFiles2(filePattern, {
useExcludeSettings: ExcludeSettingOptions.None,
useIgnoreFiles: { local: false, parent: false, global: false }
});

// Check the files that are not under a git ignored directories
const filesToCheckResults = await this.checkIgnore(Array.from(filesToCheck));
filesToCheckResults.forEach(ignoredFile => gitIgnoredFiles.add(ignoredFile));
// Get files matching the globs with git ignore files applied
const nonIgnoredFiles = await workspace.findFiles2(filePattern, {
useExcludeSettings: ExcludeSettingOptions.None,
useIgnoreFiles: { local: true, parent: true, global: true }
});

return gitIgnoredFiles;
} catch (err) {
this.logger.warn(`[Repository][_getWorktreeIncludeFiles] Failed to get worktree include files: ${err}`);
return new Set<string>();
// Files that are git ignored = all files - non-ignored files
const gitIgnoredFiles = new Set(allFiles.map(uri => uri.fsPath));
for (const uri of nonIgnoredFiles) {
gitIgnoredFiles.delete(uri.fsPath);
}

return gitIgnoredFiles;
}

private async _copyWorktreeIncludeFiles(worktreePath: string): Promise<void> {
Expand Down Expand Up @@ -1990,15 +1956,16 @@ export class Repository implements Disposable {
));
});

// When expanding the glob patterns, both directories and files are matched however
// directories cannot be copied so we filter out `ERR_FS_EISDIR` errors as those are
// expected.
const errors = results.filter(r => r.status === 'rejected' &&
(r.reason as NodeJS.ErrnoException).code !== 'ERR_FS_EISDIR');
// Log any failed operations
const failedOperations = results.filter(r => r.status === 'rejected');

if (errors.length > 0) {
this.logger.warn(`[Repository][_copyWorktreeIncludeFiles] Failed to copy ${errors.length} files to worktree.`);
window.showWarningMessage(l10n.t('Failed to copy {0} files to the worktree.', errors.length));
if (failedOperations.length > 0) {
window.showWarningMessage(l10n.t('Failed to copy {0} files to the worktree.', failedOperations.length));

this.logger.warn(`[Repository][_copyWorktreeIncludeFiles] Failed to copy ${failedOperations.length} files to worktree.`);
for (const error of failedOperations) {
this.logger.warn(` - ${(error as PromiseRejectedResult).reason}`);
}
}
} catch (err) {
this.logger.warn(`[Repository][_copyWorktreeIncludeFiles] Failed to copy files to worktree: ${err}`);
Expand Down
1 change: 1 addition & 0 deletions extensions/git/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.findFiles2.d.ts",
"../../src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts",
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.109.0",
"distro": "276abacfc6a1d1a9d17ab0d7d7cb4775998082b2",
"distro": "9ac7c0b1d7f8b73f10dc974777bccc7b55ee60d4",
"author": {
"name": "Microsoft Corporation"
},
Expand Down Expand Up @@ -109,7 +109,7 @@
"native-is-elevated": "0.8.0",
"native-keymap": "^3.3.5",
"native-watchdog": "^1.4.1",
"node-pty": "^1.2.0-beta.3",
"node-pty": "^1.1.0-beta43",
"open": "^10.1.2",
"tas-client": "0.3.1",
"undici": "^7.9.0",
Expand Down
14 changes: 7 additions & 7 deletions remote/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"kerberos": "2.1.1",
"minimist": "^1.2.8",
"native-watchdog": "^1.4.1",
"node-pty": "^1.2.0-beta.3",
"node-pty": "^1.1.0-beta43",
"tas-client": "0.3.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
Expand Down
9 changes: 9 additions & 0 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.whenReadyPromise.complete();

Promises.settled(layoutRestoredPromises).finally(() => {
if (
this.editorService.editors.length === 0 && // no editors opened or restored
this.isVisible(Parts.AUXILIARYBAR_PART) && // auxiliary bar is visible
!this.hasFocus(Parts.AUXILIARYBAR_PART) && // auxiliary bar does not have focus yet
!this.environmentService.enableSmokeTestDriver // not in smoke test mode (where focus is sensitive)
) {
this.focusPart(Parts.AUXILIARYBAR_PART);
}

this.restored = true;
this.whenRestoredPromise.complete();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import * as DOM from '../../../../../base/browser/dom.js';
import { Button, IButtonOptions } from '../../../../../base/browser/ui/button/button.js';
import { ThemeIcon } from '../../../../../base/common/themables.js';
import { ILanguageModelsService, IUserFriendlyLanguageModel } from '../../../chat/common/languageModels.js';
import { ILanguageModelsConfigurationService } from '../../common/languageModelsConfiguration.js';
import { localize } from '../../../../../nls.js';
import { defaultButtonStyles } from '../../../../../platform/theme/browser/defaultStyles.js';
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
Expand Down Expand Up @@ -712,7 +711,6 @@ class ActionsColumnRenderer extends ModelsTableColumnRenderer<IActionsColumnTemp
private readonly viewModel: ChatModelsViewModel,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ILanguageModelsService private readonly languageModelsService: ILanguageModelsService,
@ILanguageModelsConfigurationService private readonly languageModelsConfigurationService: ILanguageModelsConfigurationService,
@IDialogService private readonly dialogService: IDialogService,
@ICommandService private readonly commandService: ICommandService,
@IContextMenuService private readonly contextMenuService: IContextMenuService
Expand Down Expand Up @@ -770,7 +768,7 @@ class ActionsColumnRenderer extends ModelsTableColumnRenderer<IActionsColumnTemp
if (!result.confirmed) {
return;
}
await this.languageModelsConfigurationService.removeLanguageModelsProviderGroup(vendorEntry.group);
await this.languageModelsService.removeLanguageModelsProviderGroup(vendorEntry.vendor.vendor, vendorEntry.group.name);
}
}));
} else if (vendorEntry.vendor.managementCommand) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class LanguageModelsConfigurationService extends Disposable implements IL
@IUriIdentityService uriIdentityService: IUriIdentityService,
) {
super();
this.modelsConfigurationFile = uriIdentityService.extUri.joinPath(userDataProfileService.currentProfile.location, 'models.json');
this.modelsConfigurationFile = uriIdentityService.extUri.joinPath(userDataProfileService.currentProfile.location, 'chatLanguageModels.json');
this.updateLanguageModelsConfiguration();
this._register(fileService.watch(this.modelsConfigurationFile));
this._register(fileService.onDidFilesChange(e => {
Expand Down
Loading
Loading