VS Code

时间:2022-02-23 04:59:51

VS Code

VS Code(Visual Studio Code)是由微软研发的一款免费、开源的跨平台文本(代码)编辑器。几乎完美的编辑器。

官网:https://code.visualstudio.com

文档:https://code.visualstudio.com/docs

源码:https://github.com/Microsoft/vscode

本文所使用VS Code版本:1.2.0,1.3.1

如果从官网下载的vscode为英文版(1.39.2),可以安装语言包

1.打开“vscode” ,按快捷键“Ctrl+Shift+P”。
2.在搜索框中输入“configure language”,按回车键,如果没有安装语言包,会提示安装。
3.安装完成后,会提示重启和设置新安装的语言

集成Git

支持git提交

vscode默认已集成git,支持git提交,查看修改列表。

VS Code

Git History

地址:https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory

安装:ext install githistory

Features

  • View the details of a commit, such as author name, email, date, committer name, email, date and comments.
  • View a previous copy of the file or compare it against the local workspace version or a previous version.
  • View the changes to the active line in the editor (Git Blame).
  • Configure the information displayed in the list
  • Use keyboard shortcuts to view history of a file or line

同步vs code 扩展和设置

让vs code的设置,偏好,快捷键设置,扩展等等数据在多台机器上保持同步。

把vs code的数据托管在github的gist服务器,其它机器就可以同步配置和扩展。

扩展:settings sync

文档:https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

安装:ext install code-settings-sync

1. 上传配置到gist

1、Shift + Alt + u 输入在github为vs code创建的 Personal Access Tokens,回车

2、保存 gist id

3、Shift + Alt + u 保存过一次之后,再按此快捷键就是同步数据

更换电脑之后,可以继续使用之前创建的personal access tokens

2. 下载配置到本地

1、Shift + Alt + d 打开输入框,[输入在github为vs code创建的 Personal Access Tokens,回车] vscode 1.10版本无需此步骤

2、输入 gist id

3、等待配置及扩展同步到本地

VS Code

github的gist服务

如何看待 Github Gist这个服务,怎样更好的利用?

创建Personal Access Tokens:https://github.com/settings/tokens

使用感受

1. github创建的Personal Access Tokens ,创建成功之后是可以再次编辑的

2. 一定要保存好 github创建的 Personal Access Tokens

2. 一定要保存好 code setting sync的gist id。这个id用于在多台机器上保持同步。

文本编辑及快捷键

多列编辑

Shift + Alt +鼠标左键

Markdown

默认已支持实时预览,我使用的vs code1.2版本

预览:Ctrl + K ,V 在右侧窗口打开预览,支持实时预览改动部分

Ctrl + Shift + V 快速预览当前文档

文档:https://code.visualstudio.com/docs/languages/markdown

配置或查看快捷键

选择 文件 - 首选项 - 键盘快捷方式 打开keybinding.json,可以修改或查看vscode的快捷键

VS Code

打开命令行 (>)

Ctrl + Shift + P

常用快捷键

Ctrl + P  打开扩展管理器

Ctrl + Shift + K 删除当前行

Ctrl + B  显示/隐藏侧边栏

离线安装vs code扩展

以安装 vscode-instant-markdown 为例:https://marketplace.visualstudio.com/items?itemName=dbankier.vscode-instant-markdown

Mac & Linux

cd $HOME/.vscode/extensions
git clone https://github.com/dbankier/vscode-instant-markdown.git
cd vscode-instant-markdown
npm install

Windows

cd %USERPROFILE%\.vscode\extensions
git clone https://github.com/dbankier/vscode-instant-markdown.git
cd vscode-instant-markdown
npm install

VS Code

'npm' 不是内部或外部命令…

如果你在安装时,出现上述提示,那么你需要安装nodejs

1. 打开nodejs的官网下载:https://nodejs.org/en/

2. 运行安装程序,进行安装,会自动配置环境变量和安装npm package manager

3. 再次安装vs code 扩展

VS Code

vs code 扩展

1. vs code安装扩展

1、在vs code中按 Ctrl + P,打开扩展管理器

2、输入安装代码: ext install 扩展名 ,键盘选择要安装的扩展,按回车

VS Code

3、安装完成后,会提示重启

VS Code

2. 浏览插件库

https://marketplace.visualstudio.com/VSCode

3. csharp

地址:https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp

安装:ext install csharp

安装之后报错:The .NET CLI tools cannot be located. .NET Core debugging will not be enabled. Make sure .NET CLI tools are installed and are on the path.

VS Code

4. HTML CSS Class Completion

说明:我安装的vs code默认已支持css,javascript。可检查css,html语法错误

地址:https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion

安装:ext install html-css-class-completion

5. PowerShell

地址:https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell

安装:ext install PowerShell

6. Lua

地址:https://marketplace.visualstudio.com/items?itemName=keyring.Lua

安装:ext install Lua

7. Java Snippets

地址:https://marketplace.visualstudio.com/items?itemName=tushortz.java-snippets

安装:ext install java-snippets

8. python

地址:https://marketplace.visualstudio.com/items?itemName=donjayamanne.python

安装:ext install python

9. Project Manager

功能:Manage your projects right inside Visual Studio Code. Easily access and switch between them.

使用方法

1、ctrl +shift + p 打开命令行,输入:project save ,选择Project Manager: Save Project

VS Code

2、输入要保存当前工程的名字

VS Code

3、查看或修改保存的工程

ctrl +shift + p 打开命令行,输入:project edit,选择Project Manager: Edit Project

VS Code

