用于在“If/End If”之间跳转的键盘快捷键

发布于 2024-12-11 16:02:42 字数 179 浏览 0 评论 0原文

我知道在 C# 中很简单,但是在 VB.Net 中的 If/End If 标记之间跳转的命令是什么,就像在 C# 中的大括号之间跳转一样?

(此问题的 C# 版本:转到 Visual Studio 中的匹配大括号?

I know it's simple to do in C#, but what is the command to jump between If/End If marks in VB.Net like you can jump between braces in C#?

(C#-version of this Question: Go to Matching Brace in Visual Studio?)

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

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

发布评论

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

评论(3

半夏半凉 2024-12-18 16:02:42

如果您使用的是 Visual Studio 2010,则可以使用 Ctrl+Shift+UpCtrl+Shift+向下 在突出显示的参考文献和关键字之间跳转。

由于这些是 If 块,IDE 也会突出显示 Then 关键字,因此只需快速连续点击向上/向下两次即可。向上/向下环绕,因此如果您确实想保存按键,请以“错误”方向敲击按键以到达您想要的位置。

If you're using Visual Studio 2010, you can use Ctrl+Shift+Up and Ctrl+Shift+Down to jump between highlighted references and keywords.

Since these are If blocks, the IDE will highlight the Then keyword as well, so just tap Up/Down twice in rapid succession. Up/down wraps, so if you really want to save a keypress, hit the key in the "wrong" direction to get where you want.

£冰雨忧蓝° 2024-12-18 16:02:42

我将左大括号放在 THEN 之后的注释中,并将匹配的右大括号放在 EndIf 之前的注释中。这是一种允许 VI 使用 % 击键来匹配块的开始/结束的贫民窟方式。

一种更优雅的方法是使用某种能够理解您正在编辑的语言中的块概念的 IDE。有时,此功能称为“折叠编辑器”,根据 http://en.wikipedia.org/wiki/Folding_editor

I've resorted to putting the opening curly-bracket in a comment just after the THEN and a matching closing curly-bracket in a comment before the EndIf. This is a ghetto way of allowing VI to match the start/end of the block using % keystroke.

A more elegant way would be to use some sort of IDE that understands the block concept in the language you are editing. Sometimes this feature is called a "folding editor" as per http://en.wikipedia.org/wiki/Folding_editor

最后的乘客 2024-12-18 16:02:42

当我的插入符位于 if(在 PHP 代码中)时,我看到 else 被标记,
https://google.com/search?q=jump+ Between+if+and+else+in+vscode带我来这里,
并且将各种提示拼凑在一起使我得到了以下命令,
绑定在 Visual Studio Code 又名 VSCode

@ Command Palette (++P @ macOS)
转到上一个符号突出显示
转到下一个符号突出显示

反向工程默认 F7 / +F7 @ keybindings.json:

    {
        "key": "f7",
        "command": "editor.action.wordHighlight.next",
        "when": "editorTextFocus && hasWordHighlights"
    },
    {
        "key": "shift+f7",
        "command": "editor.action.wordHighlight.prev",
        "when": "editorTextFocus && hasWordHighlights"
    },

为了将右手放在小键盘上,
并且有很多组合绑定到其他命令,
我的keybindings.json(语法是.jsonc - 带有注释的 JSON)添加:

    {
        "key": "ctrl+numpad_subtract",
        "command": "editor.action.wordHighlight.prev" // "Go to Previous Symbol Highlight"
    },
    {
        "key": "ctrl+numpad_add",
        "command": "editor.action.wordHighlight.next" // "Go to Next Symbol Highlight"
    },

As I saw else marked when my caret stood at an if (in PHP code),
https://google.com/search?q=jump+between+if+and+else+in+vscode brought me here,
and patching together various hints led me to the following commands,
bound in Visual Studio Code aka VSCode

@ Command Palette (++P @ macOS)
Go to Previous Symbol Highlight
Go to Next Symbol Highlight

Reverse engineered default F7 / +F7 @ keybindings.json:

    {
        "key": "f7",
        "command": "editor.action.wordHighlight.next",
        "when": "editorTextFocus && hasWordHighlights"
    },
    {
        "key": "shift+f7",
        "command": "editor.action.wordHighlight.prev",
        "when": "editorTextFocus && hasWordHighlights"
    },

To fit the right hand over a numpad keyboard,
and having a lot of combinations bound to other commands,
my keybindings.json (syntax is .jsonc - JSON with Comments) adds:

    {
        "key": "ctrl+numpad_subtract",
        "command": "editor.action.wordHighlight.prev" // "Go to Previous Symbol Highlight"
    },
    {
        "key": "ctrl+numpad_add",
        "command": "editor.action.wordHighlight.next" // "Go to Next Symbol Highlight"
    },
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文