@@ -102,18 +102,20 @@ end
102
102
function init_vscode_shell_integration --on-event fish_prompt
103
103
if functions --query fish_prompt
104
104
if functions --query __vsc_fish_prompt
105
+ # Erase the fallback so it can be set to the user's prompt
105
106
functions --erase __vsc_fish_prompt
106
107
end
107
- echo " setting __vsc_fish_prompt to actual fish prompt"
108
108
functions --copy fish_prompt __vsc_fish_prompt
109
109
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
111
112
else
112
113
if functions --query __vsc_fish_prompt
114
+ # There is no fish_prompt set, so stick with the default
113
115
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
115
118
else
116
- echo " setting __vsc_fish_prompt to fallback fish prompt"
117
119
function __vsc_fish_prompt
118
120
echo -n (whoami)@(prompt_hostname) (prompt_pwd ) ' ~> '
119
121
end
155
157
# Preserve and wrap fish_mode_prompt (which appears to the left of the regular
156
158
# prompt), but only if it's not defined as an empty function (which is the
157
159
# officially documented way to disable that feature).
158
- function _mode_prompt
160
+ function __set_shell_integration_fish_prompt
159
161
if __vsc_fish_has_mode_prompt
160
162
functions --copy fish_mode_prompt __vsc_fish_mode_prompt
161
163
@@ -168,16 +170,12 @@ function _mode_prompt
168
170
__vsc_fish_prompt
169
171
__vsc_fish_cmd_start
170
172
end
171
- set func2 (functions -a fish_prompt )
172
- echo " set fish prompt to $func2 "
173
173
else
174
174
# No fish_mode_prompt, so put everything in fish_prompt.
175
175
function fish_prompt
176
176
__vsc_fish_prompt_start
177
177
__vsc_fish_prompt
178
178
__vsc_fish_cmd_start
179
179
end
180
- set func2 (functions -a fish_prompt )
181
- echo " set fish prompt to $func2 "
182
180
end
183
181
end
0 commit comments