Skip to content

Commit 450daa7

Browse files
committed
Merge branch 'main' into joh/awful-quelea
2 parents 687a754 + 3c1ceb6 commit 450daa7

File tree

92 files changed

+2943
-608
lines changed

Some content is hidden

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

92 files changed

+2943
-608
lines changed

extensions/git/package.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,13 +1882,23 @@
18821882
"command": "git.viewAllChanges",
18831883
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18841884
"group": "inline@1"
1885+
},
1886+
{
1887+
"command": "git.viewAllChanges",
1888+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
1889+
"group": "1_view@1"
18851890
}
18861891
],
18871892
"scm/incomingChanges/historyItem/context": [
18881893
{
18891894
"command": "git.viewCommit",
18901895
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18911896
"group": "inline@1"
1897+
},
1898+
{
1899+
"command": "git.viewCommit",
1900+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
1901+
"group": "1_view@1"
18921902
}
18931903
],
18941904
"scm/outgoingChanges": [
@@ -1906,27 +1916,37 @@
19061916
"scm/outgoingChanges/context": [
19071917
{
19081918
"command": "git.pushRef",
1909-
"group": "1_modification@1",
1910-
"when": "scmProvider == git && scmHistoryItemGroupHasUpstream"
1919+
"when": "scmProvider == git && scmHistoryItemGroupHasUpstream",
1920+
"group": "1_modification@1"
19111921
},
19121922
{
19131923
"command": "git.publish",
1914-
"group": "1_modification@1",
1915-
"when": "scmProvider == git && !scmHistoryItemGroupHasUpstream"
1924+
"when": "scmProvider == git && !scmHistoryItemGroupHasUpstream",
1925+
"group": "1_modification@1"
19161926
}
19171927
],
19181928
"scm/outgoingChanges/allChanges/context": [
19191929
{
19201930
"command": "git.viewAllChanges",
19211931
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
19221932
"group": "inline@1"
1933+
},
1934+
{
1935+
"command": "git.viewAllChanges",
1936+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
1937+
"group": "1_view@1"
19231938
}
19241939
],
19251940
"scm/outgoingChanges/historyItem/context": [
19261941
{
19271942
"command": "git.viewCommit",
19281943
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
19291944
"group": "inline@1"
1945+
},
1946+
{
1947+
"command": "git.viewCommit",
1948+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
1949+
"group": "1_view@1"
19301950
}
19311951
],
19321952
"editor/title": [

extensions/git/src/api/api1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class ApiRepository implements Repository {
257257
}
258258

259259
commit(message: string, opts?: CommitOptions): Promise<void> {
260-
return this.repository.commit(message, opts);
260+
return this.repository.commit(message, { ...opts, postCommitCommand: null });
261261
}
262262

263263
merge(ref: string): Promise<void> {

extensions/git/src/diagnostics.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { CodeAction, CodeActionKind, CodeActionProvider, Diagnostic, DiagnosticCollection, DiagnosticSeverity, Disposable, Range, Selection, TextDocument, Uri, WorkspaceEdit, l10n, languages, workspace } from 'vscode';
77
import { mapEvent, filterEvent, dispose } from './util';
8+
import { Model } from './model';
89

910
export enum DiagnosticCodes {
1011
empty_message = 'empty_message',
@@ -17,37 +18,41 @@ export class GitCommitInputBoxDiagnosticsManager {
1718
private readonly severity = DiagnosticSeverity.Warning;
1819
private readonly disposables: Disposable[] = [];
1920

20-
constructor() {
21+
constructor(private readonly model: Model) {
2122
this.diagnostics = languages.createDiagnosticCollection();
22-
mapEvent(filterEvent(workspace.onDidChangeTextDocument, e => e.document.uri.scheme === 'vscode-scm'), e => e.document)(this.validateTextDocument, this, this.disposables);
23+
24+
mapEvent(filterEvent(workspace.onDidChangeTextDocument, e => e.document.uri.scheme === 'vscode-scm'), e => e.document)(this.onDidChangeTextDocument, this, this.disposables);
25+
filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.experimental.inputValidation'))(this.onDidChangeConfiguration, this, this.disposables);
2326
}
2427

2528
public getDiagnostics(uri: Uri): ReadonlyArray<Diagnostic> {
2629
return this.diagnostics.get(uri) ?? [];
2730
}
2831

29-
private validateTextDocument(document: TextDocument): void {
30-
this.diagnostics.delete(document.uri);
32+
private onDidChangeConfiguration(): void {
33+
for (const repository of this.model.repositories) {
34+
this.onDidChangeTextDocument(repository.inputBox.document);
35+
}
36+
}
3137

38+
private onDidChangeTextDocument(document: TextDocument): void {
3239
const config = workspace.getConfiguration('git');
3340
const inputValidation = config.get<boolean>('experimental.inputValidation', false) === true;
3441
if (!inputValidation) {
42+
this.diagnostics.set(document.uri, undefined);
3543
return;
3644
}
3745

38-
const diagnostics: Diagnostic[] = [];
39-
4046
if (/^\s+$/.test(document.getText())) {
4147
const documentRange = new Range(document.lineAt(0).range.start, document.lineAt(document.lineCount - 1).range.end);
4248
const diagnostic = new Diagnostic(documentRange, l10n.t('Current commit message only contains whitespace characters'), this.severity);
4349
diagnostic.code = DiagnosticCodes.empty_message;
4450

45-
diagnostics.push(diagnostic);
46-
this.diagnostics.set(document.uri, diagnostics);
47-
51+
this.diagnostics.set(document.uri, [diagnostic]);
4852
return;
4953
}
5054

55+
const diagnostics: Diagnostic[] = [];
5156
const inputValidationLength = config.get<number>('inputValidationLength', 50);
5257
const inputValidationSubjectLength = config.get<number | undefined>('inputValidationSubjectLength', undefined);
5358

extensions/git/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async function createModel(context: ExtensionContext, logger: LogOutputChannel,
119119
const postCommitCommandsProvider = new GitPostCommitCommandsProvider();
120120
model.registerPostCommitCommandsProvider(postCommitCommandsProvider);
121121

122-
const diagnosticsManager = new GitCommitInputBoxDiagnosticsManager();
122+
const diagnosticsManager = new GitCommitInputBoxDiagnosticsManager(model);
123123
disposables.push(diagnosticsManager);
124124

125125
const codeActionsProvider = new GitCommitInputBoxCodeActionsProvider(diagnosticsManager);

extensions/ruby/language-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
],
2727
"indentationRules": {
2828
"increaseIndentPattern": "^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|in|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|(\"|'|\/).*\\4)*(#.*)?$",
29-
"decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when|in)\\b)"
29+
"decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif)\\b)|((in|when)\\s)"
3030
}
3131
}

extensions/vscode-api-tests/src/singlefolder-tests/chat.test.ts

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import * as assert from 'assert';
77
import 'mocha';
8-
import { CancellationToken, chat, ChatAgentRequest, ChatAgentResult2, ChatVariableLevel, Disposable, interactive, InteractiveSession, ProviderResult } from 'vscode';
9-
import { assertNoRpc, closeAllEditors, DeferredPromise, disposeAll } from '../utils';
8+
import { CancellationToken, ChatAgentContext, ChatAgentRequest, ChatAgentResult2, ChatVariableLevel, Disposable, Event, EventEmitter, InteractiveSession, ProviderResult, chat, interactive } from 'vscode';
9+
import { DeferredPromise, assertNoRpc, closeAllEditors, disposeAll } from '../utils';
1010

1111
suite('chat', () => {
1212

@@ -22,6 +22,15 @@ suite('chat', () => {
2222
});
2323

2424
function getDeferredForRequest(): DeferredPromise<ChatAgentRequest> {
25+
const deferred = new DeferredPromise<ChatAgentRequest>();
26+
disposables.push(setupAgent()(request => deferred.complete(request.request)));
27+
28+
return deferred;
29+
}
30+
31+
function setupAgent(): Event<{ request: ChatAgentRequest; context: ChatAgentContext }> {
32+
const emitter = new EventEmitter<{ request: ChatAgentRequest; context: ChatAgentContext }>();
33+
disposables.push();
2534
disposables.push(interactive.registerInteractiveSessionProvider('provider', {
2635
prepareSession: (_token: CancellationToken): ProviderResult<InteractiveSession> => {
2736
return {
@@ -31,9 +40,8 @@ suite('chat', () => {
3140
},
3241
}));
3342

34-
const deferred = new DeferredPromise<ChatAgentRequest>();
35-
const agent = chat.createChatAgent('agent', (request, _context, _progress, _token) => {
36-
deferred.complete(request);
43+
const agent = chat.createChatAgent('agent', (request, context, _progress, _token) => {
44+
emitter.fire({ request, context });
3745
return null;
3846
});
3947
agent.isDefault = true;
@@ -43,15 +51,26 @@ suite('chat', () => {
4351
}
4452
};
4553
disposables.push(agent);
46-
return deferred;
54+
return emitter.event;
4755
}
4856

4957
test('agent and slash command', async () => {
50-
const deferred = getDeferredForRequest();
58+
const onRequest = setupAgent();
5159
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
52-
const request = await deferred.p;
53-
assert.deepStrictEqual(request.command, 'hello');
54-
assert.strictEqual(request.prompt, 'friend');
60+
61+
let i = 0;
62+
onRequest(request => {
63+
if (i === 0) {
64+
assert.deepStrictEqual(request.request.command, 'hello');
65+
assert.strictEqual(request.request.prompt, 'friend');
66+
i++;
67+
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
68+
} else {
69+
assert.strictEqual(request.context.history.length, 1);
70+
assert.strictEqual(request.context.history[0].agent.agent, 'agent');
71+
assert.strictEqual(request.context.history[0].command, 'hello');
72+
}
73+
});
5574
});
5675

5776
test('agent and variable', async () => {

src/vs/base/browser/ui/actionbar/actionViewItems.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
226226
const title = this.getTooltip() ?? '';
227227
this.updateAriaLabel();
228228

229-
this.element.title = '';
230229
if (!this.customHover) {
231230
const hoverDelegate = this.options.hoverDelegate ?? getDefaultHoverDelegate('element');
232231
this.customHover = setupCustomHover(hoverDelegate, this.element, title);

src/vs/base/browser/ui/iconLabel/iconLabelHover.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function setupNativeHover(htmlElement: HTMLElement, tooltip: string | ITo
3131
}
3232

3333
type IHoverContent = string | ITooltipMarkdownString | HTMLElement | undefined;
34+
type IHoverContentOrFactory = IHoverContent | (() => IHoverContent);
3435
type IResolvedHoverContent = IMarkdownString | string | HTMLElement | undefined;
3536

3637
/**
@@ -162,7 +163,7 @@ class UpdatableHoverWidget implements IDisposable {
162163
}
163164
}
164165

165-
export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IHoverContent, options?: IUpdatableHoverOptions): ICustomHover {
166+
export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IHoverContentOrFactory, options?: IUpdatableHoverOptions): ICustomHover {
166167
let hoverPreparation: IDisposable | undefined;
167168

168169
let hoverWidget: UpdatableHoverWidget | undefined;
@@ -186,7 +187,7 @@ export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTM
186187
return new TimeoutTimer(async () => {
187188
if (!hoverWidget || hoverWidget.isDisposed) {
188189
hoverWidget = new UpdatableHoverWidget(hoverDelegate, target || htmlElement, delay > 0);
189-
await hoverWidget.update(content, focus, options);
190+
await hoverWidget.update(typeof content === 'function' ? content() : content, focus, options);
190191
}
191192
}, delay);
192193
};

src/vs/base/common/observable.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,20 @@ export {
4949
} from 'vs/base/common/observableInternal/utils';
5050
export {
5151
ObservableLazy,
52-
ObservableLazyStatefulPromise,
52+
ObservableLazyPromise,
5353
ObservablePromise,
5454
PromiseResult,
5555
waitForState,
56+
derivedWithCancellationToken,
5657
} from 'vs/base/common/observableInternal/promise';
5758

5859
import { ConsoleObservableLogger, setLogger } from 'vs/base/common/observableInternal/logging';
5960

60-
const enableLogging = false;
61+
// Remove "//" in the next line to enable logging
62+
const enableLogging = false
63+
// || Boolean("true") // done "weirdly" so that a lint warning prevents you from pushing this
64+
;
65+
6166
if (enableLogging) {
6267
setLogger(new ConsoleObservableLogger());
6368
}

src/vs/base/common/observableInternal/derived.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { DebugNameData, IDebugNameData, Owner } from 'vs/base/common/observableI
1010
import { getLogger } from 'vs/base/common/observableInternal/logging';
1111

1212
export type EqualityComparer<T> = (a: T, b: T) => boolean;
13-
const defaultEqualityComparer: EqualityComparer<any> = (a, b) => a === b;
13+
export const defaultEqualityComparer: EqualityComparer<any> = (a, b) => a === b;
1414

1515
/**
1616
* Creates an observable that is derived from other observables.

0 commit comments

Comments
 (0)