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

Intellisense completions of LaTeX3-style interfaces provided by LaTeX2e #4478

Closed
1 task done
muzimuzhi opened this issue Dec 3, 2024 · 5 comments
Closed
1 task done

Comments

@muzimuzhi
Copy link
Contributor

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • The feature request has not been suggested in this repository.

The Missed*

Is your feature request related to a problem? Please provide a clear and concise description of what the problem is.

In LaTeX2e, recently added modules are written in LaTeX3/expl3, which then may provide both traditional LaTeX2e-style user interfaces and the LaTeX3-style ones. For example, the hook management module provides both

\AddToHook[<label>]{<hook>}{<code>}
% and
\hook_gput_code:nnn {<hook>} {<label>} {<code>}

(see docs texdoc lthooks-doc and texdoc lthooks-code).

Currently only the LaTeX2e-style interfaces have Intellisense completions, but not the LaTeX3-style ones.

The Solution*

Please provide a solution you would like to have.

I've tried something in muzimuzhi/James-Yu:feat/latex2e-expl3-entries, by extending dev/latex3command.py and parse-cwl.ts:

LaTeX2e dtx files -> latex2e-expl3.cwl -> latex2e-expl3.json

But I know nothing about how the data/package/*.json are bundled in the extension and when the completions entries in them are enabled.

Anything Else?

Add any other context about the feature request below.

In general, not only the LaTeX kernel, but also any packages and classes may provide public and documented LaTeX3 functions and variables. For instance, fontspec package provides \fontspec_font_if_exist:nTF and several more, see sec. VIII.5 "Programming interface" in its doc.

It needs to be decided whether to record LaTeX3 entries in the same <package>.json along with the existing LaTeX2e ones and only show them in completion list when in LaTeX3 coding style, or to record them in separate files, for example <package>.expl3.json (less likely to encounter naming clashes) or <package>-expl3.json.

Ideally auto-completion for LaTeX3-style functions should provide corresponding argument descriptions too, but currently that's missing from TeXstudio cwl files. Maybe there was a feature request for that in TeXstudio, but I cannot find it for now.

Cc @mbertucci47

@mbertucci47
Copy link

@muzimuzhi I opened texstudio-org/texstudio#3896. If that is added then I can make the cwl with arguments.

@James-Yu
Copy link
Owner

James-Yu commented Dec 7, 2024

Resolved in #4476? Correct me if I'm wrong.

@James-Yu James-Yu closed this as completed Dec 7, 2024
@muzimuzhi
Copy link
Contributor Author

@James-Yu Nope. #4476 updates the completions for l3kernel functions and variables, documented in texdoc interface3.pdf (or just texdoc l3), while this issue is about adding completions for functions and variables that i) follow LaTeX3/expl3 naming scheme and ii) are provided out side of the l3kernel.

For instance l3kernel provides \tl_new:N, the LaTeX2e base provides \hook_new:n, and package fontspec provides \fontspec_font_if_exist:nTF. Currently LaTeX-Workshop only have completions for the first kind of names.

@muzimuzhi muzimuzhi changed the title Intellisense completions of LaTeX3 interfaces provided by LaTeX2e Intellisense completions of LaTeX3-style interfaces provided by LaTeX2e Dec 7, 2024
@James-Yu
Copy link
Owner

James-Yu commented Dec 8, 2024

I see. There is no plan to parse dtx files of latex2e packages for macro definitions. We will stick to the cwl solution.

@mbertucci47
Copy link

See texstudio-org/texstudio#3915 and texstudio-org/texstudio#3916. I added argument specs for expl3 commands and the expl3 LaTeX interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants