2017-12-04 编写Visual Studio Code插件初尝试
参考官方入门: Your First Visual Studio Code Extension - Hello World
源码在: program-in-chinese/vscode_helloWorld
创建插件过程中, 发现identifier和publisher name不允许中文命名(报错: invalid xxx):
? What type of extension do you want to create? New Extension (TypeScript)
? What's the name of your extension? 吃了么
? What's the identifier of your extension? hello
? What's the description of your extension? 吃了么
? What's your publisher name (more info: https://code.visualstudio.com/docs/tools/vscecli#_publishing-extensions)? nobody
运行一下Hello World命令, 没问题.
按入门教程替代extension.sayHello命令的内容, 实现显示选中文本长度的演示功能:
var 编辑器 = vscode.window.activeTextEditor;
if (!编辑器) {
return; // 无打开的编辑器
}
var 选中部分 = 编辑器.selection;
var 文本 = 编辑器.document.getText(选中部分);
// 显示信息框
vscode.window.showInformationMessage('选中字符数: ' + 文本.length);
运行Hello World结果:

顺便感受一下调试功能:

2017-12-04 编写Visual Studio Code插件初尝试的更多相关文章
- 令人惊叹的Visual Studio Code插件
vscode是一款开源且优秀的编辑器,接下来让我吐血推荐一下我工作使用过的令人惊叹的Visual Studio Code插件. 代码编辑插件 vscode-color-highlight ------ ...
- .Net Core 常用开发工具(IDE和运行时、Visual Studio插件、Visual Studio Code插件)
IDE和运行时 组件名 描述 可选版本 推荐版本 Visual Studio Community 社区免费版 For Visual Studio 2017 For Visual Studio 2019 ...
- 安装GO语言环境之安装Visual Studio Code插件
在安装Visual Studio Code插件的时候,由于谷歌的限制,在下载下列插件的时候会报错: go get -u -v github.com/nsf/gocode go get -u -v gi ...
- Ubuntu16.04 安装 Visual Studio Code之后启动不起来
$ cd ~/.config $ sudo rm -rf ./Code/ 参考博客:Ubuntu16.04 安装 Visual Studio Code之后启动不起来
- 2017-12-24 为新语言编写Visual Studio Code语法高亮插件
本文源码库: program-in-chinese/quan4-highlighter 语法高亮是一个开发环境的基本功能. 此文尝试为之前的"圈4"语言(详见编程语言试验之Antl ...
- 对于Web开发最棒的22个Visual Studio Code插件
翻译 原文作者:James Quick 原文地址:https://scotch.io/bar-talk/22-best-visual-studio-code-extensions-for- ...
- 30个极大提高开发效率的Visual Studio Code插件
译者按: 看完这篇文章,我打算从 Sublime Text 转到 Visual Studio Code 了! 原文: Immensely upgrade your development enviro ...
- ubuntu14.04 LTS Visual Studio Code 编辑器推荐
除了ubuntu geany (茶壶图标) 这个一直爱好的编辑器,发现一个新的编辑器“Visual Studio Code”,也是很好用,记录下 https://code.visualstudio.c ...
- Visual Studio Code插件
Material Theme 下载量:130 万 Visual Studio Code 最悠久的主题! Auto Import 下载量:46 万 自动去查找.分析.然后提供代码补全.对于 TypeSc ...
随机推荐
- opencv关于Mat类中的Scalar()---颜色赋值
这个 CvScalar就是一个可以用来存放4个double数值的数组(O'Reilly的书上写的是4个整型成员):一般用来存放像素值(不一定是灰度值哦)的,最多可以存放4个通道的. typedef s ...
- python3下获取全局坐标
前段时间自己想用python写一个关于截屏翻译的小功能,所以首先需要获取鼠标的坐标动作有按下.拖拽.释放.查找了很多资料无非是pyhook或者用其他语言重写.但是自己用的是python3.65,第三方 ...
- Spring @Value取值为null或@Autowired注入失败
@Value 用于注入.properties文件中定义的内容 @Autowired 用于装配bean 用法都很简单,很直接,但是稍不注意就会出错.下面就来说说我遇到的问题. 前两天在项目中遇到了一个问 ...
- Posche Piwis 3 Original and Clone – What’s the difference
Category : Car Diagnostic Tools What’s the difference between Porsche Tester Piwis III original and ...
- 《笨方法学Python》加分题35
sys.exit 用于结束程序 from sys import exit # 进入黄金房间后的逻辑 def gold_room(): print("This room is full of ...
- 512MB内存VPS服务器安装宝塔WEB客户端建站 - 环境部署篇
原本以为我们很多网友用VPS搭建网站不会用WEB面板,而采用一键包或者自己部署编译环境,但是最后发现其实目前我们使用WEB面板的还是挺多的,无论是免费还是付费的都有不少人使用.比如当初一直免费的AMH ...
- 在Jenkins上配置批处理删除远程共享目录7天以上的文件
net use * /del /yes NET USE X: \\10.29.48.12\shares\Test password /user:DOMAIN1\account set AutoPath ...
- 真机测试没有问题,but上线后安装在手机上crash。也有无法打包的情况。
图片格式不对,把16位or p3图片改为8位sRGB图片 9.0以前不支持 解决步骤: a.找到导出项目的ipa文件修改后缀名.ipa为.zip后直接解压该文件: b.找到出问题的图片,直接把该图片 ...
- java上传文件常见几种方式
1.ServletFileUpload 表单提交中当提交数据类型是multipare/form-data类型的时候,如果我们用servlet去做处理的话,该http请求就会被servlet容器,包装成 ...
- ZOJ 2507 Let's play a game
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1507 MisereNim博弈.代码如下: //=========== ...