准备
- 下载安装vscode:
https://code.visualstudio.com/
- 安装各种插件:
https://marketplace.visualstudio.com/
- 配置服务器上vscode-server
离线安装升级vscode-server
- 参考:
https://blog.shipengx.com/archives/ef5b128d.html
- 获取vscode的commit id, 打开vscode,查看 帮助>关于>提交
- 下载链接: https://update.code.visualstudio.com/commit:commit_id/server-linux-x64/stable
- linux服务器上安装vscode-server
- 操作如下:
1
2
3
4查看vscode提交如: 384ff7382de624fb94dbaf6da11977bba1ecd427
curl -sSL "https://update.code.visualstudio.com/commit:384ff7382de624fb94dbaf6da11977bba1ecd427/server-linux-x64/stable" -o vscode-server-linux-x64.tar.gz
mkdir -p ~/.vscode-server/bin/384ff7382de624fb94dbaf6da11977bba1ecd427
tar zxvf vscode-server-linux-x64.tar.gz -C ~/.vscode-server/bin/384ff7382de624fb94dbaf6da11977bba1ecd427 --strip 1
vscode-web安装
基本说明
- 项目地址:
https://github.com/coder/code-server
- 参考说明:
https://github.com/puxiao/notes/blob/master/Code-Server%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8.md
- 安装成功后,需要修改密码
1
2
3
4bind-addr: 127.0.0.1:8080
auth: password
password: b0sdfsfasdfasdf34242
cert: false
docker 安装使用
- 参考:
https://coder.com/docs/code-server/latest/install
- 安装使用:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16This will start a code-server container and expose it at http://127.0.0.1:8080.
It will also mount your current directory into the container as `/home/coder/project`
and forward your UID/GID so that all file system operations occur as your user outside
the container.
# Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can
easily access/modify your code-server config in $HOME/.config/code-server/config.json
outside the container.
mkdir -p ~/.config
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
-v "$HOME/.local:/home/coder/.local" \
-v "$HOME/.config:/home/coder/.config" \
-v "$PWD:/home/coder/project" \
-u "$(id -u):$(id -g)" \
-e "DOCKER_USER=$USER" \
codercom/code-server:latest
二进制安装使用
- 参考:
https://cloud.tencent.com/developer/article/1845780
- 安装使用
1
2
3
4
5wget https://github.com/cdr/code-server/releases/download/v3.10.2/code-server-3.10.2-linux-amd64.tar.gz
tar zxvf code-server-3.10.2-linux-amd64.tar.gz
vim ~/.config/code-server/config.yaml
cd code-server-3.10.2-linux-amd64
./code-server
使用技巧
1. C/C++函数跳转:
- 参考:
https://www.cnblogs.com/WangYangkai/p/15950539.html
- vscode安装
gnu global
插件,linux安装gtags
工具,配置好vscode即可 - gtags 使用:
1
2
3
4
5
6
7
8
9
10环境变量: export MAKEOBJDIRPREFIX=/workspace/gtags/
vscode配置:
"gnuGlobal.globalExecutable": "/usr/bin/global",
"gnuGlobal.gtagsExecutable": "/usr/bin/gtags",
"gnuGlobal.objDirPrefix": "/workspace/gtags",
"gnuGlobal.completion": "Disabled",
生成跳转数据库: gtags -O
2. GO开发环境
- 配置环境变量及代理
1
2
3
4
5
6
7export PATH=$PATH:/usr/local/go/bin
export GOPATH=/go-depends-path/go
export PATH=$PATH:$GOPATH/bin
# goproxy
export GO111MODULE=on
export GOPROXY="http://goproxy1.xxx.com:9080,http://goproxy2.xxx.com/repository/go-proxy-group"
export GOSUMDB=off - 安装go开发工具:
Ctrl+Shift+P,输入>go:install,选择Go:Install/Update Tools,选中所有插件,点击确定进行安装
- 参考:
https://learn.microsoft.com/zh-cn/azure/developer/go/configure-visual-studio-code#3-install-the-go-extension
插件
- remote-ssh:
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh
- gnu global:
https://marketplace.visualstudio.com/items?itemName=jaycetyle.vscode-gnu-global
- Chinese :
https://marketplace.visualstudio.com/items?itemName=MS-CEINTL.vscode-language-pack-zh-hans
- drawio:
https://marketplace.visualstudio.com/items?itemName=eightHundreds.vscode-drawio
- rust:
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer
- lua:
https://marketplace.visualstudio.com/items?itemName=sumneko.lua
- go:
https://marketplace.visualstudio.com/items?itemName=golang.Go