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
16 changes: 14 additions & 2 deletions build/win32/code.iss
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,12 @@ begin
Result := not (IsBackgroundUpdate() and FileExists(Path));
end;

// Check if VS Code created a cancel file to signal that the update should be aborted
function CancelFileExists(): Boolean;
begin
Result := FileExists(ExpandConstant('{param:cancel}'))
end;

function ShouldRunAfterUpdate(): Boolean;
begin
if IsBackgroundUpdate() then
Expand Down Expand Up @@ -1639,11 +1645,17 @@ begin
Log('Checking whether application is still running...');
while (CheckForMutexes('{#AppMutex}')) do
begin
if CancelFileExists() then
begin
Log('Cancel file detected, aborting background update.');
DeleteFile(ExpandConstant('{app}\updating_version'));
Abort;
end;
Sleep(1000)
end;
Log('Application appears not to be running.');

if not SessionEndFileExists() then begin
if not SessionEndFileExists() and not CancelFileExists() then begin
StopTunnelServiceIfNeeded();
Log('Invoking inno_updater for background update');
Exec(ExpandConstant('{app}\{#VersionedResourcesFolder}\tools\inno_updater.exe'), ExpandConstant('"{app}\{#ExeBasename}.exe" ' + BoolToStr(LockFileExists()) + ' "{cm:UpdatingVisualStudioCode}"'), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode);
Expand All @@ -1657,7 +1669,7 @@ begin
end;
#endif
end else begin
Log('Skipping inno_updater.exe call because OS session is ending');
Log('Skipping inno_updater.exe call because OS session is ending or cancel was requested');
end;
end else begin
if IsVersionedUpdate() then begin
Expand Down
12 changes: 8 additions & 4 deletions src/vs/editor/contrib/hover/browser/hoverUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import * as dom from '../../../../base/browser/dom.js';
import { IEditorMouseEvent } from '../../../browser/editorBrowser.js';

const enum PADDING {
VALUE = 3
}

export function isMousePositionWithinElement(element: HTMLElement, posx: number, posy: number): boolean {
const elementRect = dom.getDomNodePagePosition(element);
if (posx < elementRect.left
|| posx > elementRect.left + elementRect.width
|| posy < elementRect.top
|| posy > elementRect.top + elementRect.height) {
if (posx < elementRect.left + PADDING.VALUE
|| posx > elementRect.left + elementRect.width - PADDING.VALUE
|| posy < elementRect.top + PADDING.VALUE
|| posy > elementRect.top + elementRect.height - PADDING.VALUE) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import { HoverStartSource } from './hoverOperation.js';
import { ScrollEvent } from '../../../../base/common/scrollable.js';

const $ = dom.$;
const increaseHoverVerbosityIcon = registerIcon('hover-increase-verbosity', Codicon.add, nls.localize('increaseHoverVerbosity', 'Icon for increaseing hover verbosity.'));
const decreaseHoverVerbosityIcon = registerIcon('hover-decrease-verbosity', Codicon.remove, nls.localize('decreaseHoverVerbosity', 'Icon for decreasing hover verbosity.'));
const increaseHoverVerbosityIcon = registerIcon('hover-increase-verbosity', Codicon.addSmall, nls.localize('increaseHoverVerbosity', 'Icon for increaseing hover verbosity.'));
const decreaseHoverVerbosityIcon = registerIcon('hover-decrease-verbosity', Codicon.removeSmall, nls.localize('decreaseHoverVerbosity', 'Icon for decreasing hover verbosity.'));

export class MarkdownHover implements IHoverPart {

Expand Down
16 changes: 8 additions & 8 deletions src/vs/editor/contrib/hover/test/browser/hoverUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ suite('Hover Utils', () => {

test('returns true when mouse is on element edges', () => {
const element = createMockElement(100, 100, 200, 100);
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), true); // top-left corner
assert.strictEqual(isMousePositionWithinElement(element, 300, 100), true); // top-right corner
assert.strictEqual(isMousePositionWithinElement(element, 100, 200), true); // bottom-left corner
assert.strictEqual(isMousePositionWithinElement(element, 300, 200), true); // bottom-right corner
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), false); // top-left corner
assert.strictEqual(isMousePositionWithinElement(element, 300, 100), false); // top-right corner
assert.strictEqual(isMousePositionWithinElement(element, 100, 200), false); // bottom-left corner
assert.strictEqual(isMousePositionWithinElement(element, 300, 200), false); // bottom-right corner
});

test('returns false when mouse is left of element', () => {
Expand Down Expand Up @@ -146,16 +146,16 @@ suite('Hover Utils', () => {

test('handles element at origin (0,0)', () => {
const element = createMockElement(0, 0, 100, 100);
assert.strictEqual(isMousePositionWithinElement(element, 0, 0), true);
assert.strictEqual(isMousePositionWithinElement(element, 0, 0), false);
assert.strictEqual(isMousePositionWithinElement(element, 50, 50), true);
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), true);
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), false);
assert.strictEqual(isMousePositionWithinElement(element, 101, 101), false);
});

test('handles small elements (1x1)', () => {
const element = createMockElement(100, 100, 1, 1);
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), true);
assert.strictEqual(isMousePositionWithinElement(element, 101, 101), true);
assert.strictEqual(isMousePositionWithinElement(element, 100, 100), false);
assert.strictEqual(isMousePositionWithinElement(element, 101, 101), false);
assert.strictEqual(isMousePositionWithinElement(element, 102, 102), false);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const _allApiProposals = {
},
chatParticipantPrivate: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts',
version: 12
version: 13
},
chatPromptFiles: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts',
Expand Down
47 changes: 26 additions & 21 deletions src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ import { removeAnsiEscapeCodesFromPrompt } from '../../../../base/common/strings
import { ShellEnvDetectionCapability } from '../capabilities/shellEnvDetectionCapability.js';
import { PromptTypeDetectionCapability } from '../capabilities/promptTypeDetectionCapability.js';


