Skip to content

Commit

Permalink
Move vscode prompt command check after debug trap handling
Browse files Browse the repository at this point in the history
  • Loading branch information
NeodymiumFerBore committed Mar 3, 2024
1 parent 717dbe7 commit 5468227
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/init/starship.bash
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ elif [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" || -n "${pree
starship_preexec_all(){ starship_preexec "$_"; }
preexec_functions+=(starship_preexec_all)
precmd_functions+=(starship_precmd)
# If we are running in vscode with shell integration
elif [[ "$PROMPT_COMMAND" == "__vsc_prompt_cmd_original" ]]; then
# if starship_precmd is not in vscode prompt command list, add it
if [[ ! ${__vsc_original_prompt_command[@]} =~ $(printf "\<starship_precmd\>") ]]; then
__vsc_original_prompt_command+=("starship_precmd")
fi
else
if [[ -n "${BASH_VERSION-}" ]] && [[ "${BASH_VERSINFO[0]}" -gt 4 || ( "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 ) ]]; then
starship_preexec_ps0() {
Expand Down Expand Up @@ -131,6 +125,12 @@ else
# add multiple instances of the starship function and keep other user functions if any.
if [[ -z "${PROMPT_COMMAND-}" ]]; then
PROMPT_COMMAND="starship_precmd"
# If we are running in vscode with shell integration
elif [[ "$PROMPT_COMMAND" == "__vsc_prompt_cmd_original" ]]; then
# if starship_precmd is not in vscode prompt command list, add it
if [[ ! ${__vsc_original_prompt_command[@]} =~ $(printf "\<starship_precmd\>") ]]; then
__vsc_original_prompt_command+=("starship_precmd")
fi
elif [[ "$PROMPT_COMMAND" != *"starship_precmd"* ]]; then
# Appending to PROMPT_COMMAND breaks exit status ($?) checking.
# Prepending to PROMPT_COMMAND breaks "command duration" module.
Expand Down

0 comments on commit 5468227

Please sign in to comment.