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

Support for custom commands in structure view #3492

Open
tmczar opened this issue Mar 17, 2024 · 4 comments
Open

Support for custom commands in structure view #3492

tmczar opened this issue Mar 17, 2024 · 4 comments
Labels
enhancement New feature or (non bug related) change to the program.

Comments

@tmczar
Copy link
Contributor

tmczar commented Mar 17, 2024

For example:

I have a command \myInput{file}. It does some small random stuff, but most importantly, it does \input{file}.

It would be great, if I could instruct (via settings) TeXiFy to treat \myInput just like \input for purposes of structure/navigation and all that.

The same applies to just about everything. One may have some macro that starts new section, but with some custom decorators - it would be great to be able to use those settings for this "decorated setting" to show in structure view.

My idea of implementing it, is via list of pairs (customCommand, standardCommand).

Setup like (A, B) would make TeXiFy treat A just like B, for purposes of structuring.

Note: this idea is not really a new one. My previous LaTeX editor of choice - Kile - has something similar (albeit list of standard commands one can map to is hard-coded).

@tmczar tmczar added enhancement New feature or (non bug related) change to the program. untriaged Issue type still needs to be triaged or verified. labels Mar 17, 2024
@tmczar
Copy link
Contributor Author

tmczar commented Mar 17, 2024

Additional example is \newcommandx - very nice macro to use instead of \newcommand, that is sadly not supported by TeXiFy - this feature would allow to deal with such problem manually.

@tmczar
Copy link
Contributor Author

tmczar commented Mar 17, 2024

It would also allow for (relatively) easy solution of problems like that:

#3488

Instead of trying to support all possible exotic setups of every single user and multitude of packages providing new helper commands, this would allow users themselves to solve it themselves.

@tmczar
Copy link
Contributor Author

tmczar commented Mar 18, 2024

Having read through https://github.com/Hannah-Sten/TeXiFy-IDEA/blob/master/src/nl/hannahsten/texifyidea/util/magic/CommandMagic.kt, I think it would be best to have some ability to add custom entries to it. (maybe even via some per-project user file?)

@PHPirates
Copy link
Collaborator

Thanks for the suggestion. We do have something to detect redefinitions for \label but not yet for \input (https://hannah-sten.github.io/TeXiFy-IDEA/editing-a-latex-file.html#support-for-user-defined-commands)
The main reason is that I am worried about performance.

\newcommandx should also be added to our magic list.

I do agree that it would be nice to expose the magic lists to users because not everything is possible to automatically detect. It would be similar to our current Conventions settings (https://hannah-sten.github.io/TeXiFy-IDEA/texify-settings.html#conventions)

It would not help for #3488 because that issue is at parser level, so we can't use user settings there.

@PHPirates PHPirates removed the untriaged Issue type still needs to be triaged or verified. label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or (non bug related) change to the program.
Projects
None yet
Development

No branches or pull requests

2 participants