/**
* Shell integration is a feature that enhances the terminal's understanding of what's happening
* in the shell by injecting special sequences into the shell's prompt using the "Set Text
* Parameters" sequence (`OSC Ps ; Pt ST`).
*
* Definitions:
* - OSC: `\x1b]`
* - Ps: A single (usually optional) numeric parameter, composed of one or more digits.
* - Pt: A text parameter composed of printable characters.
* - ST: `\x7`
*
* This is inspired by a feature of the same name in the FinalTerm, iTerm2 and kitty terminals.
*/
// Shell integration is a feature that enhances the terminal's understanding of what's happening
// in the shell by injecting special sequences into the shell's prompt using the "Set Text
// Parameters" sequence (`OSC Ps ; Pt ST`).
//
// Definitions:
// - OSC: `\x1b]`
// - Ps: A single (usually optional) numeric parameter, composed of one or more digits.
// - Pt: A text parameter composed of printable characters.
// - ST: `\x7`
//
// This is inspired by a feature of the same name in the FinalTerm, iTerm2 and kitty terminals.

/**
* The identifier for the first numeric parameter (`Ps`) for OSC commands used by shell integration.
Expand Down Expand Up @@ -174,27 +171,35 @@ const enum VSCodeOscPt {
/**
* Similar to prompt start but for line continuations.
*
* Format: `OSC 633 ; F ST`
*
* WARNING: This sequence is unfinalized, DO NOT use this in your shell integration script.
*/
ContinuationStart = 'F',

/**
* Similar to command start but for line continuations.
*
* Format: `OSC 633 ; G ST`
*
* WARNING: This sequence is unfinalized, DO NOT use this in your shell integration script.
*/
ContinuationEnd = 'G',

/**
* The start of the right prompt.
*
* Format: `OSC 633 ; H ST`
*
* WARNING: This sequence is unfinalized, DO NOT use this in your shell integration script.
*/
RightPromptStart = 'H',

