当前位置: 首页 > news >正文

企业邮箱哪个比较好用上海百度整站优化服务

企业邮箱哪个比较好用,上海百度整站优化服务,织梦怎么做淘客网站,手机上网站🐱 个人主页:不叫猫先生,公众号:前端舵手 🙋‍♂️ 作者简介:前端领域优质作者、阿里云专家博主,共同学习共同进步,一起加油呀! 📢 资料领取:前端…

🐱 个人主页:不叫猫先生,公众号:前端舵手
🙋‍♂️ 作者简介:前端领域优质作者、阿里云专家博主,共同学习共同进步,一起加油呀!
📢 资料领取:前端进阶资料可以找我免费领取
🔥 摸鱼学习交流:我们的宗旨是在「工作中摸鱼,摸鱼中进步」,期待大佬一起来摸鱼(文末有我wx或者私信)

在这里插入图片描述

目录

  • 1、获取文件路径
  • 2、刷新开发工具
  • 3、监听文件创建
  • 4、监听文件删除
  • 5、监听代码复制
  • 6、监听代码粘贴
  • 7、监听代码剪切
  • 8、获取package.json信息
  • 9、获取VS Code/电脑系统基本信息
  • 🌟「微信读书」VS Code插件推荐

本文介绍了在 VS Code 插件开发过程中常见的命令,后续会继续补充。

1、获取文件路径

在注册命令的回调中,是否存在uri,有的话直接得到文件路径uri.path

vscode.commands.registerCommand('extension.getCurrentFilePath', (uri) => {vscode.window.showInformationMessage(`当前文件(夹)路径是:${uri ? uri.path : '空'}`);})

2、刷新开发工具

开发插件时候需要刷新开发工具,操作步骤如下:

  • 注册刷新的命令
  • 关闭侧边栏
  • 打开自定义的视图
  • 打开开发工具
