首页 > 其他分享 >vscode编辑VBA扩展 XVBA - Live Server VBA 代码格式化 自动缩进错误问题修复

vscode编辑VBA扩展 XVBA - Live Server VBA 代码格式化 自动缩进错误问题修复

时间:2023-03-02 13:11:53浏览次数:42  
标签:VBA 格式化 vscode XVBA Server Live

XVBA - Live Server VBA  v4.0.26版本中,代码格式化时,发现以下问题:

  1. next后面没有字符的时候,不能识别为末行
  2. if then 后面加逻辑单独作为一行时,错误的识别为开始行

解决办法:

找到插件目录(我的是C:\Users\Administrator\.vscode\extensions\local-smart.excel-live-server-4.0.26\dist)中的

bundle.js,用vscode格式化代码,然后编辑修改相应行(我的是14730开始),重新启动vscode,完成!

l = [
                { type: "function", regex: /(?<=sub |function )(.*?)(?=\s*\()/i, indent: "init" },
                { type: "If Then", regex: /^ *If(?!.+Then.+)/i, indent: "start" },
                { type: "Else", regex: /^( *Else)/i, indent: "mid" },
                { type: "End If", regex: /^( *End)(\s)(If)/i, indent: "end" },
                { type: "End Sub", regex: /^( *End)(\s)(Sub|Function)/i, indent: "close" },
                { type: "Do While", regex: /^( *Do) +While/i, indent: "start" },
                { type: "Loop", regex: /^( *Loop)((?!.*).)*$/i, indent: "end" },
                { type: "For Each", regex: /^( *For)(\s)(Each)(.*)/i, indent: "start" },
                { type: "For To", regex: /^( *For)(.*)(to)(.*)/i, indent: "start" },
                { type: "Next", regex: /^( *Next)(.*)/i, indent: "end" },
                { type: "Do Until", regex: /^( *Do)(\s)(Until)(.*)/i, indent: "start" },
                { type: "Do", regex: /^( *Do)((?!.*).)*$/i, indent: "start" },
                { type: "Loop While", regex: /^( *Loop)(\s)(While)(.*)/i, indent: "end" },
                { type: "Loop Until", regex: /^( *Loop)(\s)(Until)(.*)/i, indent: "end" },
                { type: "Select Case", regex: /^( *Select)(\s)(Case)(.*)/i, indent: "start" },
                { type: "Case", regex: /^( *Case)(\s)(.*)/i, indent: "mid+" },
                { type: "End Select", regex: /^( *End)(\s)(Select)/i, indent: "end" },
                { type: "While", regex: /^( *While)(\s)(.*)/i, indent: "start" },
                { type: "Wend", regex: /^( *Wend)/i, indent: "end" },
                { type: "With", regex: /^ *With/i, indent: "start" },
                { type: "End With", regex: /^ *End\s*With/i, indent: "end" },
            ],

 

标签:VBA,格式化,vscode,XVBA,Server,Live
From: https://www.cnblogs.com/yiguxianyun/p/17171445.html

相关文章

  • 使用VSCode代码格式化时, Vetur 与 ESLint 的冲突如何解决?
    前几天VSCode写代码没有提示功能了,试了各种方法都没解决,无奈只能卸载重新下载了新的VSCode工具,下载下来后发现确实可以再次提示了,写代码的感觉又回来了,但是又出现了新问题......
  • VSCode最新版本下载安装详细教程(win10)
    ​  VSCode是Microsoft发布的一款运行于多个操作系统,针对于编写现代Web和云应用的跨平台的源代码编辑器, 可在桌面上运。它具有对JavaScript,TypeScript和Node.js的内置......
  • vscode 配置typescript开发
    今天介绍如何用vscode开发typescript程序,开始前我们需要一点小小的配置:下载vscode,这个就不用说了,下面直接给出链接地址:vscode下载安装node.js.安装typescriptnod......
  • vscode 中前端代码不能通过ctrl+鼠标左键点击跳转
    1.ctrl+p查找jsconfig.json文件。如果没有,就在根目录下新建jsconfig.json2.若已经有文件,如下图新增paths 若没有,复制下面内容到jsconfig.json{"compilerOpti......
  • VSCode通过snippet generator生成自定义代码片段
    在线地址:https://snippet-generator.app/ 在VSCode左下角设置中找到“用户代码片段”进行添加  删除代码片段文件创建后会一直保存在本地电脑中,无法直接在VSCod......
  • VScode+Markdown+PicGo
    在Vscode上写Markdown代码,并且用PicGo上传图片。以下内容有Markdown插件OfficeViewer,所见即所得。注意此插件的编辑模式下不能使用PicGo扩展,只有VS的普......
  • 第二节:代码片段的制作(以VSCode、HbuilderX为例)
    一. VSCode片段       二.HbuilderX片段       三.其它        !作       者:Yaopengfei(姚鹏飞)博......
  • 使用vscode编辑markdown
    目录markdown在vscode中的使用标题一级标题二级标题三级标题四级标题五级标题六级标题列表图片表格网址代码文本样式引用目录vscode中使用的插件推荐截图工具推荐markdown......
  • vscode
    title:VScode相关comments:truecategories:技术点教学tags:-vscode-开发工具类excerpt:vscode的快捷键、插件和一些配置和知识toc:truedate:2023-1-17......
  • vscode跟踪vue代码方法
    首先安装插件同时打开上面的右边的齿轮图标,就是打开文件launch.json{//UseIntelliSensetolearnaboutpossibleattributes.//Hovertoviewdescriptionsof......