Skip to content

Commit

Permalink
ci: [sync] Update from che-incubator/che-code @ ba0e33
Browse files Browse the repository at this point in the history
Signed-off-by: devstudio-release <[email protected]>
  • Loading branch information
devstudio-release committed Nov 21, 2023
1 parent 84a6b53 commit e112da6
Show file tree
Hide file tree
Showing 50 changed files with 401 additions and 220 deletions.
6 changes: 3 additions & 3 deletions devspaces-code/code/extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@
{
"command": "git.timeline.openCommit",
"title": "%command.timelineOpenCommit%",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
},
{
Expand Down Expand Up @@ -763,13 +763,13 @@
{
"command": "git.viewChanges",
"title": "View Changes",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
},
{
"command": "git.viewStagedChanges",
"title": "View Staged Changes",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
}
],
Expand Down
4 changes: 2 additions & 2 deletions devspaces-code/code/extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3653,12 +3653,12 @@ export class CommandCenter {

@command('git.viewChanges', { repository: true })
viewChanges(repository: Repository): void {
this._viewChanges('Changes', repository.workingTreeGroup.resourceStates);
this._viewChanges('Git: Changes', repository.workingTreeGroup.resourceStates);
}

@command('git.viewStagedChanges', { repository: true })
viewStagedChanges(repository: Repository): void {
this._viewChanges('Staged Changes', repository.indexGroup.resourceStates);
this._viewChanges('Git: Staged Changes', repository.indexGroup.resourceStates);
}

private _viewChanges(title: string, resources: Resource[]): void {
Expand Down
2 changes: 1 addition & 1 deletion devspaces-code/code/extensions/npm/src/npmMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}

const lines = outputMatch.regexMatch[1];
const fixes: vscode.TerminalQuickFixExecuteTerminalCommand[] = [];
const fixes: vscode.TerminalQuickFixTerminalCommand[] = [];
for (const line of lines.split('\n')) {
// search from the second char, since the lines might be prefixed with
// "npm ERR!" which comes before the actual command suggestion.
Expand Down
2 changes: 1 addition & 1 deletion devspaces-code/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@parcel/watcher": "2.1.0",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/policy-watcher": "^1.1.4",
"@vscode/proxy-agent": "^0.18.1",
"@vscode/proxy-agent": "^0.18.2",
"@vscode/ripgrep": "^1.15.6",
"@vscode/spdlog": "^0.13.12",
"@vscode/sqlite3": "5.1.6-vscode",
Expand Down
2 changes: 1 addition & 1 deletion devspaces-code/code/remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@microsoft/1ds-post-js": "^3.2.13",
"@parcel/watcher": "2.1.0",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/proxy-agent": "^0.18.1",
"@vscode/proxy-agent": "^0.18.2",
"@vscode/ripgrep": "^1.15.6",
"@vscode/spdlog": "^0.13.12",
"@vscode/vscode-languagedetection": "1.0.21",
Expand Down
8 changes: 4 additions & 4 deletions devspaces-code/code/remote/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48"
integrity sha512-bRRFxLfg5dtAyl5XyiVWz/ZBPahpOpPrNYnnHpOpUZvam4tKH35wdhP4Kj6PbM0+KdliOsPzbGWpkxcdpNB/sg==

"@vscode/proxy-agent@^0.18.1":
version "0.18.1"
resolved "https://registry.yarnpkg.com/@vscode/proxy-agent/-/proxy-agent-0.18.1.tgz#855ef4b8623f4b8801cd25f2f3b7b256bb5fcbc9"
integrity sha512-VeQ2cXefv4GjzquBVl62fHTMc7ONCrsyQDMCPrnwd2kcebYKwn6O+Sv+0NECrfwVAS9odUrap0dDHri7T2hCIQ==
"@vscode/proxy-agent@^0.18.2":
version "0.18.2"
resolved "https://registry.yarnpkg.com/@vscode/proxy-agent/-/proxy-agent-0.18.2.tgz#8b2872849b6c6779cd655ce369a4556c6804a9f7"
integrity sha512-yDj/JI9otEEUVU36dKOWNitGk4tBcriIeE6uvVGEdvKbpVD7L9UMNvL/wCoHCOqBnf2g5jUhWSURWDVyAhJn2Q==
dependencies:
"@tootallnate/once" "^3.0.0"
agent-base "^7.0.1"
Expand Down
64 changes: 63 additions & 1 deletion devspaces-code/code/src/vs/base/common/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
*--------------------------------------------------------------------------------------------*/

import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { CancellationError } from 'vs/base/common/errors';
import { BugIndicatingError, CancellationError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, DisposableMap, DisposableStore, IDisposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { extUri as defaultExtUri, IExtUri } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { setTimeout0 } from 'vs/base/common/platform';
import { MicrotaskDelay } from './symbols';
import { Lazy } from 'vs/base/common/lazy';

export function isThenable<T>(obj: unknown): obj is Promise<T> {
return !!obj && typeof (obj as unknown as Promise<T>).then === 'function';
Expand Down Expand Up @@ -1624,6 +1625,67 @@ export namespace Promises {
}
}

export class StatefulPromise<T> {
private _value: T | undefined = undefined;
get value(): T | undefined { return this._value; }

private _error: unknown = undefined;
get error(): unknown { return this._error; }

private _isResolved = false;
get isResolved() { return this._isResolved; }

public readonly promise: Promise<T>;

constructor(promise: Promise<T>) {
this.promise = promise.then(
value => {
this._value = value;
this._isResolved = true;
return value;
},
error => {
this._error = error;
this._isResolved = true;
throw error;
}
);
}

public requireValue(): T {
if (!this._isResolved) {
throw new BugIndicatingError('Promise is not resolved yet');
}
if (this._error) {
throw this._error;
}
return this._value!;
}
}

export class LazyStatefulPromise<T> {
private _promise = new Lazy(() => new StatefulPromise(this._compute()));

constructor(
private readonly _compute: () => Promise<T>,
) { }

/**
* Returns the resolved value.
* Crashes if the promise is not resolved yet.
*/
public requireValue(): T {
return this._promise.value.requireValue();
}

/**
* Returns the promise (and triggers a computation of the promise if not yet done so).
*/
public getPromise(): Promise<T> {
return this._promise.value.promise;
}
}

//#endregion

//#region
Expand Down
1 change: 1 addition & 0 deletions devspaces-code/code/src/vs/base/common/codicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ export const Codicon = {
gitFetch: register('git-fetch', 0xec1d),
copilot: register('copilot', 0xec1e),
lightbulbSparkle: register('lightbulb-sparkle', 0xec1f),
lightbulbSparkleAutofix: register('lightbulb-sparkle-autofix', 0xec1f),

// derived icons, that could become separate icons

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { ColorId, ITokenPresentation } from 'vs/editor/common/encodedTokenAttrib
import { Color } from 'vs/base/common/color';
import { IME } from 'vs/base/common/ime';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';

export interface IVisibleRangeProvider {
visibleRangeForPosition(position: Position): HorizontalPosition | null;
Expand Down Expand Up @@ -145,7 +146,8 @@ export class TextAreaHandler extends ViewPart {
context: ViewContext,
viewController: ViewController,
visibleRangeProvider: IVisibleRangeProvider,
@IKeybindingService private readonly _keybindingService: IKeybindingService
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@IInstantiationService private readonly _instantiationService: IInstantiationService
) {
super(context);

Expand Down Expand Up @@ -303,7 +305,7 @@ export class TextAreaHandler extends ViewPart {
};

const textAreaWrapper = this._register(new TextAreaWrapper(this.textArea.domNode));
this._textAreaInput = this._register(new TextAreaInput(textAreaInputHost, textAreaWrapper, platform.OS, {
this._textAreaInput = this._register(this._instantiationService.createInstance(TextAreaInput, textAreaInputHost, textAreaWrapper, platform.OS, {
isAndroid: browser.isAndroid,
isChrome: browser.isChrome,
isFirefox: browser.isFirefox,
Expand Down Expand Up @@ -478,7 +480,7 @@ export class TextAreaHandler extends ViewPart {
}

public writeScreenReaderContent(reason: string): void {
this._textAreaInput.writeScreenReaderContent(reason);
this._textAreaInput.writeNativeTextAreaContent(reason);
}

public override dispose(): void {
Expand Down Expand Up @@ -629,7 +631,7 @@ export class TextAreaHandler extends ViewPart {
}

if (e.hasChanged(EditorOption.accessibilitySupport)) {
this._textAreaInput.writeScreenReaderContent('strategy changed');
this._textAreaInput.writeNativeTextAreaContent('strategy changed');
}

return true;
Expand All @@ -639,7 +641,7 @@ export class TextAreaHandler extends ViewPart {
this._modelSelections = e.modelSelections.slice(0);
// We must update the <textarea> synchronously, otherwise long press IME on macos breaks.
// See https://github.com/microsoft/vscode/issues/165821
this._textAreaInput.writeScreenReaderContent('selection changed');
this._textAreaInput.writeNativeTextAreaContent('selection changed');
return true;
}
public override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {
Expand Down Expand Up @@ -726,7 +728,7 @@ export class TextAreaHandler extends ViewPart {
}

public render(ctx: RestrictedRenderingContext): void {
this._textAreaInput.writeScreenReaderContent('render');
this._textAreaInput.writeNativeTextAreaContent('render');
this._render();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import { inputLatency } from 'vs/base/browser/performance';
import { RunOnceScheduler } from 'vs/base/common/async';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { Disposable, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { Mimes } from 'vs/base/common/mime';
import { OperatingSystem } from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings';
import { ITextAreaWrapper, ITypeData, TextAreaState, _debugComposition } from 'vs/editor/browser/controller/textAreaState';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { ILogService } from 'vs/platform/log/common/log';

export namespace TextAreaSyntethicEvents {
export const Tap = '-monaco-textarea-synthetic-tap';
Expand Down Expand Up @@ -193,7 +195,8 @@ export class TextAreaInput extends Disposable {
// ---

private readonly _asyncTriggerCut: RunOnceScheduler;
private readonly _asyncFocusGainWriteScreenReaderContent: RunOnceScheduler;

private _asyncFocusGainWriteScreenReaderContent: MutableDisposable<RunOnceScheduler> = this._register(new MutableDisposable());

private _textAreaState: TextAreaState;

Expand All @@ -210,16 +213,24 @@ export class TextAreaInput extends Disposable {
private readonly _host: ITextAreaInputHost,
private readonly _textArea: ICompleteTextAreaWrapper,
private readonly _OS: OperatingSystem,
private readonly _browser: IBrowser
private readonly _browser: IBrowser,
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,
@ILogService private readonly _logService: ILogService
) {
super();
this._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));
this._asyncFocusGainWriteScreenReaderContent = this._register(new RunOnceScheduler(() => this.writeScreenReaderContent('asyncFocusGain'), 0));

this._textAreaState = TextAreaState.EMPTY;
this._selectionChangeListener = null;
this.writeScreenReaderContent('ctor');

if (this._accessibilityService.isScreenReaderOptimized()) {
this.writeNativeTextAreaContent('ctor');
}
this._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {
if (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {
this._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0));
} else {
this._asyncFocusGainWriteScreenReaderContent.clear();
}
}));
this._hasFocus = false;
this._currentComposition = null;

Expand Down Expand Up @@ -431,10 +442,13 @@ export class TextAreaInput extends Disposable {

this._setHasFocus(true);

if (this._browser.isSafari && !hadFocus && this._hasFocus) {
if (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {
// When "tabbing into" the textarea, immediately after dispatching the 'focus' event,
// Safari will always move the selection at offset 0 in the textarea
this._asyncFocusGainWriteScreenReaderContent.schedule();
if (!this._asyncFocusGainWriteScreenReaderContent.value) {
this._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent('asyncFocusGain'), 0);
}
this._asyncFocusGainWriteScreenReaderContent.value.schedule();
}
}));
this._register(this._textArea.onBlur(() => {
Expand All @@ -447,7 +461,7 @@ export class TextAreaInput extends Disposable {
this._currentComposition = null;

// Clear the textarea to avoid an unwanted cursor type
this.writeScreenReaderContent('blurWithoutCompositionEnd');
this.writeNativeTextAreaContent('blurWithoutCompositionEnd');

// Fire artificial composition end
this._onCompositionEnd.fire();
Expand All @@ -463,7 +477,7 @@ export class TextAreaInput extends Disposable {
this._currentComposition = null;

// Clear the textarea to avoid an unwanted cursor type
this.writeScreenReaderContent('tapWithoutCompositionEnd');
this.writeNativeTextAreaContent('tapWithoutCompositionEnd');

// Fire artificial composition end
this._onCompositionEnd.fire();
Expand Down Expand Up @@ -602,7 +616,7 @@ export class TextAreaInput extends Disposable {
}

if (this._hasFocus) {
this.writeScreenReaderContent('focusgain');
this.writeNativeTextAreaContent('focusgain');
}

if (this._hasFocus) {
Expand All @@ -621,12 +635,13 @@ export class TextAreaInput extends Disposable {
this._textAreaState = textAreaState;
}

public writeScreenReaderContent(reason: string): void {
if (this._currentComposition) {
public writeNativeTextAreaContent(reason: string): void {
if ((!this._accessibilityService.isScreenReaderOptimized() && reason === 'render') || this._currentComposition) {
// Do not write to the text on render unless a screen reader is being used #192278
// Do not write to the text area when doing composition
return;
}

this._logService.trace(`writeTextAreaState(reason: ${reason})`);
this._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export class DiffEditorEditors extends Disposable {
result.unicodeHighlight = this._options.editorOptions.get().unicodeHighlight || {};
result.wordWrapOverride1 = this._options.diffWordWrap.get();
}
result.glyphMargin = this._options.renderSideBySide.get();

if (changedOptions.originalAriaLabel) {
result.ariaLabel = changedOptions.originalAriaLabel;
}
Expand Down
Loading

0 comments on commit e112da6

Please sign in to comment.