是否可以在线路中间崩溃自定义区域?

发布于 2025-01-28 20:58:10 字数 1527 浏览 2 评论 0原文

VS代码支持在行中间创建自定义折叠区域吗?

我有变量以类似于base64的格式存储图片,它们是非常大的字符串,我的目标是折叠不重要的部分,只剩下一些重要的东西:

示例

picture1 ="|<test1>ron[189,278,461,30]*172$461.0000000000000000000000zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzU00000000000000000000000000000000000000TzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzU"

picture2 ="|<test2>dkc[114,100,136,134]*136$136.zzzzzkM00Dzzzk007zzzXzzzzzzw0000Tzzy0007zzy7zzzzzzU0000zzzU000Dzzsm0B8Ty0000000003zzzzz8Ds04ETk000000000TzzzzykUzWV3z0000000003zzzzzxW03vxTw000040000TzzzzzrE0Dyzjk0400M0003zzzzzzz03ysAz00Ts1k001Dzzzzzzw0zvU3w0zzk7U00NzzzzzzXk/zc"

picture3 ="|<test3>zms[650,114,72,48]*180$72.kzz000000000Uzy0000000000zw000000z000000CTU000000000Czk000000000Szk000010000zzk000000001zzk000000003zzk000A00007xzk000C0000Dzzk0008k000Tzzk00080000Tzzk000E3000TzzU00003U"

然后折叠后看起来像这样:

picture1 ="|<test1>ron[189,278,461,30]*172..." 

picture2 ="|<test2>dkc[114,100,136,134]*136..."

picture3 ="|<test3>zms[650,114,72,48]*180...." 

其中...是折叠的字符串的一部分。

我的想法是使用REGEX或类似的恒星区域创建折叠规则

$ 结束区域:

我找到了此扩展名:

,但看起来它

"maptz.regionfolder": {
    "[txt]": {    
        "foldStartRegex": "\\$.*",         
        "foldEndRegex": "\"",         
        "disableFolding": false //Turn off #region folding for this language
    }
},

​字符串是多线,但是当我将其返回到一行时,

将字符串分解为多行。

我的语言不支持 ?

Does VS Code support create custom folding regions in the middle of lines?

I have variables storing pictures in a format similar to base64, they are very large strings, my goal is to fold the not important part, leaving only some important things visible:

Example:

picture1 ="|<test1>ron[189,278,461,30]*172$461.0000000000000000000000zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzU00000000000000000000000000000000000000TzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzU"

picture2 ="|<test2>dkc[114,100,136,134]*136$136.zzzzzkM00Dzzzk007zzzXzzzzzzw0000Tzzy0007zzy7zzzzzzU0000zzzU000Dzzsm0B8Ty0000000003zzzzz8Ds04ETk000000000TzzzzykUzWV3z0000000003zzzzzxW03vxTw000040000TzzzzzrE0Dyzjk0400M0003zzzzzzz03ysAz00Ts1k001Dzzzzzzw0zvU3w0zzk7U00NzzzzzzXk/zc"

picture3 ="|<test3>zms[650,114,72,48]*180$72.kzz000000000Uzy0000000000zw000000z000000CTU000000000Czk000000000Szk000010000zzk000000001zzk000000003zzk000A00007xzk000C0000Dzzk0008k000Tzzk00080000Tzzk000E3000TzzU00003U"

Then after folding it would look like this:

picture1 ="|<test1>ron[189,278,461,30]*172..." 

picture2 ="|<test2>dkc[114,100,136,134]*136..."

picture3 ="|<test3>zms[650,114,72,48]*180...." 

Where ... is the part of the string that got folded.

My idea was to create a folding rule using regex or something similar

Star region: $
End region: "

I have found this extension: maptz.regionfolder, but looks like it doesn't support single line folding.

I have tested it with, settings.json:

"maptz.regionfolder": {
    "[txt]": {    
        "foldStartRegex": "\\$.*",         
        "foldEndRegex": "\"",         
        "disableFolding": false //Turn off #region folding for this language
    }
},

