简体   繁体   English

Go 到 VSCode 中的下一个方法快捷方式

[英]Go to next method shortcut in VSCode

Does VSCode have shortcut to move to next method definition in the same file? VSCode 是否有快捷方式可以移动到同一文件中的下一个方法定义? I can't find anything like this in settings.我在设置中找不到这样的东西。

IntelliJ has this feature, for example, you can find this as Next Method in settings IntelliJ 有这个功能,例如,你可以在设置中找到它作为Next Method

To achieve this I have developed an extension that provides two key commands to navigate up and down through the members in your file.为了实现这一点,我开发了一个扩展,它提供了两个关键命令来在文件中的成员中上下导航。

https://marketplace.visualstudio.com/items?itemName=mishkinf.goto-next-previous-member#overview https://marketplace.visualstudio.com/items?itemName=mishkinf.goto-next-previous-member#overview

Visual Studio Code Extension to navigate through the functions, variables, and classes using quick and easy keycommands similar to functionality provided by IntelliJ IDE's (next/previous function) or Resharper (next/previous member) Visual Studio Code 扩展使用类似于 IntelliJ IDE(下一个/上一个函数)或 Resharper(下一个/上一个成员)提供的功能的快速简单的键盘命令来浏览函数、变量和类

Let me know if there any features you would like added.如果您想添加任何功能,请告诉我。

Old question, but I found interacting with the breadcrumb useful.老问题,但我发现与面包屑交互很有用。 ctrl-shift-. takes focus to the breadcrumb and up and down arrows move through the outline, with the bonus that the editor follows.将焦点放在面包屑上,向上和向下箭头在大纲中移动,编辑器会跟随。

Another option is to use Go to Symbol in Editor default hotkey is Ctrl+Shift+o .另一种选择是Go to Symbol in Editor使用Go to Symbol in Editor默认热键是Ctrl+Shift+o Then type : for sorting.然后键入:进行排序。

I would like to have few notes about others solutions and my own:我想对其他解决方案和我自己的解决方案做一些说明:

  • Malks solution is great for MacOS this worked for me cmd+shift+. Malks解决方案非常适合 MacOS,这对我有用cmd+shift+.

  • Mishkin using a specific extension probably is the ideal solution, however it didn't work for me in MacOS tried to remap to my own shortcuts and config it still nothing worked.使用特定扩展名的Mishkin可能是理想的解决方案,但是它在 MacOS 中对我不起作用试图重新映射到我自己的快捷方式并配置它仍然没有任何效果。

  • Lex solution takes you to a specific line (which can be directly achieved by CMD+L in MacOS). Lex解决方案将您带到特定的行(在 MacOS 中可以通过CMD+L直接实现)。


Eventually the best solution for me at least is to start picking up the basics of VIM motions and install the Vim extension.最终对我来说最好的解决方案至少是开始学习 VIM 动作的基础知识并安装 Vim 扩展。

in my setting.json:在我的设置中。json:

"editor.linernumber": "relative"

now in insert mode writing k+{line-number} will take me to the line immediately I want to go to现在在插入模式下写 k+{line-number} 会立即带我到我想要的行 go

Without vim motion is possible you will use CMD+L .没有 vim 运动是可能的,你将使用CMD+L

However, we would like to move from one function to the other in-which we will:但是,我们想从一个 function 转移到另一个,我们将:

this highly dependable on your language thought (you can config and create your own binding).这高度依赖于您的语言思想(您可以配置和创建自己的绑定)。

In python you can use: ]m and [m .在 python 中,您可以使用: ]m[m ( readthis ) 读这个

and so on.等等。


Another option much easier than picking-up VIM-motions, is to use this extension Jump (Publisher: Wenfang Du)另一个比获取 VIM 动作更容易的选择是使用这个扩展Jump (发布者:Wenfang Du)

It will send the cursoer to start/end of a specific word (you can use it mutliple times to reach a specific function).它会将光标发送到特定单词的开始/结束(您可以多次使用它来达到特定功能)。

OPT/ALT+Q OPT/ALT+W : is the default to jump to end of a word (change this shortcut to somethign faster). OPT/ALT+Q OPT/ALT+W :默认跳转到单词的末尾(将此快捷方式更改为更快)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 VScode 中,有没有办法通过快捷方式每两三行 go 下一行? - In VScode, is there a way to go next line per two or three with shortcut? VSCode 实现方法快捷方式 - VSCode Implement Method Shortcut VsCode 快捷方式不会 go 来实现 - VsCode shortcut doesn't go to implementation Vscode“下一个搜索结果”快捷方式不起作用 - Vscode “next search result” shortcut does not work 是否有一个 VSCode 快捷方式可以告诉我下一个快捷方式运行什么命令? - Is there a VSCode shortcut which tells me what command the next shortcut runs? 在 VSCode 的大纲面板中选择上一个或下一个项目的快捷方式 - Shortcut for selecting previous or next item in outline panel in VSCode 如何在 VSCode 中“转到定义”到 super class 的方法 - How to "go to definition" to a method of super class in VSCode 当我在代码中时,是否有 go 按回车键和 go 到下一行的任何 vs 代码快捷方式? - Is there any vs code shortcut to go press enter and go to next line while I am inside a code? go 的 VSCode 键盘快捷键使用侧面数字键盘(和/或顶部数字栏)拆分 windows - VSCode keyboard shortcut to go to split windows using the side numeric keypad (and/or top number bar) VSCode基于文件名的快捷方式 - VSCode Shortcut based on filename
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM