Skip to content

Commit 409c566

Browse files
authored
Merge branch 'main' into serialize-message-fish
2 parents 50d59d7 + dd21124 commit 409c566

File tree

17 files changed

+324
-130
lines changed

17 files changed

+324
-130
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"search.exclude": {
1919
"**/node_modules": true,
2020
"**/bower_components": true,
21+
"cli/target/**": true,
2122
".build/**": true,
2223
"out/**": true,
2324
"out-build/**": true,

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ export class InputBox extends Widget {
265265
}
266266
}
267267

268+
public get step(): string {
269+
return this.input.step;
270+
}
271+
272+
public set step(newValue: string) {
273+
this.input.step = newValue;
274+
}
275+
268276
public get height(): number {
269277
return typeof this.cachedHeight === 'number' ? this.cachedHeight : dom.getTotalHeight(this.element);
270278
}

src/vs/workbench/api/common/extHostTesting.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ interface MirroredCollectionTestItem extends IncrementalTestCollectionItem {
727727
depth: number;
728728
}
729729

730-
class MirroredChangeCollector extends IncrementalChangeCollector<MirroredCollectionTestItem> {
730+
class MirroredChangeCollector implements IncrementalChangeCollector<MirroredCollectionTestItem> {
731731
private readonly added = new Set<MirroredCollectionTestItem>();
732732
private readonly updated = new Set<MirroredCollectionTestItem>();
733733
private readonly removed = new Set<MirroredCollectionTestItem>();
@@ -739,30 +739,29 @@ class MirroredChangeCollector extends IncrementalChangeCollector<MirroredCollect
739739
}
740740

741741
constructor(private readonly emitter: Emitter<vscode.TestsChangeEvent>) {
742-
super();
743742
}
744743

745744
/**
746-
* @override
745+
* @inheritdoc
747746
*/
748-
public override add(node: MirroredCollectionTestItem): void {
747+
public add(node: MirroredCollectionTestItem): void {
749748
this.added.add(node);
750749
}
751750

752751
/**
753-
* @override
752+
* @inheritdoc
754753
*/
755-
public override update(node: MirroredCollectionTestItem): void {
754+
public update(node: MirroredCollectionTestItem): void {
756755
Object.assign(node.revived, Convert.TestItem.toPlain(node.item));
757756
if (!this.added.has(node)) {
758757
this.updated.add(node);
759758
}
760759
}
761760

762761
/**
763-
* @override
762+
* @inheritdoc
764763
*/
765-
public override remove(node: MirroredCollectionTestItem): void {
764+
public remove(node: MirroredCollectionTestItem): void {
766765
if (this.added.has(node)) {
767766
this.added.delete(node);
768767
return;
@@ -780,7 +779,7 @@ class MirroredChangeCollector extends IncrementalChangeCollector<MirroredCollect
780779
}
781780

782781
/**
783-
* @override
782+
* @inheritdoc
784783
*/
785784
public getChangeEvent(): vscode.TestsChangeEvent {
786785
const { added, updated, removed } = this;
@@ -791,7 +790,7 @@ class MirroredChangeCollector extends IncrementalChangeCollector<MirroredCollect
791790
};
792791
}
793792

794-
public override complete() {
793+
public complete() {
795794
if (!this.isEmpty) {
796795
this.emitter.fire(this.getChangeEvent());
797796
}

src/vs/workbench/browser/layout.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
10731073
return false;
10741074
}
10751075

1076+
// with the command center enabled, we should always show
1077+
if (this.configurationService.getValue<boolean>('window.commandCenter')) {
1078+
return true;
1079+
}
1080+
10761081
// macOS desktop does not need a title bar when full screen
10771082
if (isMacintosh && isNative) {
10781083
return !this.state.runtime.fullscreen;
@@ -1083,11 +1088,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
10831088
return true;
10841089
}
10851090

1086-
// with the command center enabled, we should always show
1087-
if (this.configurationService.getValue<boolean>('window.commandCenter')) {
1088-
return true;
1089-
}
1090-
10911091
// if WCO is visible, we have to show the title bar
10921092
if (isWCOVisible()) {
10931093
return true;

src/vs/workbench/browser/parts/titlebar/titlebarPart.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ export class TitlebarPart extends Part implements ITitleService {
232232
this.element = parent;
233233
this.rootContainer = append(parent, $('.titlebar-container'));
234234

235-
// Draggable region that we can manipulate for #52522
236-
this.dragRegion = prepend(this.rootContainer, $('div.titlebar-drag-region'));
237-
238235
// App Icon (Native Windows/Linux and Web)
239236
if (!isMacintosh && !isWeb) {
240237
this.appIcon = prepend(this.rootContainer, $('a.window-appicon'));
@@ -254,6 +251,9 @@ export class TitlebarPart extends Part implements ITitleService {
254251
}
255252
}
256253

254+
// Draggable region that we can manipulate for #52522
255+
this.dragRegion = prepend(this.rootContainer, $('div.titlebar-drag-region'));
256+
257257
// Menubar: install a custom menu bar depending on configuration
258258
// and when not in activity bar
259259
if (this.titleBarStyle !== 'native'

src/vs/workbench/contrib/preferences/browser/settingsTree.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,7 @@ export class SettingNumberRenderer extends AbstractSettingRenderer implements IT
17581758

17591759
template.onChange = undefined;
17601760
template.inputBox.value = dataElement.value;
1761+
template.inputBox.step = dataElement.valueType.includes('integer') ? '1' : 'any';
17611762
template.inputBox.setAriaLabel(dataElement.setting.key);
17621763
template.onChange = value => {
17631764
if (!renderValidations(dataElement, template, false)) {

src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,47 @@ if [ -z "$VSCODE_SHELL_INTEGRATION" ]; then
3737
builtin return
3838
fi
3939

40+
# The property (P) and command (E) codes embed values which require escaping.
41+
# Backslashes are doubled. Non-alphanumeric characters are converted to escaped hex.
42+
__vsc_escape_value() {
43+
# Process text byte by byte, not by codepoint.
44+
builtin local LC_ALL=C str="${1}" i byte token out=''
45+
46+
for (( i=0; i < "${#str}"; ++i )); do
47+
byte="${str:$i:1}"
48+
49+
# Backslashes must be doubled.
50+
if [ "$byte" = "\\" ]; then
51+
token="\\\\"
52+
# Conservatively pass alphanumerics through.
53+
elif [[ "$byte" == [0-9A-Za-z] ]]; then
54+
token="$byte"
55+
# Hex-encode anything else.
56+
# (Importantly including: semicolon, newline, and control chars).
57+
else
58+
# The printf '0x%02X' "'$byte'" converts the character to a hex integer.
59+
# See printf's specification:
60+
# > If the leading character is a single-quote or double-quote, the value shall be the numeric value in the
61+
# > underlying codeset of the character following the single-quote or double-quote.
62+
# However, the result is a sign-extended int, so a high bit like 0xD7 becomes 0xFFF…FD7
63+
# We mask that word with 0xFF to get lowest 8 bits, and then encode that byte as "\xD7" per our escaping scheme.
64+
builtin printf -v token '\\x%02X' "$(( $(builtin printf '0x%X' "'$byte'") & 0xFF ))"
65+
# |________| ^^^ ^^^ ^^^^^^ ^^^^^^^ |______|
66+
# | | | | | |
67+
# store in `token` -+ | | the hex value -----------+ | |
68+
# the '\x…'-prefixed -----+ | of the byte as an integer --------+ |
69+
# 0-padded, two hex digits --+ masked to one byte (due to sign extension) -+
70+
fi
71+
72+
out+="$token"
73+
done
74+
75+
builtin printf '%s\n' "${out}"
76+
}
77+
4078
# Send the IsWindows property if the environment looks like Windows
4179
if [[ "$(uname -s)" =~ ^CYGWIN*|MINGW*|MSYS* ]]; then
42-
builtin printf "\x1b]633;P;IsWindows=True\x07"
80+
builtin printf '\e]633;P;IsWindows=True\a'
4381
fi
4482

4583
# Allow verifying $BASH_COMMAND doesn't have aliases resolved via history when the right HISTCONTROL
@@ -59,35 +97,35 @@ __vsc_in_command_execution="1"
5997
__vsc_current_command=""
6098

6199
__vsc_prompt_start() {
62-
builtin printf "\033]633;A\007"
100+
builtin printf '\e]633;A\a'
63101
}
64102

65103
__vsc_prompt_end() {
66-
builtin printf "\033]633;B\007"
104+
builtin printf '\e]633;B\a'
67105
}
68106

69107
__vsc_update_cwd() {
70-
builtin printf "\033]633;P;Cwd=%s\007" "$PWD"
108+
builtin printf '\e]633;P;Cwd=%s\a' "$(__vsc_escape_value "$PWD")"
71109
}
72110

73111
__vsc_command_output_start() {
74-
builtin printf "\033]633;C\007"
75-
builtin printf "\033]633;E;%s\007" "$__vsc_current_command"
112+
builtin printf '\e]633;C\a'
113+
builtin printf '\e]633;E;%s\a' "$(__vsc_escape_value "${__vsc_current_command}")"
76114
}
77115

78116
__vsc_continuation_start() {
79-
builtin printf "\033]633;F\007"
117+
builtin printf '\e]633;F\a'
80118
}
81119

82120
__vsc_continuation_end() {
83-
builtin printf "\033]633;G\007"
121+
builtin printf '\e]633;G\a'
84122
}
85123

86124
__vsc_command_complete() {
87125
if [ "$__vsc_current_command" = "" ]; then
88-
builtin printf "\033]633;D\007"
126+
builtin printf '\e]633;D\a'
89127
else
90-
builtin printf "\033]633;D;%s\007" "$__vsc_status"
128+
builtin printf '\e]633;D;%s\a' "$__vsc_status"
91129
fi
92130
__vsc_update_cwd
93131
}

src/vs/workbench/contrib/terminal/browser/media/shellIntegration-rc.zsh

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,81 @@ if [ -z "$VSCODE_SHELL_INTEGRATION" ]; then
3434
builtin return
3535
fi
3636

37+
# The property (P) and command (E) codes embed values which require escaping.
38+
# Backslashes are doubled. Non-alphanumeric characters are converted to escaped hex.
39+
__vsc_escape_value() {
40+
builtin emulate -L zsh
41+
42+
# Process text byte by byte, not by codepoint.
43+
builtin local LC_ALL=C str="$1" i byte token out=''
44+
45+
for (( i = 0; i < ${#str}; ++i )); do
46+
byte="${str:$i:1}"
47+
48+
# Backslashes must be doubled.
49+
if [ "$byte" = "\\" ]; then
50+
token="\\\\"
51+
# Conservatively pass alphanumerics through.
52+
elif [[ "$byte" == [0-9A-Za-z] ]]; then
53+
token="$byte"
54+
# Hex-encode anything else.
55+
# (Importantly including: semicolon, newline, and control chars).
56+
else
57+
token="\\x${(l:2::0:)$(( [##16] #byte ))}"
58+
# | | | |/|/ |_____|
59+
# | | | | | |
60+
# left-pad --+ | | | | +- the byte value of the character
61+
# two digits --+ | | +------- in hexadecimal
62+
# with '0' -------+ +--------- with no prefix
63+
fi
64+
65+
out+="$token"
66+
done
67+
68+
builtin print -r "$out"
69+
}
70+
3771
__vsc_in_command_execution="1"
3872
__vsc_current_command=""
3973

4074
__vsc_prompt_start() {
41-
builtin printf "\033]633;A\007"
75+
builtin printf '\e]633;A\a'
4276
}
4377

4478
__vsc_prompt_end() {
45-
builtin printf "\033]633;B\007"
79+
builtin printf '\e]633;B\a'
4680
}
4781

4882
__vsc_update_cwd() {
49-
builtin printf "\033]633;P;Cwd=%s\007" "$PWD"
83+
builtin printf '\e]633;P;Cwd=%s\a' "$(__vsc_escape_value "${PWD}")"
5084
}
5185

5286
__vsc_command_output_start() {
53-
builtin printf "\033]633;C\007"
54-
# Send command line, escaping printf format chars %
55-
builtin printf "\033]633;E;%s\007" "$__vsc_current_command"
87+
builtin printf '\e]633;C\a'
88+
builtin printf '\e]633;E;%s\a' "$(__vsc_escape_value "${__vsc_current_command}")"
5689
}
5790

5891
__vsc_continuation_start() {
59-
builtin printf "\033]633;F\007"
92+
builtin printf '\e]633;F\a'
6093
}
6194

6295
__vsc_continuation_end() {
63-
builtin printf "\033]633;G\007"
96+
builtin printf '\e]633;G\a'
6497
}
6598

6699
__vsc_right_prompt_start() {
67-
builtin printf "\033]633;H\007"
100+
builtin printf '\e]633;H\a'
68101
}
69102

70103
__vsc_right_prompt_end() {
71-
builtin printf "\033]633;I\007"
104+
builtin printf '\e]633;I\a'
72105
}
73106

74107
__vsc_command_complete() {
75108
if [[ "$__vsc_current_command" == "" ]]; then
76-
builtin printf "\033]633;D\007"
109+
builtin printf '\e]633;D\a'
77110
else
78-
builtin printf "\033]633;D;%s\007" "$__vsc_status"
111+
builtin printf '\e]633;D;%s\a' "$__vsc_status"
79112
fi
80113
__vsc_update_cwd
81114
}

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") {
1616
$Global:__VSCodeOriginalPrompt = $function:Prompt
1717

1818
$Global:__LastHistoryId = -1
19-
function Set-Serialized {
20-
param ([string] $toSerialize)
21-
$toSerialize = $toSerialize.Replace("\", "\\").Replace("`n", "\x0a").Replace(";", "\x3b")
22-
return $toSerialize
19+
20+
function Global:__VSCode-Escape-Value([string]$value) {
21+
# NOTE: In PowerShell v6.1+, this can be written `$value -replace '…', { … }` instead of `[regex]::Replace`.
22+
# Replace any non-alphanumeric characters.
23+
[regex]::Replace($value, '[^a-zA-Z0-9]', { param($match)
24+
# Backslashes must be doubled.
25+
if ($match.Value -eq '\') {
26+
'\\'
27+
} else {
28+
# Any other characters are encoded as their UTF-8 hex values.
29+
-Join (
30+
[System.Text.Encoding]::UTF8.GetBytes($match.Value)
31+
| ForEach-Object { '\x{0:x2}' -f $_ }
32+
)
33+
}
34+
})
2335
}
2436

2537
function Global:Prompt() {
@@ -43,7 +55,7 @@ function Global:Prompt() {
4355
} else {
4456
$CommandLine = ""
4557
}
46-
$Result += Set-Serialized($CommandLine)
58+
$Result += $(__VSCode-Escape-Value $CommandLine)
4759
$Result += "`a"
4860
# Command finished exit code
4961
# OSC 633 ; D [; <ExitCode>] ST
@@ -55,7 +67,7 @@ function Global:Prompt() {
5567
$Result += "$([char]0x1b)]633;A`a"
5668
# Current working directory
5769
# OSC 633 ; <Property>=<Value> ST
58-
$Result += if($pwd.Provider.Name -eq 'FileSystem'){"$([char]0x1b)]633;P;Cwd=$($pwd.ProviderPath)`a"}
70+
$Result += if($pwd.Provider.Name -eq 'FileSystem'){"$([char]0x1b)]633;P;Cwd=$(__VSCode-Escape-Value $pwd.ProviderPath)`a"}
5971
# Before running the original prompt, put $? back to what it was:
6072
if ($FakeCode -ne 0) {
6173
Write-Error "failure" -ea ignore

0 commit comments

Comments
 (0)