Hannah-Sten / TeXiFy-IDEA

LaTeX support for the IntelliJ platform by JetBrains.
https://hannah-sten.github.io/TeXiFy-IDEA
MIT License
896 stars 90 forks source link

autocomplete for labels in custom environments #3620

Open BerniProgrammer opened 3 months ago

BerniProgrammer commented 3 months ago

Discussed in https://github.com/Hannah-Sten/TeXiFy-IDEA/discussions/3579

Originally posted by **BerniProgrammer** June 11, 2024 I really love this plugin. Keep up the work! There are only minor flaws that bother me from time to time. When working with bigger projects I setup some custom environments for listings, that set the caption and label for the listing through parameters of the environement. Something like this: ``` \lstnewenvironment{java}[2][]{ \lstset{ captionpos=b, language=Java, % other style attributes caption={#1}, label={#2}, } }{} ``` the use of it would look like this. ![image](https://github.com/Hannah-Sten/TeXiFy-IDEA/assets/95533188/32dda703-2495-4370-ab9e-aacd1707519a) (I think warning supression for environments is something for another day ^^) The problem then is, that the label string is not considered for autocompletion. ![image](https://github.com/Hannah-Sten/TeXiFy-IDEA/assets/95533188/a1b371da-c9f8-4cd2-8529-c55f88da58c7) I did not find any documentation that showed a feature for this. I am aware that it could be very tricky to implement an automated detection for such a feature as the syntax can differ for custom environments. But I could imagine some sort of comment hint for the plugin when defining a new environment. Or globally for any environment with a given name. e.g. `%lblhint env java #2` All in all this kind of feature could improve the correctness of warnings and errors.