首页 > 编程知识 正文

vscode怎么安装插件,vscode主题插件

时间:2023-05-06 16:23:08 阅读:35094 作者:4814

vs代码插件开发1.vs代码插件开发官方文档地址https://www.book stack.cn/read/cn-vs代码- docs/readme.MD

2 .全局安装vscode插件脚手架vscode插件脚手架命令和代码生成器

基于NPM install-g yo生成器代码的vs代码脚手架搭建项目

开发和打开yocode3.vscode插件项目的Hello World from vscode出现弹窗,输入f5可执行项目ctrl shift p默认命令test.helloWorld

extension.ts进行适当的指令函数的制作

//the module ' vs code ' containsthevscodeextensibilityapi//importthemoduleandreferenceitwiththealiasvscodeinyourcodebelowityape thismethodiscalledwhenyourextensionisactivated/yourextensionisactivatedtheveryfirsttimethecommandisexecutedexportfunctionactivate {上下文3360 vs code.extension上下文} usetheconsoletooutputdiagnosticinformation (console.log ) anderrors (控制台. error )/thislineofcodewillonlybeexecutedoncewhenyourextensionisactivatedconsole.log (' congratula tions,your extension ' test ) //thecommandhasbeendefinedinthepackage.JSON file//nowprovidetheimplementationofthecommandwithregistercommmand//thecommandidparametermustmatchthecommandfieldinpackage.jsonletdisposable=vs code.commands.register command (()/thecodeyouplaceherewillbeexecutedeverytimeyourcommandisexecuted//displayamessageboxtotheuservscode.window.sindow ); ); context.subscriptions.push (disposable; //thismethodiscalledwhenyourextensionisdeactivatedexportfunctiondeactivate { }完成新命令后,必须修改package.json

{'name': 'test '、' display name ' : ' space-delete-test '、' description': 'space-delete '和' verer } ' categories': ['Other'],' activation events ' : [//vs code扩展的激活事件' onCommand:test.h'//在此为扩展' main ' 3360 './diding ' contributes ' : { ' commands ' : [//在命令行中输入命令{'command': 'test.h ', /此处必须更改为与extension.ts对应的命令名称“title”:“scripts”:“vscode:prepublish':“NPMrunpackage”和“ ' web pack ' package ' 3360 ' web pack-- mode production-- devtoolhidden-source-map ',' test-compile ' 3360 ' TSC-- map ' pretest ' : ' NPM runtest-compilenpmrunlint ',' lint': 'eslint src --ext ts ',' test ' : ' node./out ' eslint': '^7.27.0 ',' @ typescript-eslint/eslint-plugin ' 3360 ' ^4. 26.0 ',' @ typescript-eslint。

使用contributes.commands.register command注册onCommand激活事件,并在输入命令后激活插件,然后在命令行中提供命令

注册地址

https://dev.azure.com

第一步,注册微软账户

第二步,登录点击个人信息,创建新组织

第三步,点击人物头像,选择personal access token,选择所有组织,选择custom define,full access,生成token后记住保管,token重新注册

步骤4,注册publisher需要科学的互联网连接。 这一步我打了半天牌才反应过来

3359 market place.visual studio.com/manage/create publisher? managePageRedirect=true

5 .插件上传插件全局命令

npm install -g vsce必须登录开发人员帐户才能上载到vs代码商店

vsce login publisher您的publisher名称输入token

成功登录后

vsce publish插件版本号注意:每次提交时,版本号必须与以前的版本号不同。 您可以手动更改package.json的版本号或vsce publish patch的自扩展版本号

如果只想在本地打包插件,请

vsce package本地打包完成后,将生成visx文件,并在导入到vs代码插件时在本地启用插件

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。