Ubuntu 14.04 下使用微软的跨平台轻量级开发神器 Visual Studio Code
因为 Visual Studio Code 不断更新,官方最新 v1.32 的 .deb 包已经不能用于 Ubuntu 14.04 直接安装了。
下载 v1.31 的 deb 包安装即可:https://code.visualstudio.com/updates/v1_31 (兼容 Ubuntu 14.04,并且支持 Vim 插件)
下载 v1.30 的 deb 包安装即可:https://code.visualstudio.com/updates/v1_30
如果要用最新版,在官网下载免安装版 .tar.gz : https://code.visualstudio.com/#alt-downloads
需要首先安装 libnss3,
sudo apt-get install libnss3
直接解压缩 .tar.gz 到 /opt,设置环境变量即可使用。
above is obsolete
目前已安装的插件记录如下: (Version: 1.39)
===================================================
Atom One Dark Theme
Atom One Light Theme
Dracula At Night (比较好的黑色背景)
Dracula Theme
Auto Close Tag (不太有用)
Auto Rename Tag (HTML tag 的配对更改)
Beautify (支持 HTML,JavaScript,CSS, JSON 的格式化,选中区域按 F1,或直接按 F1 对全文进行格式整理)
Bracket Pair Colorizer (只在黑屏背景表现不错)
C/C++ (C/C++ 的自动补全)
Code Runner (ctrl + alt + n 运行,ctrl + alt + m 停止)
HTML Boilerplate (HTML5 的简易模板)
jshint (JavaScript 的自动补全)
Path intellisense (路径自动补全)
SQLTools (对常用数据库的可视化操作,对 SQLite 支持不太好,见下述 X9 问题及解决方案)
SQLite (对 SQLite 支持很好)
Vim (提供的 vim 功能)
GitLens (适合团队开发,个人开发不建议使用,硬盘读写太厉害……老旧机器吃不消)
Git History (和 GitLens 功能类似)
ESLint (ECMA Script lint,jshint 已有类似功能,并且效果更佳)
Path Autocomplete (路径自动补全,和 Path intellisense 功能类似)
Python Extension Pack (包括如下)
- Django (不太有用,Python 扩展已经支持 Django 的补全)
- Jinja (不太有用,Jinja2 模板的代码着色工具)
- MagicPython (不太有用,Python 的一个语法加亮工具)
- Visual Studio IntelliCode (如果能上网,并且如果 jedi 不好使,可以试一下这个)
- Python (如果 jedi 可用,推荐单独安装这一个,Python 的自动补全,也支持 Django 的自动补全,个人感觉比 IntelliCode 静态分析做的好一些……)
REST Client (REST Client for Visual Studio Code
vscode-cudacpp (CUDA C++ language support for Visual Studio Code)
Upper Case SQL
JS & CSS Minifier (Javascript 和 CSS 的压缩工具,安装之后状态栏左下角会有 X Minify 标志,(首先,点击即可压缩当前的 xxx.css 为 xxx.min.css (此文件自动生成),反之,如果要从 min 格式到正常格式,使用 上述的 Beauty 插件即可)
===================================================
当前 settings.json 配置为 (需根据实际情况修订),
{
"editor.fontFamily": "'ubuntu mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
"editor.fontSize": 17,
"editor.rulers": [ 120 ],
"editor.minimap.enabled": false,
"editor.suggestSelection": "first",
"editor.snippetSuggestions": "none",
"files.autoSave": "off",
"update.enableWindowsBackgroundUpdates": false,
"update.showReleaseNotes": false,
"code-runner.executorMap": {
"javascript": "node",
"python": "python3",
"html": "/usr/bin/firefox",
// "html": "/usr/bin/google-chrome",
"c": "cd $dir && clang $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && clang++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
// "php": "/usr/bin/php",
// "perl": "/usr/bin/perl",
// "ruby": "/usr/bin/ruby",
// "go": "go run",
// "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
},
"code-runner.clearPreviousOutput": true,
"code-runner.saveFileBeforeRun": true,
"code-runner.showExecutionMessage": false,
"C_Cpp.updateChannel": "Insiders",
// "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
// "files.associations": {
// "*.html": "html"
// },
// "python.autoUpdateLanguageServer": false,
"jshint.nodePath": "/usr/local/node-v10.16.0-linux-x64/lib/node_modules",
"workbench.startupEditor": "newUntitledFile",
"extensions.ignoreRecommendations": true,
"python.jediPath": "/usr/local/lib/python3.6/dist-packages",
"sqltools.useNodeRuntime": true,
"python.autoUpdateLanguageServer": false,
"terminal.integrated.fontFamily": "'ubuntu mono'",
"terminal.integrated.fontSize": 17,
"debug.console.fontFamily": "'ubuntu mono'",
"debug.console.fontSize": 17,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--disable=all",
"--enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode",
],
"extensions.autoUpdate": false,
}
暂时这些,其它可参考这里:
https://blog.csdn.net/shenxianhui1995/article/details/81604818
https://blog.csdn.net/win7583362/article/details/79315055/
X1. 插件的配置
File -> Preferences -> Settings -> User Settings -> Extensions -> Run Code configurations -> Executor Map (Edit in settings.json)
例如,
{
"workbench.colorTheme": "Default Light+",
"editor.fontFamily": "'ubuntu mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",
"editor.fontSize": 18,
"editor.minimap.enabled": false,
"editor.rulers": [
120
],
"files.autoSave": "off",
"update.enableWindowsBackgroundUpdates": false,
"update.mode": "manual",
"update.showReleaseNotes": false,
"code-runner.executorMap": {
"javascript": "node",
// "php": "C:\\php\\php.exe",
"python": "python3",
// "perl": "perl",
// "ruby": "C:\\Ruby23-x64\\bin\\ruby.exe",
// "go": "go run",
"html": "/usr/bin/firefox",
// "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && clang $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && clang++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
},
"code-runner.clearPreviousOutput": true,
"code-runner.saveFileBeforeRun": true,
}
注意:调试 html 时,先手动把 firefox 打开,然后在 vscode 里可多次 run html 文件,否则如果依赖 vscode 打开 firefox,则下一次 run 同样的文件,会显示 code is already running 而不会更新 firefox 内容。
X2. 增加 Editor ruler
File -> Preferences -> Settings -> 搜索 ruler -> Editor:Rulers (Edit in settings.json),加入 如下配置(注意,可配置多条 ruler 线,如下配置两条),
"editor.rulers":[80, 120],
X3. 设置 Jedi 为 Python 的默认补全引擎
安装 Python Extension Pack 之后,Python 的默认补全引擎是 Microsoft Python Analysis Engine, 每次启动 vscode 都会下载或更新,并且导致下载更新阶段 Python 补全不能用。所以这里直接禁掉默认引擎,而使用 Jedi 进行补全。
$ sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jedi
设置方法: File -> Preferences -> Settings -> 搜索 jedi -> 勾选 Jedi Enable -> 设置 Jedi Path 为安装路径 (例如 /usr/local/lib/python3.6/site-packages) -> 再搜索 auto update language server -> 取消 Automatically update the language server -> 回到主界面 Extension -> Disable 掉 Visual Studio IntelliCode.
X4. jshint 的安装配置
首先通过 Terminal 安装 jshint library,
$ sudo npm install -g jshint
安装完成后,jshint 会在 /usr/bin/jshint,而库文件在 /usr/lib/node_modules 下的 jshint.
通过 VScode 安装 jshint 插件,然后在settings.json 中设置,
"jshint.nodePath" : "/usr/lib/node_modules",
这样就能通过 jshint 实时检查 javascript 的 warning ,error 等信息了。
X5. SQLTools 配置
简单使用 SQLite3 时的简单配置,具体使用方法可见: https://vscode-sqltools.mteixeira.dev/features/sessions-and-multiple-connections
"sqltools.useNodeRuntime": true,
X6. 离线安装插件
对于不能联网的计算机,可以离线安装扩展,
在 https://marketplace.visualstudio.com/vscode 搜索需要的插件,例如 SQLTools,在插件展示页面找到 Download Extension,下载例如 mtxr.sqltools-0.21.0.vsix,然后可以直接安装,
$ sudo code --install-extension <path-to-vsix>
使用 $ code --help 查看更多可用选项。
X7. 解决 Pylint 对 Django 的误报问题
安装 pylint-django,
$ sudo pip3 install pylint-django
并添加配置,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--disable=all",
"--enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode",
],
详情可参见官方文档 https://code.visualstudio.com/docs/python/linting
X8. 常用快捷键
Ctrl + Shift + p : 打开 Command Palette (然后可以使用相关 Extension 的命令,比如 SQLite xxx)
Ctrl + ` : 打开 Terminal
F5 : 开始 Debugging 模式运行
Shift + F5 : 停止 Debugging 运行
Ctrl + Shift + F5 : 重新开始 Debugging 运行
X9. SQLTools 插件可能遇到的问题
(1)创建 sqlite 连接时,提示需要安装 sqlite3@4.0.8,但是点击提示框的 install,安装失败。
解决方法:先保存新建的连接,然后点击连接,这时会再次弹出 sqlite3@4.0.8 的安装提示,这时再点击 install 即可安装成功。
(2)创建 sqlite 连接时,选择当前工程目录的数据库文件,例如 db.sqlite3,提示 SQLITE_CANTOPEN: unable to open database file
解决方法:将当前工程目录的数据库文件改为相对路径即可,即 ./db.sqlite3
X10. 由于 VScode 升级引起的 HTML Mirror Cursor 的问题
打开 Settings,输入 html.mirror,然后取消 HTML: Mirror Cursor On Matching Tag 即可。
X11. 常用快捷键定义
https://www.cnblogs.com/gaowengang/p/11372309.html
--------------------------------------------
注:这个免费的杂牌军,好使 ;-p
Ubuntu 14.04 下使用微软的跨平台轻量级开发神器 Visual Studio Code的更多相关文章
- Ubuntu 14.04 下搭建SVN服务器 svn://
Ubuntu 14.04 下搭建SVN服务器 svn:// 安装软件包: sudo apt-get install subversion 之后选择SVN服务文件及配置文件的放置位置.我放在了/srv下 ...
- Ubuntu 14.04下安装功能强大的屏幕截图软件 Shutter
[注释]试用了一下,果然很强大,牛逼 一款功能强大的屏幕截图软件——Shutter,Shutter最基本的就是截图功能了,在设计上可以自由选定区域,同时选定之 后依然可以通过上下左右四个地方来改变选区 ...
- 解决ubuntu 14.04 下eclipse 3.7.2 不能启动,报Could not detect registered XULRunner to use 或 org.eclipse.swt.SWTError: XPCOM 等问题的处理
对于eclipse 3.7.2在ubuntu 14.04下不能启动,需要在 eclipse/configuration 目录下的config.ini文件内增加一行org.eclipse.swt.bro ...
- Ubuntu 14.04下java开发环境的搭建--3--Tomcat及MySQL的安装
前面两篇文章,已经说明了JDK和Eclipse 的安装方法,下面简单说一下,Tomcat及MySQL的安装方法. Tomcat的安装. 在合适的地方解压apache-tomcat-6.0.39.tar ...
- Ubuntu 14.04 下手动安装Firefox的Flash插件
有时候我们不得不採用手动安装一些软件. Ubuntu 14.04 下手动安装Firefox的Flash插件有下面几步 1. 下载Flash插件 下载地址为http://get.adobe.com/cn ...
- 分布式进阶(二)Ubuntu 14.04下安装Dockr图文教程(一)
当前,完全硬件虚拟化技术(KVM.Xen.Hyper-V 等)能在一个物理主机上很好地运行多个互相独立的操作系统,但这也带来一些问题:性能不佳,资源浪费,系统反应迟缓等.有时候对用户来说,完全的硬件虚 ...
- Ubuntu 14.04 下安装 OpenCV
参考: Installation in Linux Error compiling OpenCV, fatal error: stdlib.h: No such file or directory 图 ...
- Ubuntu 14.04 下搭建SVN服务器 (转载自 http://www.linuxidc.com/Linux/2015-01/111956.htm)-------------我所用到是红色字体
http://www.linuxidc.com/Linux/2015-01/111956.htm Ubuntu 14.04 下搭建SVN服务器 svn:// 安装软件包: sudo apt-get i ...
- Ubuntu 14.04下如何更换更新源(更新为163源)
之前的安装ubuntu桌面版的之后安装yum,vim等会遇到一些问题, 比如:Ubuntu 14.04下如何更换更新源(更新为163源) 解决: http://jingyan.baidu.com/ar ...
随机推荐
- kubernetes 客户端KubeClient使用及常用api
KubeClient是kubernetes 的C#语言客户端简单易用,KubeClient是.NET Core(目标netstandard1.4)的可扩展Kubernetes API客户端, gith ...
- dotnet中Stream、string及byte[]的相关操作
string与byte[](UTF-8) //string to byte[] string str = "abc中文"; //0x61 0x62 0x63 0xE4 0xB8 0 ...
- Git分布式版本控制器安装注意点及其常用命令
将git按照默认选项下载安装后,打开git bach版面进行git命令行操作(记住在安装的过程中文件夹中不能存在中文):注:Windows下,路径名不要包含中文,因为Git对中文支持不给力,可能会存在 ...
- C语言ftell()函数
ftell()函数返回指定流的当前文件指针的位置.在文件末尾移动文件指针后,我们可以使用ftell()函数获取文件的总大小.可以使用SEEK_END常量来将文件指针移动文件末尾. ftell()函 ...
- 机器学习基石笔记:01 The Learning Problem
原文地址:https://www.jianshu.com/p/bd7cb6c78e5e 什么时候适合用机器学习算法? 存在某种规则/模式,能够使性能提升,比如准确率: 这种规则难以程序化定义,人难以给 ...
- pandas列合并为一行
将dataframe利用pandas列合并为一行,类似于sql的GROUP_CONCAT函数.例如如下dataframe id_part pred pred_class v_id 0 d 0 0.12 ...
- EF实体实现链接字符串加密
1.加密解密方法 using System;using System.Security.Cryptography; using System.Text;namespace DBUtility{ /// ...
- zk分布式任务管理
在我们的系统开发过程 中不可避免的会使用到定时任务的功能,而当我们在生产环境部署的服务超过1台时,就需要考虑任务调度的问题,防止两台或多台服务器上执行同一个任务,这个问题今天咱们就用zookeeper ...
- golang实现aes-cbc-256加密解密过程记录
我为什么吃撑了要实现go的aes-cbc-256加密解密功能? 之前的项目是用php实现的,现在准备用go重构,需要用到这个功能,这么常用的功能上网一搜一大把现成例子,于是基于go现有api分分钟实现 ...
- DS标签控件文本解析格式
DS标签控件使用DSL文本渲染引擎,支持DSL引擎代码.目前支持代码如下: <b>粗体</b> 以粗体显示 <i>斜体</i> 以斜体显示 <u& ...