How to setup powerline-go in vscode running in WSL2 (Ubuntu)

ⅰ亾dé卋堺 提交于 2019-12-25 01:38:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!