project.json

[
    {

"label": "simpleframework",

"description": "d:\\Unity3D\\SimpleFramework_NGUI\\Assets"

}

]

地址:https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager

安装:ext install project-manager

10. Bookmarks

功能:Mark lines in the editor and easily jump to them.

地址:https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks

安装:ext install Bookmarks

VS Code的更多相关文章

  1. Visual Studio Code 代理设置

    Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...

  2. 我们是怎么做Code Review的

    前几天看了<Code Review 程序员的寄望与哀伤>,想到我们团队开展Code Review也有2年了,结果还算比较满意,有些经验应该可以和大家一起分享.探讨.我们为什么要推行Code ...

  3. Code Review 程序员的寄望与哀伤

    一个程序员,他写完了代码,在测试环境通过了测试,然后他把它发布到了线上生产环境,但很快就发现在生产环境上出了问题,有潜在的 bug. 事后分析,是生产环境的一些微妙差异,使得这种 bug 场景在线下测 ...

  4. 从Script到Code Blocks、Code Behind到MVC、MVP、MVVM

    刚过去的周五(3-14)例行地主持了技术会议,主题正好是<UI层的设计模式——从Script.Code Behind到MVC.MVP.MVVM>,是前一天晚上才定的,中午花了半小时准备了下 ...

  5. 在Visual Studio Code中配置GO开发环境

    一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...

  6. 代码的坏味道(14)——重复代码&lpar;Duplicate Code&rpar;

    坏味道--重复代码(Duplicate Code) 重复代码堪称为代码坏味道之首.消除重复代码总是有利无害的. 特征 两个代码片段看上去几乎一样. 问题原因 重复代码通常发生在多个程序员同时在同一程序 ...

  7. http status code

    属于转载 http status code:200:成功,服务器已成功处理了请求,通常这表示服务器提供了请求的网页 404:未找到,服务器未找到 201-206都表示服务器成功处理了请求的状态代码,说 ...

  8. Visual Studio Code——Angular2 Hello World 之 2&period;0

    最近看到一篇用Visual Studio Code开发Angular2的文章,也是一篇入门教程,地址为:使用Visual Studio Code開發Angular 2專案.这里按部就班的做了一遍,感觉 ...

  9. WebStorm 2016 最新版激活&lpar;activation code方式&rpar;

    WebStorm 2016 最新版激活(activation code方式) WebStorm activation code WebStorm 最新版本激活方式: 今天下载最新版本的WebStorm ...

  10. docker4dotnet &num;3 在macOS上使用Visual Studio Code和Docker开发asp&period;net core和mysql应用

    .net猿遇到了小鲸鱼,觉得越来越兴奋.本来.net猿只是在透过家里那田子窗看外面的世界,但是看着海峡对岸的苹果园越来越茂盛,实在不想再去做一只宅猿了.于是,.net猿决定搭上小鲸鱼的渡轮到苹果园去看 ...

随机推荐

  1. IOS OC 计算器算法&lpar;不考虑优先级&rpar;

    个人见解:为还在计算器算法方面迷惑的同学一个数据处理解决方案:定义一个可变数组array,一个可变字符串str,使字符通过[array addObject:str];方法添加到可变数组,每当触发运算符 ...

  2. CentOS7&period;1 JDK安装 和 CentOS7&period;1配置yum源

    1.卸载自带OPENJDK #查看自身jdk java -verson #查看自身安装的java  rpm -qa | grep java #显示如下 python-javapackages-3.4. ...

  3. 用普通PC主板的蜂鸣器给树莓派(RPI)加个报警器

    这两天有点时间,捣鼓了下那闲置好久的树莓派,把普通PC主板的蜂鸣器作为树莓派的报警器用. Raspberry Pi有许多的GPIO(General Purpose Input Output:通用输入/ ...

  4. A Game of Thrones&lpar;14&rpar; - Catelyn

    Ned and the girls were eight days gone when Maester Luwin came to her one night in Bran’s sickroom, ...

  5. vue-webpack-boilerplate分析

    看完这篇文章你会学到通过vue-cli创建的项目,执行npm run dev后都发生了什么事情以及执行流程. 在创建vue项目时,官方推荐使用vue-cli这个命令行工具. # 全局安装 vue-cl ...

  6. 小组团队项目的NABCD分析

    N:1.学校中有很多学生是外省的,然后不知道附近有什么地方周末可以去玩,有时候想记录自己每天发生的乐趣事情并且想跟别人分享.2.学校中学生有很多用不到的东西但是联系不到合适的买家.A:我们可以做一个软 ...

  7. Oracle中对number类型数据to&lowbar;char&lpar;&rpar;出现各位少0&comma;或者值为&num;&num;&num;的处理

    问题描述: 在Oracle中使用to_char()函数时当number值为小数时,常常个位0不显示 比如:select to_char(0.02) from dual,结果为.02 改进为 selec ...

  8. Leetcode 89

    回溯写到自闭:不想就删了: class Solution { public: vector<int> grayCode(int n) { vector<vector<int&g ...

  9. SourceInsight自定义常用快捷键

    1.快速显示文件大纲,类似于eclipse中的Ctrl+O: “Options”-"Key Assignments"-"Symbol: Browse Local File ...

  10. c primer plus 5 读书笔记1

    C语言是一种融合了控制特性的语言,是一种快速.高效.紧凑.可移植性的语言. 使用C语言的7个步骤:定义程序目标.设计程序.编写代码.编译程序.运行程序.测试和调试程序.维护和修改程序. c程序是由一个 ...