Skip to content

Commit 53c1e16

Browse files
committed
Implement preview on highlighting quickpick in quick search
Fixes #191259
2 parents 142bf28 + 6d6bb58 commit 53c1e16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1599
-882
lines changed

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,5 @@
170170
},
171171
"css.format.spaceAroundSelectorSeparator": true,
172172
"inlineChat.mode": "live",
173+
"testing.defaultGutterClickAction": "runWithCoverage",
173174
}

cli/src/util/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ pub enum CodeError {
471471

472472
#[error("platform not currently supported: {0}")]
473473
UnsupportedPlatform(String),
474-
#[error("This machine not meet {name}'s prerequisites, expected either...: {bullets}")]
474+
#[error("This machine does not meet {name}'s prerequisites, expected either...: {bullets}")]
475475
PrerequisitesFailed { name: &'static str, bullets: String },
476476
#[error("failed to spawn process: {0:?}")]
477477
ProcessSpawnFailed(std::io::Error),

cli/src/util/prereqs.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ async fn check_glibc_version() -> Result<(), String> {
141141
Ok(())
142142
} else {
143143
Err(format!(
144-
"find GLIBC >= 2.17 (but found {} instead) for GNU environments",
145-
v
144+
"find GLIBC >= {} (but found {} instead) for GNU environments",
145+
*MIN_LDD_VERSION, v
146146
))
147147
};
148148
}
@@ -201,7 +201,8 @@ fn check_for_sufficient_glibcxx_versions(contents: Vec<u8>) -> Result<(), String
201201

202202
if !all_versions.iter().any(|v| &*MIN_CXX_VERSION >= v) {
203203
return Err(format!(
204-
"find GLIBCXX >= 3.4.18 (but found {} instead) for GNU environments",
204+
"find GLIBCXX >= {} (but found {} instead) for GNU environments",
205+
*MIN_CXX_VERSION,
205206
all_versions
206207
.iter()
207208
.map(String::from)

extensions/git/src/commands.ts

+17-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { RemoteSourceAction } from './api/git-base';
2323
abstract class CheckoutCommandItem implements QuickPickItem {
2424
abstract get label(): string;
2525
get description(): string { return ''; }
26-
get alwaysShow(): boolean { return true; }
26+
get alwaysShow(): boolean { return false; }
2727
}
2828

2929
class CreateBranchItem extends CheckoutCommandItem {
@@ -262,6 +262,14 @@ class RepositoryItem implements QuickPickItem {
262262
constructor(public readonly path: string) { }
263263
}
264264

265+
class StashItem implements QuickPickItem {
266+
get label(): string { return `#${this.stash.index}: ${this.stash.description}`; }
267+
268+
get description(): string | undefined { return this.stash.branchName; }
269+
270+
constructor(readonly stash: Stash) { }
271+
}
272+
265273
interface ScmCommandOptions {
266274
repository?: boolean;
267275
diff?: boolean;
@@ -3690,17 +3698,15 @@ export class CommandCenter {
36903698
}
36913699

36923700
private async pickStash(repository: Repository, placeHolder: string): Promise<Stash | undefined> {
3693-
const stashes = await repository.getStashes();
3694-
3695-
if (stashes.length === 0) {
3696-
window.showInformationMessage(l10n.t('There are no stashes in the repository.'));
3697-
return;
3698-
}
3699-
3700-
const picks = stashes.map(stash => ({ label: `#${stash.index}: ${stash.description}`, description: stash.branchName, stash }));
3701-
const result = await window.showQuickPick(picks, { placeHolder });
3701+
const getStashQuickPickItems = async (): Promise<StashItem[] | QuickPickItem[]> => {
3702+
const stashes = await repository.getStashes();
3703+
return stashes.length > 0 ?
3704+
stashes.map(stash => new StashItem(stash)) :
3705+
[{ label: l10n.t('$(info) This repository has no stashes.') }];
3706+
};
37023707

3703-
return result?.stash;
3708+
const result = await window.showQuickPick<StashItem | QuickPickItem>(getStashQuickPickItems(), { placeHolder });
3709+
return result instanceof StashItem ? result.stash : undefined;
37043710
}
37053711

37063712
private async getStashFromUri(uri: Uri | undefined): Promise<{ repository: Repository; stash: Stash } | undefined> {

extensions/git/src/repository.ts

+29-12
Original file line numberDiff line numberDiff line change
@@ -1475,33 +1475,35 @@ export class Repository implements Disposable {
14751475

14761476
async getBranchBase(ref: string): Promise<Branch | undefined> {
14771477
const branch = await this.getBranch(ref);
1478-
const branchMergeBaseConfigKey = `branch.${branch.name}.vscode-merge-base`;
1478+
const branchUpstream = await this.getUpstreamBranch(branch);
14791479

1480-
// Upstream
1481-
if (branch.upstream) {
1482-
return await this.getBranch(`refs/remotes/${branch.upstream.remote}/${branch.upstream.name}`);
1480+
if (branchUpstream) {
1481+
return branchUpstream;
14831482
}
14841483

14851484
// Git config
1485+
const mergeBaseConfigKey = `branch.${branch.name}.vscode-merge-base`;
1486+
14861487
try {
1487-
const mergeBase = await this.getConfig(branchMergeBaseConfigKey);
1488-
if (mergeBase !== '') {
1489-
const mergeBaseBranch = await this.getBranch(mergeBase);
1490-
return mergeBaseBranch;
1488+
const mergeBase = await this.getConfig(mergeBaseConfigKey);
1489+
const branchFromConfig = mergeBase !== '' ? await this.getBranch(mergeBase) : undefined;
1490+
if (branchFromConfig) {
1491+
return branchFromConfig;
14911492
}
14921493
} catch (err) { }
14931494

14941495
// Reflog
14951496
const branchFromReflog = await this.getBranchBaseFromReflog(ref);
1496-
if (branchFromReflog) {
1497-
await this.setConfig(branchMergeBaseConfigKey, branchFromReflog.name!);
1498-
return branchFromReflog;
1497+
const branchFromReflogUpstream = branchFromReflog ? await this.getUpstreamBranch(branchFromReflog) : undefined;
1498+
if (branchFromReflogUpstream) {
1499+
await this.setConfig(mergeBaseConfigKey, `${branchFromReflogUpstream.remote}/${branchFromReflogUpstream.name}`);
1500+
return branchFromReflogUpstream;
14991501
}
15001502

15011503
// Default branch
15021504
const defaultBranch = await this.getDefaultBranch();
15031505
if (defaultBranch) {
1504-
await this.setConfig(branchMergeBaseConfigKey, defaultBranch.name!);
1506+
await this.setConfig(mergeBaseConfigKey, `${defaultBranch.remote}/${defaultBranch.name}`);
15051507
return defaultBranch;
15061508
}
15071509

@@ -1552,6 +1554,21 @@ export class Repository implements Disposable {
15521554
return undefined;
15531555
}
15541556

1557+
private async getUpstreamBranch(branch: Branch): Promise<Branch | undefined> {
1558+
if (!branch.upstream) {
1559+
return undefined;
1560+
}
1561+
1562+
try {
1563+
const upstreamBranch = await this.getBranch(`refs/remotes/${branch.upstream.remote}/${branch.upstream.name}`);
1564+
return upstreamBranch;
1565+
}
1566+
catch (err) {
1567+
this.logger.warn(`Failed to get branch details for 'refs/remotes/${branch.upstream.remote}/${branch.upstream.name}': ${err.message}.`);
1568+
return undefined;
1569+
}
1570+
}
1571+
15551572
async getRefs(query: RefQuery = {}, cancellationToken?: CancellationToken): Promise<Ref[]> {
15561573
const config = workspace.getConfiguration('git');
15571574
let defaultSort = config.get<'alphabetically' | 'committerdate'>('branchSortOrder');

src/vs/platform/download/common/downloadIpc.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export class DownloadServiceChannelClient implements IDownloadService {
3232
constructor(private channel: IChannel, private getUriTransformer: () => IURITransformer | null) { }
3333

3434
async download(from: URI, to: URI): Promise<void> {
35-
const uriTransfomer = this.getUriTransformer();
36-
if (uriTransfomer) {
37-
from = uriTransfomer.transformOutgoingURI(from);
38-
to = uriTransfomer.transformOutgoingURI(to);
35+
const uriTransformer = this.getUriTransformer();
36+
if (uriTransformer) {
37+
from = uriTransformer.transformOutgoingURI(from);
38+
to = uriTransformer.transformOutgoingURI(to);
3939
}
4040
await this.channel.call('download', [from, to]);
4141
}

src/vs/workbench/browser/labels.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { localize } from 'vs/nls';
67
import { URI } from 'vs/base/common/uri';
78
import { dirname, isEqual, basenameOrAuthority } from 'vs/base/common/resources';
89
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
@@ -24,6 +25,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2425
import { normalizeDriveLetter } from 'vs/base/common/labels';
2526
import { IRange } from 'vs/editor/common/core/range';
2627
import { ThemeIcon } from 'vs/base/common/themables';
28+
import { INotebookDocumentService } from 'vs/workbench/services/notebook/common/notebookDocumentService';
2729

2830
export interface IResourceLabelProps {
2931
resource?: URI | { primary?: URI; secondary?: URI };
@@ -308,7 +310,8 @@ class ResourceLabelWidget extends IconLabel {
308310
@IDecorationsService private readonly decorationsService: IDecorationsService,
309311
@ILabelService private readonly labelService: ILabelService,
310312
@ITextFileService private readonly textFileService: ITextFileService,
311-
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
313+
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
314+
@INotebookDocumentService private readonly notebookDocumentService: INotebookDocumentService
312315
) {
313316
super(container, options);
314317
}
@@ -465,6 +468,21 @@ class ResourceLabelWidget extends IconLabel {
465468
}
466469
}
467470

471+
if (!options.forceLabel && !isSideBySideEditor && resource?.scheme === Schemas.vscodeNotebookCell) {
472+
// Notebook cells are embeded in a notebook document
473+
// As such we always ask the actual notebook document
474+
// for its position in the document.
475+
const notebookDocument = this.notebookDocumentService.getNotebook(resource);
476+
const cellIndex = notebookDocument?.getCellIndex(resource);
477+
if (notebookDocument && cellIndex !== undefined && typeof label.name === 'string') {
478+
options.title = localize('notebookCellLabel', "{0} • Cell {1}", label.name, `${cellIndex + 1}`);
479+
}
480+
481+
if (typeof label.name === 'string' && notebookDocument && cellIndex !== undefined && typeof label.name === 'string') {
482+
label.name = localize('notebookCellLabel', "{0} • Cell {1}", label.name, `${cellIndex + 1}`);
483+
}
484+
}
485+
468486
const hasResourceChanged = this.hasResourceChanged(label);
469487
const hasPathLabelChanged = hasResourceChanged || this.hasPathLabelChanged(label);
470488
const hasFileKindChanged = this.hasFileKindChanged(options);

src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2121
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
2222
import { IContentActionHandler, renderFormattedText } from 'vs/base/browser/formattedTextRenderer';
2323
import { ApplyFileSnippetAction } from 'vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets';
24-
import { IInlineChatSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
24+
import { IInlineChatSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
2525
import { IInlineChatService, IInlineChatSessionProvider } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
2626
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2727
import { WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from 'vs/base/common/actions';

src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts

-4
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,6 @@ function canToggleWordWrap(codeEditorService: ICodeEditorService, editor: ICodeE
241241
if (!model) {
242242
return false;
243243
}
244-
if (model.uri.scheme === 'output') {
245-
// in output editor
246-
return false;
247-
}
248244
if (editor.getOption(EditorOption.inDiffEditor)) {
249245
// this editor belongs to a diff editor
250246
for (const diffEditor of codeEditorService.listDiffEditors()) {

src/vs/workbench/contrib/comments/browser/comments.contribution.ts

+57-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import * as strings from 'vs/base/common/strings';
1414
import { AccessibilityVerbositySettingId, AccessibleViewProviderId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
1515
import { AccessibleViewType, IAccessibleContentProvider, IAccessibleViewOptions, IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView';
1616
import { AccessibilityHelpAction } from 'vs/workbench/contrib/accessibility/browser/accessibleViewActions';
17-
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
17+
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
1818
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1919
import { Disposable, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
2020
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -27,6 +27,62 @@ import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/co
2727
import { COMMENTS_VIEW_ID } from 'vs/workbench/contrib/comments/browser/commentsTreeViewer';
2828
import { CommentThreadState } from 'vs/editor/common/languages';
2929
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
30+
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
31+
import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
32+
import { MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
33+
import { CONTEXT_KEY_HAS_COMMENTS, CONTEXT_KEY_SOME_COMMENTS_EXPANDED, CommentsPanel } from 'vs/workbench/contrib/comments/browser/commentsView';
34+
import { ViewAction } from 'vs/workbench/browser/parts/views/viewPane';
35+
import { Codicon } from 'vs/base/common/codicons';
36+
37+
CommandsRegistry.registerCommand({
38+
id: 'workbench.action.focusCommentsPanel',
39+
handler: async (accessor) => {
40+
const viewsService = accessor.get(IViewsService);
41+
viewsService.openView(COMMENTS_VIEW_ID, true);
42+
}
43+
});
44+
45+
registerAction2(class Collapse extends ViewAction<CommentsPanel> {
46+
constructor() {
47+
super({
48+
viewId: COMMENTS_VIEW_ID,
49+
id: 'comments.collapse',
50+
title: nls.localize('collapseAll', "Collapse All"),
51+
f1: false,
52+
icon: Codicon.collapseAll,
53+
menu: {
54+
id: MenuId.ViewTitle,
55+
group: 'navigation',
56+
when: ContextKeyExpr.and(ContextKeyExpr.and(ContextKeyExpr.equals('view', COMMENTS_VIEW_ID), CONTEXT_KEY_HAS_COMMENTS), CONTEXT_KEY_SOME_COMMENTS_EXPANDED),
57+
order: 100
58+
}
59+
});
60+
}
61+
runInView(_accessor: ServicesAccessor, view: CommentsPanel) {
62+
view.collapseAll();
63+
}
64+
});
65+
66+
registerAction2(class Expand extends ViewAction<CommentsPanel> {
67+
constructor() {
68+
super({
69+
viewId: COMMENTS_VIEW_ID,
70+
id: 'comments.expand',
71+
title: nls.localize('expandAll', "Expand All"),
72+
f1: false,
73+
icon: Codicon.expandAll,
74+
menu: {
75+
id: MenuId.ViewTitle,
76+
group: 'navigation',
77+
when: ContextKeyExpr.and(ContextKeyExpr.and(ContextKeyExpr.equals('view', COMMENTS_VIEW_ID), CONTEXT_KEY_HAS_COMMENTS), ContextKeyExpr.not(CONTEXT_KEY_SOME_COMMENTS_EXPANDED.key)),
78+
order: 100
79+
}
80+
});
81+
}
82+
runInView(_accessor: ServicesAccessor, view: CommentsPanel) {
83+
view.expandAll();
84+
}
85+
});
3086

3187
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
3288
id: 'comments',

0 commit comments

Comments
 (0)