改造你的VSCode,大幅提升你的Coding效率

工欲善其事,必先利其器,插件是Coding效率提升的利器

今天要来介绍的主角是Visual Studio Code(简称VSCode),它是一款微软开发的原始码编辑器,几乎支援了所有的程序语言,为开发者提供好用的工具来提升效率,撰写高质量的程序码,那就让我来推荐给大家自己使用过的好用工具吧~

环境设定

在终端机使用指令开启VS Code

按下 command+Shift+P 来呼叫 命令选择区,输入shell command,选择「Shell Command: Install code command in PATH」
https://ithelp.ithome.com.tw/upload/images/20210919/20112053l55ePJs75b.png
安装完重启後,在要打开的资料夹右键,开启终端机,并输入code .,就会帮你开启专案在 VS Code 上罗~
p.s因为我是装iTerm2所以设定终端机为iTerm2
https://ithelp.ithome.com.tw/upload/images/20210919/20112053iv5KFNd84t.png
https://ithelp.ithome.com.tw/upload/images/20210919/20112053sHjqIuYFUH.png

教你如何设定在Finder目前资料夹开启终端机

1.开启「系统偏好设定」
2.点击「键盘」
https://ithelp.ithome.com.tw/upload/images/20210919/20112053yIBDavxadC.png
3.开启後选择上方「快速键」→左侧「服务」→找到档案与资料夹勾选「新增位於档案夹位置的终端机视窗」(系统预设)或是「New iTerm2 Window Here」(自行安装)
https://ithelp.ithome.com.tw/upload/images/20210919/20112053EOOloekX8M.png
4.之後再到你要开启的资料夹点选右键,再输入「code .」就可以开启罗~
https://ithelp.ithome.com.tw/upload/images/20210919/20112053cUPS4KJ0NE.png
https://ithelp.ithome.com.tw/upload/images/20210919/20112053Aqc5lZmEcu.png

外观

设定完之後我们就要来讲美化VSCode的介面,让你在操作上能够更方便

One Dark Pro

自订VS Code外观样式
先安装好One Dark Pro主题後,点击Preferences>Color Theme
https://ithelp.ithome.com.tw/upload/images/20210919/20112053UcogwB6Lbu.png
在选择刚刚安装的One Dark Pro主题
https://ithelp.ithome.com.tw/upload/images/20210919/20112053g8gw9mPGgD.png

vscode-icons

vscode本身没有图示,安装後可以帮你把档案与资料夹icon美化
使用前:
https://ithelp.ithome.com.tw/upload/images/20210919/20112053QxEw5dvv1C.png
使用後:
https://ithelp.ithome.com.tw/upload/images/20210919/20112053wQSTaUzH1z.png

好用套件

TODO Highlight

当你写程序码过程中,突然想到有地方需要补充,但又不想停下手边的工作,打断思路,这功能超好用,只要使用TODO/FIXME关键字,就会把注解高亮起来
https://ithelp.ithome.com.tw/upload/images/20210919/201120536HXodTSKB3.png
但是档案很多就会散落在各个档案里面,这时候还可以搭配Todo Tree,会统整整个专案,依照档案结构来产生树状的列表,相当方便
https://ithelp.ithome.com.tw/upload/images/20210919/20112053VE4aj9lCZn.png

AutoFileName

提示档案位置。有时候我们打相对位置,不确定名称或路径时,都需要打开资料夹去确认,但是用了这套件後,就会出现提示。
https://ithelp.ithome.com.tw/upload/images/20210919/20112053fM4IFjZ9NZ.png

Auto Close Tag

当你打html tag标签时,会帮你把右括号或结束标签补上
https://raw.githubusercontent.com/formulahendry/vscode-auto-close-tag/0c784ff156da350cce8374a7f04759cab7e2aaff/images/usage.gif
图片来源

Auto Rename Tag

修改html tag时,会自动修改对应的标签
https://github.com/formulahendry/vscode-auto-rename-tag/raw/HEAD/images/usage.gif
图片来源

Bracket Pair Colorizer

当程序码多的时候,会变得很难阅读,甚至有时候还会误删或漏掉,导致要找很久,使用这个套件,就会自动将成对的括弧加上颜色,无论是在html、css、js点选括号时,会将对应的括号选起来,阅读程序码很方便。
https://ithelp.ithome.com.tw/upload/images/20210919/201120535pmzeSWukz.png

indent-rainbow

将程序码缩排的部分增加颜色,方便阅读程序码
https://ithelp.ithome.com.tw/upload/images/20210919/20112053MrlgSI04I2.png

Sass/SCSS 相关

Live Sass Compile

即时编译SASS/SCSS成CSS,不需要使用https://ithelp.ithome.com.tw/upload/images/20210919/20112053YvJa90vKFN.png官方直译器与终端机,也可以自订输出的档案位置,超级方便~
https://ithelp.ithome.com.tw/upload/images/20210919/20112053DOksoPmflG.png
档案>喜好设定>设定,搜寻「livesass」就会出现安装Live Sass Compile的设定
https://ithelp.ithome.com.tw/upload/images/20210919/20112053l14Z6F45LO.png
在setting.json里面输入你的设定,就完成罗~以下是我的设定
https://ithelp.ithome.com.tw/upload/images/20210919/20112053XiWc95LfPn.png
format的设定属性有四种:

  • nested (预设的样式) : 巢状显示
  • expanded : 不要巢状
  • compact : 简洁样式,缩进成一行
  • compressed :压缩模式

Live Server

使用虚拟路由执行网页,存档时候,会自动在浏览器新开网页,显示最新存档後的画面
按下右下角「Go Live」
https://ithelp.ithome.com.tw/upload/images/20210919/201120536OQUkdwyjI.png
点击启动後,网址会是「 http://127.0.0.1:5501/ 」,当你在编辑器修改後,画面就会立即改变
https://ithelp.ithome.com.tw/upload/images/20210919/20112053XmrVgHnkLp.png

版本控制

Git History

以GUI的格式显示Git的commit资讯
https://ithelp.ithome.com.tw/upload/images/20210919/20112053EmQBtYoOGP.png
可以查看提交纪录,有更动左方就会出现提示,还能直接同步提交给远程版本库
https://ithelp.ithome.com.tw/upload/images/20210919/20112053JbNchxIbH3.png

GitLens

https://ithelp.ithome.com.tw/upload/images/20210919/20112053H0O4yVjINt.png
在文件中点击该行,会出现提交讯息、谁提交、时间
https://ithelp.ithome.com.tw/upload/images/20210919/20112053J0fEtnL97x.png
点击右上红框按钮,还以可与内容做比对
https://ithelp.ithome.com.tw/upload/images/20210919/201120531yX7Q1R5vn.png

以上是我使用的工具,推荐给大家!


<<:  Day10 标签

>>:  day 11 - log服务想说的话

[VSCode Extension] VSCodeVim: 系列文目录

大家好,我是韦恩。 这个系列章节我们将会介绍VSCodeVim的使用与教学。 先前我们介绍过了VSC...

JavaScript Day 4. ParseInt / ToString

ParseInt() 直到我在写这篇之前,parseInt 在我心中都还是一个很简单的概念,一个可以...

[ Day 35 ] - Electron 应用程序 - 更新自动化 ( 说明篇 )

已经打包拿到客户那的 Electron 应用程序 , 如果有 BUG 需要更新时该怎麽办呢 ? 一般...

[Day20] placeholder for d10

写在前面 placeholder for d10 placeholder for d10 place...

App Inventor 学习笔记 1 : 显示 List 里的资料

AI2的List很像阵列, 这个App记录读取List的方式 1.使用到的元件: Layout -&...