GithubHelp home page GithubHelp logo

iket0731 / vscode-symbol-navigate-back Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 715 KB

Symbol Navigate Back Extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=iket0731.symbol-navigate-back

License: MIT License

TypeScript 100.00%
vscode vscode-extension goto-definition go-to-definition code-navigation

vscode-symbol-navigate-back's Introduction

Symbol Navigate Back

Jump back from "Go to Definition" (F12)

This extension provides alternative commands for symbol navigation commands such as Go to Definition (F12), Go to Implementation (Ctrl+F12) , and Go to References (Shift+F12).

The alternative commands save the current cursor position (add it to the internal stack) and then call the original command to jump. You can return directly to the original position regardless of cursor movement or editing at the jump destination.


Example: Go to definition (F12), PageDown several times, and then go back

About built-in "Go Back"

You can also use VSCode built-in Go Back command (default keymap: Alt+Left / Ctrl+-) to return to the original position. However, depending on cursor move operations at the jump destination (Searching, scrolling by PageUp / PageDown, etc), the cursor position will be added to the history, so you may need to Go Back many times.

How to Use

Copy and paste the following settings into your keybindings.json. These settings override default keymaps, and add keymaps for commands which have no default keymaps. Change the key assignments as needed.

This allows you to go back directly to the original position with Alt+[ (macOS: Option+[) after jumping with symbol navigation commands (Go to Definition (F12), Go to Implementation (Ctrl+F12), etc).

{
	"key": "f12",
	"command": "symbolNavigateBack.revealDefinition",
	"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
	"key": "ctrl+alt+f12",
	"command": "symbolNavigateBack.revealDeclaration",
	"when": "editorHasDeclarationProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
	"key": "ctrl+shift+alt+f12",
	"command": "symbolNavigateBack.goToTypeDefinition",
	"when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
	"key": "ctrl+f12",
	"command": "symbolNavigateBack.goToImplementation",
	"when": "editorHasImplementationProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
	"key": "shift+f12",
	"command": "symbolNavigateBack.goToReferences",
	"when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
},
{
	"key": "ctrl+t",
	"command": "symbolNavigateBack.executeCommand",
	"args": "workbench.action.showAllSymbols"
},
{
	"key": "alt+[",
	"command": "symbolNavigateBack.navigateBack"
},
{
	"key": "alt+]",
	"command": "symbolNavigateBack.navigateForward"
},

Features

This extension contributes the following commands. You need to remap default keys or assign new keymaps as above to use these commands.

  • Symbol Navigate Back: Go to Definition - Save the current position, then call built-in Go to Definition
  • Symbol Navigate Back: Go to Declaration - Save the current position, then call built-in Go to Declaration
  • Symbol Navigate Back: Go to Type Definition - Save the current position, then call built-in Go to Type Definition
  • Symbol Navigate Back: Go to Implementations - Save the current position, then call built-in Go to Implementations
  • Symbol Navigate Back: Go to References - Save the current position, then call built-in Go to References
  • Symbol Navigate Back: Execute Command - Save the current position, then execute the command with the command ID specified by the keymap argument (See ctrl+t setting above)
  • Symbol Navigate Back: Save Current Position - Save the current position only, do nothing more
  • Symbol Navigate Back: Go Back - Jump back to the previously saved position
  • Symbol Navigate Back: Go Forward - Jump forward to the next position in this extension's stack

vscode-symbol-navigate-back's People

Contributors

iket0731 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.