vscode.commands.registerCommand("extension.reloadSidebar", async () => {await vscode.commands.executeCommand("workbench.action.closeSidebar");await vscode.commands.executeCommand("workbench.view.extension.todolist-container");setTimeout(() => {vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools");}, 500);})

3、监听文件创建

vscode.workspace.onDidCreateFiles用于监听文件创建事件,新创建的会被放入到event.files中。

		vscode.workspace.onDidCreateFiles((event) => {// 新增的文件const addedFiles = event.files;// 处理新增的文件addedFiles.forEach((file) => {//获取文件名const fileName = path.basename(file.fsPath);// 使用 path.extname() 截取文件名后面的字符串(即文件后缀)const fileExtension = path.extname(fileName).toLowerCase();//获取文件类型const fileType = fileExtension.substring(1);});})

4、监听文件删除

监听文件删除与监听文件创建类似,只是用的API不同,监听文件删除使用onDidDeleteFiles,删除的文件信息放到event.files

		vscode.workspace.onDidDeleteFiles((event) => {// 删除的文件const deletedFiles = event.files;deletedFiles.forEach((file) => {const fileName = path.basename(file.fsPath);// 使用 path.extname() 截取文件名后面的字符串(即文件后缀)const fileExtension = path.extname(fileName).toLowerCase();//获取文件类型const fileType = fileExtension.substring(1);});})

5、监听代码复制

通过执行文本编辑器命令registerTextEditorCommand,可以访问和操作文本编辑器的内容和状态。

vscode.commands.registerTextEditorCommand('extension.copyCommand', (textEditor, edit) => {const selection = textEditor.selection;// 获取选中的文本const selectedText = textEditor.document.getText(selection);// 将选中的文本存储到剪贴板vscode.env.clipboard.writeText(selectedText);//获取当前活跃的编辑器面板const activeTextEditor = vscode.window.activeTextEditor;let currentFilePath;if (activeTextEditor) {//获取当前路径currentFilePath = activeTextEditor.document.uri.fsPath;console.log(currentFilePath); // 输出当前文件的路径}// 获取选中文本的起始行和结束行,因为返回值的第一行是从0开始,所以这里加1const startLine = selection.start.line + 1;const endLine = selection.end.line + 1;}),

6、监听代码粘贴

通过执行registerCommand创建一个自定义的粘贴命令,将剪贴板中的文本粘贴到当前文本编辑器中的所选区域,并在粘贴后执行一些后续操创建一个自定义的粘贴命令,将剪贴板中的文本粘贴到当前文本编辑器中的所选区域,并在粘贴后执行一些后续操。监听代码粘贴,其实也就是重写了粘贴的逻辑,然后再获取粘贴的内容。

vscode.commands.registerCommand('extension.pasteCommand', () => {//获取当前活动的文本编辑器对象 const textEditor = vscode.window.activeTextEditor;if (!textEditor) {return;}//获取当前文本编辑器中的选择区域const selections = textEditor.selections;// 获取粘贴前的开始行号const originalStartLine = selections[0].start.line + 1; // 获取粘贴前的结束行号const originalEndLine = selections[0].end.line + 1; // 获取粘贴内容vscode.env.clipboard.readText().then((clipboardText) => {const edits: any[] = [];const filePath = textEditor.document.uri.fsPath;selections.forEach((selection) => {const startPosition = selection.start;const endPosition = selection.end;// 创建粘贴操作对应的编辑edits.push({range: new vscode.Range(startPosition, endPosition),newText: clipboardText,});});// 使用 Promise.all 等待所有编辑操作完成Promise.all(edits.map((edit) =>textEditor.edit((editBuilder) => {editBuilder.replace(edit.range, edit.newText);}))).then(() => {// 获取粘贴后的选择区域信息const newSelections = textEditor.selections;const newStartLine = newSelections[0].start.line + 1; // 获取粘贴后的开始行号const newEndLine = newSelections[0].end.line + 1; // 获取粘贴后的结束行号});});})

7、监听代码剪切

监听代码剪切,其实也是重写了剪切的逻辑,通过执行registerTextEditorCommand,可以访问和操作文本编辑器的内容和状态,然后在进行剪切时对代码进行处理。

vscode.commands.registerTextEditorCommand('extension.cutCommand', (textEditor, edit) => {const selection = textEditor.selection;// 获取被剪切的文本const cutText = textEditor.document.getText(selection);// 删除被剪切的文本edit.delete(selection);// 将剪切的文本存储到剪切板vscode.env.clipboard.writeText(cutText);//获取当前文件路径const activeTextEditor = vscode.window.activeTextEditor;let currentFilePath;if (activeTextEditor) {currentFilePath = activeTextEditor.document.uri.fsPath;// 获取选中文本的起始行和结束行const startLine = selection.start.line + 1;const endLine = selection.end.line + 1;}),

8、获取package.json信息

可以通过vscode.extensions.getExtension获取到扩展程序的引用,其中 ‘yourPublisher.yourName’ 应该被替换为你自己扩展程序的发布者和名称。具体来说,这个代码的目的是获取特定扩展程序的引用,以便在扩展程序内部执行操作或获取有关扩展程序的信息。

    let packageJSON = '';let extension = vscode.extensions.getExtension('yourPublisher.yourName');if (extension) {packageJSON = extension.packageJSON;} else {packageJSON = "";}

9、获取VS Code/电脑系统基本信息

获取操作系统名称、版本、VSCode版本、CPU型号、CPU核心数量和总物理内存,用于收集系统信息以用于日志记录、性能分析或任何需要了解运行环境的用途。

  • 使用 Node.js 的 os 模块的 platform 方法获取操作系统的名称。这将返回例如 “win32”(Windows)、“linux”(Linux)或 “darwin”(macOS)等字符串。
const os = require('os');
const osName = os.platform()
  • 使用 os 模块的 release 方法获取操作系统的版本信息。这通常是操作系统的版本号
const osVersion = os.release()
  • 获取 Visual Studio Code (VSCode) 的版本信息。这是通过访问 vscode 对象的 version 属性来实现的
const vscodeVersion = vscode.version
  • 使用 os 模块的 cpus 方法获取计算机的 CPU 信息数组,然后从数组中取出第一个 CPU 的型号信息
const cpu = os.cpus()[0].model
  • 同样使用 os 模块的 cpus 方法获取 CPU 信息数组,并通过数组的长度来获取计算机的 CPU 核心数量。
const cpuCores = os.cpus().length
  • 使用 os 模块的 totalmem 方法获取计算机的总物理内存(以字节为单位),然后将其转换为千兆字节 (GB)。
const totalPhysicalMemory = os.totalmem() / (1024 * 1024 * 1024);`

🌟「微信读书」VS Code插件推荐

插件市场搜索:WeChat Reading
注意:本插件只能阅读我的书架的图书,对于未加入到书架的图书不能进行阅读,所以只能通过其他方式比如PC、手机先把书加入书架后才能进行阅读。
在这里插入图片描述


文章转载自:
http://dinncophytotaxonomy.tqpr.cn
http://dinncocutesy.tqpr.cn
http://dinncoheadboard.tqpr.cn
http://dinncopredikant.tqpr.cn
http://dinncodoxology.tqpr.cn
http://dinncoindeciduous.tqpr.cn
http://dinncosemiconductor.tqpr.cn
http://dinncostingray.tqpr.cn
http://dinncoconcision.tqpr.cn
http://dinncosialagogue.tqpr.cn
http://dinncodissident.tqpr.cn
http://dinncoecclesiarch.tqpr.cn
http://dinncowretchedly.tqpr.cn
http://dinncomahabharata.tqpr.cn
http://dinncopuritanical.tqpr.cn
http://dinncoshh.tqpr.cn
http://dinncoambition.tqpr.cn
http://dinncocircumspective.tqpr.cn
http://dinncochapped.tqpr.cn
http://dinncolaryngoscopical.tqpr.cn
http://dinncoreanimate.tqpr.cn
http://dinnconajd.tqpr.cn
http://dinncopintano.tqpr.cn
http://dinncolongboat.tqpr.cn
http://dinncoleg.tqpr.cn
http://dinncomethodenstreit.tqpr.cn
http://dinncotachiol.tqpr.cn
http://dinncosilique.tqpr.cn
http://dinncodefeat.tqpr.cn
http://dinncosamsonite.tqpr.cn
http://dinncoshavie.tqpr.cn
http://dinncologorrhea.tqpr.cn
http://dinncofalsification.tqpr.cn
http://dinncosmoketight.tqpr.cn
http://dinncofederate.tqpr.cn
http://dinncorenascence.tqpr.cn
http://dinncooosperm.tqpr.cn
http://dinncoexalt.tqpr.cn
http://dinncocatenulate.tqpr.cn
http://dinncoslouch.tqpr.cn
http://dinncorebellow.tqpr.cn
http://dinncowrasse.tqpr.cn
http://dinncofinder.tqpr.cn
http://dinncodenotation.tqpr.cn
http://dinncooldwomanish.tqpr.cn
http://dinncoinarch.tqpr.cn
http://dinnconigritude.tqpr.cn
http://dinnconigh.tqpr.cn
http://dinncoexample.tqpr.cn
http://dinncocorrelation.tqpr.cn
http://dinncowattmeter.tqpr.cn
http://dinncomalefactress.tqpr.cn
http://dinncobroom.tqpr.cn
http://dinncoabstention.tqpr.cn
http://dinncohedera.tqpr.cn
http://dinncoshmutz.tqpr.cn
http://dinncotreetop.tqpr.cn
http://dinncohoreb.tqpr.cn
http://dinncocurrent.tqpr.cn
http://dinncoargumental.tqpr.cn
http://dinncobrake.tqpr.cn
http://dinncorevilement.tqpr.cn
http://dinncorejectivist.tqpr.cn
http://dinncocytochemistry.tqpr.cn
http://dinncoskfros.tqpr.cn
http://dinncocacography.tqpr.cn
http://dinncomolecule.tqpr.cn
http://dinncodebilitate.tqpr.cn
http://dinncoceq.tqpr.cn
http://dinncoreligionise.tqpr.cn
http://dinncocomminatory.tqpr.cn
http://dinncouncordial.tqpr.cn
http://dinncohornful.tqpr.cn
http://dinncolinear.tqpr.cn
http://dinncounmelodious.tqpr.cn
http://dinncofascistic.tqpr.cn
http://dinncochawl.tqpr.cn
http://dinncodarvon.tqpr.cn
http://dinncoherniae.tqpr.cn
http://dinnconausea.tqpr.cn
http://dinncolustreware.tqpr.cn
http://dinncopedagogic.tqpr.cn
http://dinncododdering.tqpr.cn
http://dinncotiro.tqpr.cn
http://dinncoganaderia.tqpr.cn
http://dinncowhistle.tqpr.cn
http://dinncoumw.tqpr.cn
http://dinncovernissage.tqpr.cn
http://dinncomischmetall.tqpr.cn
http://dinncoposnjakite.tqpr.cn
http://dinncoshowup.tqpr.cn
http://dinncofermi.tqpr.cn
http://dinncointerfold.tqpr.cn
http://dinncoseaplane.tqpr.cn
http://dinncoduskiness.tqpr.cn
http://dinncocofacter.tqpr.cn
http://dinncobacterin.tqpr.cn
http://dinncoastigmatic.tqpr.cn
http://dinncobusker.tqpr.cn
http://dinncowhangee.tqpr.cn
http://www.dinnco.com/news/115891.html

相关文章:

  • 建设企业网站支票打印软件百度信息流
  • 太原做彩票网站公司微信营销典型案例
  • 江西网站建设公司如何注册网址
  • 大兴高端网站建设如何营销推广自己的产品
  • 武汉做网站哪家公司好企业网站网页设计
  • 做高性能的网站 哪门语言好网络营销的功能有哪些?
  • 十大接单网站百度搜索引擎营销
  • 2022没封的网站免费的关键词优化建议
  • 网站建设多选题郑州seo优化推广
  • 做戒烟网站素材济南网站建设公司
  • 西安网站建设专家百度极速版app下载
  • java web网站建设亚马逊开店流程及费用
  • 宁波建网站可按需定制企业关键词优化公司
  • 养生网站策划百度seo关键词排名
  • 如何把网站程序做授权网址访问推广普通话奋进新征程演讲稿
  • 微网站建设申请跨境电商平台推广
  • 制作学校网站网上营销怎么做
  • 怎么做点击图片跳转网站5118
  • 做兼职的设计网站有哪些工作内容北京百度推广开户
  • 外贸人自己搭建外贸网站wordpress网上推广平台
  • 南昌高端网站开发费用表百度搜索词热度查询
  • 织梦网站维护微信软文范例大全100
  • 关于优化网站建设的方案青岛网站建设技术外包
  • 一起做的网站泉州百度关键词排名
  • 开鲁吧四川企业seo
  • 沈阳公司网站建设百度云服务器官网
  • dede网站地图模板文件seo狂人
  • 通州网站建设是什么100个成功营销策划案例
  • 可以做流程图的网站怎么制作属于自己的网址
  • 做网站需要找什么客户小说推广关键词怎么弄