0%

vscode百宝箱

vue 格式化:

如何优雅的使用VS Code+ESLint+Prettier写Vue程序

go断点调试:

Windows + VS Code搭建 Go 开发环境

mac VSCode安装GO语言依赖工具

go vscode 断点调试

1
2
3
4
5
6
7
8
9
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}/main.go"
}
]

vim插件的设置:

1
"vim.useCtrlKeys": false

Remote-WSL:

  1. “在 Windows 端安装 Visual Studio Code Insiders”
  2. 安装 Remote Development 扩展包
  3. F1 remote wsl
    1
    2
    3
    4
    5
    6
    7
    8
    9
    在 VS Code 中打开「适用于 Linux 的 Windows 子系统」中的文件夹与从命令提示符打开 Windows 文件夹非常相似。

    打开 WSL 终端窗口(使用开始菜单项或从命令提示符键入 wsl )。

    切换到你要在 VS Code 中打开的文件夹(包括但不限于 Windows 文件系统挂载点,如 /mnt/c)

    在终端中输入 code-insiders .。在第一次执行此操作时,你应该看到 VS code 在获取运行于 WSL 所需的组件。这应该只需要很短的时间,而且只需要执行一次。

    片刻之后,一个新的 VS Code 窗口将会出现,你将看到一个 VS Code 正在 WSL 中打开文件夹的通知。

关闭vscode文件预览模式

1
"workbench.editor.enablePreview": false,

vscode侧边栏找不到搜索按钮

1
2
"search.location": "panel" //改成
"search.location": "sidebar"

Linux下配置vscode终端字体:

在Ubuntu 18.04.1LTS 下的解决方案(亲测可用),

其他版本linux做参考。

  1. 下载安装字体

    1
    2
    $cd /usr/share/fonts/truetype/
    $sudo git clone https://github.com/abertsch/Menlo-for-Powerline.git
  2. 刷新字体

    1
    $sudo fc-cache -f -v
  3. 回到 Vs Code的用户设置.json 中加入以下代码

    1
    2
    "terminal.integrated.fontFamily": "Menlo for Powerline",
    "editor.fontFamily": "'monospace','Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",

vscode配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"vim.useCtrlKeys": false,
"go.inferGopath": false,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
//.vue文件template格式化支持,并使用js-beautify-html插件
"vetur.format.defaultFormatter.html": "js-beautify-html",
//js-beautify-html格式化配置,属性强制换行
//文档:https://github.com/beautify-web/js-beautify#css--html
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_line_length": 170,
"wrap_attributes": "auto",
"end_with_newline": false
}
},
//根据文件后缀名定义vue文件类型
"files.associations": {
"*.vue": "vue"
},
//保存时eslint自动修复错误
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
}
],
"eslint.autoFixOnSave": true,
"python.pythonPath": "C:\\Users\\mayn\\envs\\Gerapy\\Scripts\\python.exe"
}

vscode vue配置

1
2
3
4
5
6
7
8
9
10
11
{
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript", "javascriptreact",
{ "language": "html", "autoFix": true },
{ "language": "vue", "autoFix": true } ],
"eslint.options": { "configFile": "./.eslintrc.js" },
"vetur.format.defaultFormatter.html": "js-beautify-html", //格式化html
“editor.formatOnSave": true, //是否保存格式化
"editor.tabSize": 2 // tab锁紧2个空格
}

es6自动格式化语法

1
2
3
4
5
6
7
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact"
, { "language": "html", "autoFix": true }
, { "language": "vue", "autoFix": true }
],

对选中的文本进行全部编辑

1
alt+enter

显示当前文件函数变量

1
win+p 输入@