Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Opening Tag when Closing Tag Selected #55075

Open
ghost opened this issue Jul 25, 2018 · 26 comments
Open

Show Opening Tag when Closing Tag Selected #55075

ghost opened this issue Jul 25, 2018 · 26 comments
Labels
editor-bracket-matching Editor brace matching feature-request Request for new features or functionality
Milestone

Comments

@ghost
Copy link

ghost commented Jul 25, 2018

intelliJ / PHP Storm / etc. have this nifty little feature. When your cursor is at the end of a tag, if the opening tag is off the screen it will show it in a little floating window.

Example of being able to see a line that is off the screen

This makes it incredibly easy to keep track of exactly which closing tag you're at, especially useful for when you have to work in heavily nested templates.

@vscodebot vscodebot bot added the editor label Jul 25, 2018
@vscodebot
Copy link

vscodebot bot commented Jul 25, 2018

@ghost
Copy link
Author

ghost commented Jul 25, 2018

Can confirm it's not a duplicate of any of those linked issues.

@kieferrm kieferrm added the feature-request Request for new features or functionality label Jul 26, 2018
@alexdima alexdima added this to the Backlog milestone Jul 30, 2018
@chpxu
Copy link

chpxu commented Jul 30, 2018

Damn, sick idea definitely want this!

@octoxan
Copy link

octoxan commented Jul 30, 2018

Yes please, can't live without this. Gets people to stop doing the crazy along the end of a long chain of closing divs.

@alexdima
Copy link
Member

Would the newly introduced breadcrumbs help here ?

@AlexHnydiuk
Copy link

Really, NetBeans also has this feature. It's a lifesaver! It would be great, if it will be implemented. Really want this!)

@alexandrudima, breadcrumbs is also great thing, but it works differently. Let me explain:

Breadcrumbs only shows you filepath, file name, class name or function name. But, if your cursor is at the closing tag of some if block, for example, you will see.. only file name/function name in breadcrumbs.
Something like this:

vcs breadcrumbs inside looong IF statement

While, in NetBeans it will be:

NetBeans inside looong IF statement

Idea simple as cake:

  • detect bracket/tag

  • if bracket/tag is closing one, find its opening pair.

  • if opening bracket/tag is outside of the viewfield of editor, show tooltip with line, where opening bracket/tag is located.
    ** additional conditions **

  • if opening bracket is the only symbol in the line (excluding tabs and spaces), also include in tooltip line above this line
    Like this:
    NetBeans php psr2 brackets

  • if condition before bracket is multiline, show it full, not only line with opening bracket

This feature saved me a lot of time and context switching, when I was using NetBeans for coding, because if i want to refresh, where I am, or what condition it was - just set cursor near the closing bracket (yep, tooltip is shown when cursor is right before/right after/inside tag). No need for scrolling up to the top thru all file just to see condition, and scrolldown back to place where you've been before!)

@octoxan
Copy link

octoxan commented Sep 25, 2018

@AlexHnydiuk This sums it up perfectly! This feature is one of the main reasons I can't switch to VS Code.

@alexdima alexdima removed their assignment Oct 8, 2018
@CTimmerman
Copy link

CTimmerman commented May 9, 2019

https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag could be extended with a tooltip. I'd prefer the "Go to Definition" and "Peek Definition" to work on a close tag, though. Alternatively, code folding works when starting from the top.

"Emmet: Go to Matching Pair" works too, keybindings.json:

[
	{
		"key": "alt+[",
		"command": "editor.emmet.action.matchTag"
	}
]

@vijayksingh
Copy link

@alexandrudima Can you tell what's the complexity of this task is?
I am trying to contribute, What @AlexHnydiuk commented in the thread makes sense to me but I am not sure whether this task is beginner-friendly or not?

I would love to work on this task but will need some thorough explaining.

@namleasia
Copy link

Please add this feature.

@mtsh1000
Copy link

mtsh1000 commented Mar 5, 2020

There is bracket peek extension now!

@shba007
Copy link

shba007 commented Apr 6, 2020

Add This feature

@JessicaBunyan
Copy link

+1 Would love this feature

@YetAnotherEye
Copy link

+1, as this should be integrated to the core.
For now I use an extension:
https://marketplace.visualstudio.com/items?itemName=jomeinaster.bracket-peek
Works like a charm (even if I miss jumping to the line on click; workaround is the keyboard shortcut [Ctrl]+[Shift]+^)

@gulshan
Copy link

gulshan commented Jul 9, 2020

Although #26757 is not same, it's similar.

@Erik0x42
Copy link

Erik0x42 commented Nov 8, 2020

Looks like this is still in Backlog Candidates after >= 20 upvotes and >= 60 days?
Does the bot have a blind spot?

@Hikaruxy
Copy link

Seems like this has been overlooked in error, despite its popularity?

@ranapartap
Copy link

Yeah Need this badly

@Z-E-D
Copy link

Z-E-D commented May 8, 2022

Having the tooltip on the top of editor that shows the first line of block would be great, but the suggestion in this issue requires that you have displayed the closing bracket, which could be also outside of the screen when you are inside a very long block.

Because of that I prefer the suggestion by @hediet on #134888 to have that toolip displayed if we just hover or click on the indent guide.

@Trass3r
Copy link

Trass3r commented Jun 4, 2022

+1, as this should be integrated to the core. For now I use an extension: https://marketplace.visualstudio.com/items?itemName=jomeinaster.bracket-peek Works like a charm

Thanks a lot! Didn't know about this one.
It even allows customization to show the line at the top or next to the closing bracket which I almost prefer now that I saw it.

@mtsh1000
Copy link

4 years approaching! :(

@jakubkloc
Copy link

*5 :((

@notedwin-dev
Copy link

notedwin-dev commented Feb 4, 2024

image
This is already something I'm experiencing. It's somehow annoying for me and I want to disable them. So I think it's safe to say that the feature already exist but I don't know why it's enabled for me. I didn;t do anything to VSCode for it to show me this. + I don't have any of those extensions mentioned above. So it must be a native behaviour from VS Code.

@notedwin-dev
Copy link

image This is already something I'm experiencing. It's somehow annoying for me and I want to disable them. So I think it's safe to say that the feature already exist but I don't know why it's enabled for me. I didn;t do anything to VSCode for it to show me this. + I don't have any of those extensions mentioned above. So it must be a native behaviour from VS Code.

Found a solution to that, it's called a Stikcy Scroll. I right clicked on the sticky-to-top rows and disabled them.

@octoxan
Copy link

octoxan commented Feb 6, 2024

The introduction of sticky scroll basically solves this issue.

@mhnap
Copy link

mhnap commented Mar 5, 2024

The introduction of sticky scroll basically solves this issue.

Sticky scroll can be used instead, but it will show more lines than needed and not always the necessary line if there are lots of them. Would be great to have exactly the proposed solution. I also tried mentioned extensions and none works well for Rust files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-bracket-matching Editor brace matching feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests