问题
These are the contents of my ~/.vscode-server/server-env-setup
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
... gives this error
[2019-12-10 13:49:39.763] /mnt/c/Users/cber/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.3/scripts/wslServer.sh: 1: /home/cber/.vscode-server/server-env-setup: Syntax error: "(" unexpected
[2019-12-10 13:49:39.805] VS Code Server for WSL closed unexpectedly.
UPDATE
This version (stripped of windows line endings) does not produce any errors, but unfortunately also does not display anything in the prompt in a git repo:
GOPATH=$HOME/go
_update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
来源:https://stackoverflow.com/questions/59268774/how-to-setup-powerline-go-in-vscode-running-in-wsl2-ubuntu