Goto Declaration Unexpected Behavior for labels with hyphens
See original GitHub issuePyCharm 2022.2.3 (Professional Edition) Build #PY-222.4345.23, built on October 10, 2022
Pop!_OS 22.04 LTS
TeXiFy IDEA 0.7.23
What I did (steps to reproduce)
- Create a section with a label that has a hyphen in it
- Later, create a reference back to that section.
- Place the cursor to the left of the hyphen Goto Declaration (
ctrl+b
or ctrl+click) - Observe “No usages found” message (incorrect)
- Place cursor to right of the hyphen and attempt Goto Declaration again
- Observe Expected Behavior
Minimal example to reproduce the problem
Inconsistent/Incorrect Behavior
\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\section{Foo}\label{sec:foo-bar}
Foo Bar~\ref{sec:foo-bar}
\end{document}
Consistent/Correct Behavior
\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\section{Foo}\label{sec:foobar}
Foo Bar~\ref{sec:foobar}
\end{document}
Expected behavior
Goto Declaration will work consistently on both \ref{sec:foo-bar}
and \ref{sec:foobar}
Actual behavior
Please refer back to steps to reproduce for more info.
When attempting a ctrl+click, one may notice that when hovering to the left of a hyphen, the blue underline does not extend across the whole reference. Moving the mouse to the right of the hyphen works as expected.
Notes
Adding more hyphens does not exacerbate the issue, only the first one suffers splitting.
Removing the :
does not have any effect.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Unexpected behavior with hyphenated boolean options #879
The idea is that when someone specifies --no-foo in their CLI, they probably want a variable foo = false rather than a variable...
Read more >Variable declaration after goto Label - Stack Overflow
I heard that one cannot create variables inside the case statements of switch. Since JUMP is inside the same scope (the scope of...
Read more >Don't Use The Placeholder Attribute - Smashing Magazine
The placeholder attribute contains a surprising amount of issues that prevent it from delivering on what it promises. Let's clarify why you ...
Read more >python code to change dash values to degree minute second
Solved: I'm a novice in programming and would appreciate if somebody can provide me with a Python code that can convert the values...
Read more >Clang Language Extensions — Clang 16.0.0git documentation
Since it has undefined behavior, it is a statement that it is never reached and the optimizer can take advantage of this to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, not trying to rush you or anything, just gathering information since I wasn’t sure if it would help or not
Yes yes it’s all the same issue, I know what the problem is, we made hyphens a separate lexer token to enable folding them, but reference resolving works on the leaf psi element at the caret, so that should be one element and not be split up. Should probably just not have separate hyphen lexer token in required arguments, but that’s no fun in the lexer. Unfortunately I think doing this at parser level will not work, but we’ll see.