Skip to content

Commit 0a70d33

Browse files
committed
add comments
1 parent 8b5ed99 commit 0a70d33

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,20 @@ end
102102
function init_vscode_shell_integration --on-event fish_prompt
103103
if functions --query fish_prompt
104104
if functions --query __vsc_fish_prompt
105+
# Erase the fallback so it can be set to the user's prompt
105106
functions --erase __vsc_fish_prompt
106107
end
107-
echo "setting __vsc_fish_prompt to actual fish prompt"
108108
functions --copy fish_prompt __vsc_fish_prompt
109109
functions --erase init_vscode_shell_integration
110-
_mode_prompt
110+
# Now __vsc_fish_prompt is guaranteed to be defined
111+
__set_shell_integration_fish_prompt
111112
else
112113
if functions --query __vsc_fish_prompt
114+
# There is no fish_prompt set, so stick with the default
113115
functions --erase init_vscode_shell_integration
114-
_mode_prompt
116+
# Now __vsc_fish_prompt is guaranteed to be defined
117+
__set_shell_integration_fish_prompt
115118
else
116-
echo "setting __vsc_fish_prompt to fallback fish prompt"
117119
function __vsc_fish_prompt
118120
echo -n (whoami)@(prompt_hostname) (prompt_pwd) '~> '
119121
end
@@ -155,7 +157,7 @@ end
155157
# Preserve and wrap fish_mode_prompt (which appears to the left of the regular
156158
# prompt), but only if it's not defined as an empty function (which is the
157159
# officially documented way to disable that feature).
158-
function _mode_prompt
160+
function __set_shell_integration_fish_prompt
159161
if __vsc_fish_has_mode_prompt
160162
functions --copy fish_mode_prompt __vsc_fish_mode_prompt
161163

@@ -168,16 +170,12 @@ function _mode_prompt
168170
__vsc_fish_prompt
169171
__vsc_fish_cmd_start
170172
end
171-
set func2 (functions -a fish_prompt)
172-
echo "set fish prompt to $func2"
173173
else
174174
# No fish_mode_prompt, so put everything in fish_prompt.
175175
function fish_prompt
176176
__vsc_fish_prompt_start
177177
__vsc_fish_prompt
178178
__vsc_fish_cmd_start
179179
end
180-
set func2 (functions -a fish_prompt)
181-
echo "set fish prompt to $func2"
182180
end
183181
end

0 commit comments

Comments
 (0)