maptz

As seen in the gif, it works as long the string is multi-line, however when i return it to a single line, it doesnt.

My language doesnt support breaking strings into multiple lines.

Does VS Code have built-in support for this? or someone know any other way I could achieve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘你却要生生世世 2025-02-04 20:58:10

多亏了这个问题避免在html标签(vscode)中避免省略可以对您有用的扩展名: inline fold 。首先是演示:

“

我使用了这些设置(在settings.json中):

"inlineFold.unfoldedOpacity": 0.6,
"inlineFold.maskChar": "…",
"inlineFold.maskColor": "#fff",      // change to match your text color if you like
"inlineFold.supportedLanguages": [   // add your languageID here
  "javascriptreact",
  "typescriptreact",
  "plaintext"
],
"inlineFold.unfoldOnLineSelect": true,

// to make a language-specific setting use something like this:

"[plaintext]": {          // use your languageID here
      // note that many backslashes in JSON need to be escaped themselves
  "inlineFold.regex": "(?<=\"|<.*>.*\\[[\\d,]+\\]\\*\\d\\d\\d)(\\$.*)\"$",
  "inlineFold.regexFlags": "gm",
  "inlineFold.regexGroup": "1",  // takes a string, not a number as the README examples show
  "inlineFold.autoFold": false,
}

我不知道您的语言.txt Demo和LagansingID的文件。

我还制作了此键调整(在keybindings.json中或通过键盘快捷键编辑器):

{
  "key": "ctrl+alt+/",             // whatever keybinding you want
  "command": "inlineFold.toggle"   // look for this in the Keyboard Shortcuts
}

Thanks to this question avoid ellipsis in Html tags (VSCode) I see there is an extension that could work for you: Inline fold. First a demo:

Inline fold extension demo

I used these settings (in settings.json):

"inlineFold.unfoldedOpacity": 0.6,
"inlineFold.maskChar": "…",
"inlineFold.maskColor": "#fff",      // change to match your text color if you like
"inlineFold.supportedLanguages": [   // add your languageID here
  "javascriptreact",
  "typescriptreact",
  "plaintext"
],
"inlineFold.unfoldOnLineSelect": true,

// to make a language-specific setting use something like this:

"[plaintext]": {          // use your languageID here
      // note that many backslashes in JSON need to be escaped themselves
  "inlineFold.regex": "(?<=\"|<.*>.*\\[[\\d,]+\\]\\*\\d\\d\\d)(\\$.*)\"
quot;,
  "inlineFold.regexFlags": "gm",
  "inlineFold.regexGroup": "1",  // takes a string, not a number as the README examples show
  "inlineFold.autoFold": false,
}

I didn't know your language so I just used a plaintext .txt file for the demo and languageID.

I also made this keybinding (in keybindings.json or through the Keyboard Shortcuts editor):

{
  "key": "ctrl+alt+/",             // whatever keybinding you want
  "command": "inlineFold.toggle"   // look for this in the Keyboard Shortcuts
}
泪意 2025-02-04 20:58:10

目前不支持此功能。在VS代码的github repo上跟踪它:支持折叠范围#在线路#折叠范围# 50840 您可以向您的支持显示您的支持。对这个问题给予大拇指的反应。但是请不要发表“我也是”评论。 value。

现在,您可以查看 moalamri.inline-fold 扩展名适用于您的用例 (我与此扩展名没有隶属关系)

This feature is currently not supported. There's a feature-request issue ticket tracking it on VS Code's GitHub repo: Support folding ranges inside a line #50840. You can show your support for the issue ticket by giving a thumbs up reaction to the issue. But please don't make a "me too" comment. "me too" comments generally come off as annoying to repo maintainers because they clutter up discussion and don't contribute anything of significant value.

For now, you can see if the moalamri.inline-fold extension suits your use-case (I have no affiliation with this extension).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文