VS Code
Debug with Chrome
打断点一般两种形式:
- 代码中加入
debugger. 缺点是需要重新 build,可能会浪费时间. 此外增加了对代码的额外修改. - devtools Source 面板中定位代码, 添加断点. 缺点是定位麻烦.
比上述两种方式更方便的形式是直接在 vs code 中打断点, 步骤如下:
- vs code 中添加 debug 配置
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to browser",
"port": 9222,
"webRoot": "${workspaceFolder}"
}
]
}
- 使用如下命令启动 Chrome:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
- vs code, run and debug 界面, 点击 Start Debugging, 或 F5.
美化设置
Theme: Cobalt2 Theme Official,对眼睛最好
字体:Source Code Pro
字体:Fira Code,配合 editor.fontLigatures
cursor一系列相关选项,设置光标效果
格式化设置
prettier 使用 .editorconfig 作为配置, 在 package.json 加入:
"prettier": {
"editorconfig": true
},
全局命令
cmd + shift + p 进入命令
界面操作
Side Bar -> explorer上右键,选择想看到的
cmd + b toggle sidebar
cmd + J toggle bottom screen
cmd + k, z toggle zen mode
cmd + 1/2 在打开的窗口间切换,当一个窗口拉到最大时,切换时将自动将 focus 窗口最大化
文件操作
cmd + p 打开文件
ctrl + tab 选择最近编辑的文件打开
cmd + | 或 cmd + 左键点击文件 在另一个侧栏打开
cmd + |,terminal 中也有效
cmd + k, m 选择编程语言