/**
* The end of the right prompt.
*
* Format: `OSC 633 ; I ST`
*
* WARNING: This sequence is unfinalized, DO NOT use this in your shell integration script.
*/
RightPromptEnd = 'I',
Expand Down Expand Up @@ -224,7 +229,7 @@ const enum VSCodeOscPt {
/**
* Sets a mark/point-of-interest in the buffer.
*
* Format: `OSC 633 ; SetMark [; Id=<string>] [; Hidden]`
* Format: `OSC 633 ; SetMark [; Id=<string>] [; Hidden] ST`
*
* `Id` - The identifier of the mark that can be used to reference it
* `Hidden` - When set, the mark will be available to reference internally but will not visible
Expand All @@ -236,7 +241,7 @@ const enum VSCodeOscPt {
/**
* Sends the shell's complete environment in JSON format.
*
* Format: `OSC 633 ; EnvJson ; <Environment> ; <Nonce>`
* Format: `OSC 633 ; EnvJson ; <Environment> ; <Nonce> ST`
*
* - `Environment` - A stringified JSON object containing the shell's complete environment. The
* variables and values use the same encoding rules as the {@link CommandLine} sequence.
Expand All @@ -250,7 +255,7 @@ const enum VSCodeOscPt {
/**
* Delete a single environment variable from cached environment.
*
* Format: `OSC 633 ; EnvSingleDelete ; <EnvironmentKey> ; <EnvironmentValue> [; <Nonce>]`
* Format: `OSC 633 ; EnvSingleDelete ; <EnvironmentKey> ; <EnvironmentValue> [; <Nonce>] ST`
*
* - `Nonce` - An optional nonce can be provided which may be required by the terminal in order
* to enable some features. This helps ensure no malicious command injection has occurred.
Expand All @@ -262,7 +267,7 @@ const enum VSCodeOscPt {
/**
* The start of the collecting user's environment variables individually.
*
* Format: `OSC 633 ; EnvSingleStart ; <Clear> [; <Nonce>]`
* Format: `OSC 633 ; EnvSingleStart ; <Clear> [; <Nonce>] ST`
*
* - `Clear` - An _mandatory_ flag indicating any cached environment variables will be cleared.
* - `Nonce` - An optional nonce can be provided which may be required by the terminal in order
Expand All @@ -275,7 +280,7 @@ const enum VSCodeOscPt {
/**
* Sets an entry of single environment variable to transactional pending map of environment variables.
*
* Format: `OSC 633 ; EnvSingleEntry ; <EnvironmentKey> ; <EnvironmentValue> [; <Nonce>]`
* Format: `OSC 633 ; EnvSingleEntry ; <EnvironmentKey> ; <EnvironmentValue> [; <Nonce>] ST`
*
* - `Nonce` - An optional nonce can be provided which may be required by the terminal in order
* to enable some features. This helps ensure no malicious command injection has occurred.
Expand All @@ -288,7 +293,7 @@ const enum VSCodeOscPt {
* The end of the collecting user's environment variables individually.
* Clears any pending environment variables and fires an event that contains user's environment.
*
* Format: `OSC 633 ; EnvSingleEnd [; <Nonce>]`
* Format: `OSC 633 ; EnvSingleEnd [; <Nonce>] ST`
*
* - `Nonce` - An optional nonce can be provided which may be required by the terminal in order
* to enable some features. This helps ensure no malicious command injection has occurred.
Expand All @@ -305,7 +310,7 @@ const enum ITermOscPt {
/**
* Sets a mark/point-of-interest in the buffer.
*
* Format: `OSC 1337 ; SetMark`
* Format: `OSC 1337 ; SetMark ST`
*/
SetMark = 'SetMark',

Expand Down
10 changes: 9 additions & 1 deletion src/vs/platform/update/electron-main/abstractUpdateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,15 @@ export abstract class AbstractUpdateService implements IUpdateService {

if (isLatest === false && this._state.type === StateType.Ready) {
this.logService.info('update#readyStateCheck: newer update available, restarting update machinery');
await this.cancelPendingUpdate();

try {
await this.cancelPendingUpdate();
} catch (error) {
this.logService.error('update#checkForOverwriteUpdates(): failed to cancel pending update, aborting overwrite');
this.logService.error(error);
return false;
}

this._overwrite = true;
this.setState(State.Overwriting(this._state.update, explicit));
this.doCheckForUpdates(explicit, pendingUpdateCommit);
Expand Down
Loading
Loading