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

Complete on my macro definitions (e.g., as if they were a \ref) #1032

Closed
rdiaz02 opened this issue Mar 8, 2024 · 6 comments · Fixed by #1033
Closed

Complete on my macro definitions (e.g., as if they were a \ref) #1032

rdiaz02 opened this issue Mar 8, 2024 · 6 comments · Fixed by #1033

Comments

@rdiaz02
Copy link

rdiaz02 commented Mar 8, 2024

This is a question, not a bug. But I am not sure if this is even possible (I am new to using LSP).

I have some macros that texlab sees (I followed #100), and the macros themselves are completed.

For example, I have this:

\newcommand*{\qref}[1]{\hyperref[{#1}]{\textit{``\nameref*{#1}'' (section \ref*{#1})}}}

I would like that, after inserting \qref{} and when inside the {}, I was offered completions (e.g., for sec:, eq:, etc) as I am offered when I write \ref. Much like it happens, for example, with eqref .

The more general question is: is there a way to tell texlab to issue completions for a macro as if it were something else it already gives completions for?

(In case it matters, I am using Emacs with lsp-mode and lsp-latex).

And apologies if this is a stupid question. This is the sort of thing I can do with company-reftex (Emacs) by modifying the company-reftex-labels-regexp variable, so it now also completes after qref, for example. But I might be completely confused here.

@pfoerster
Copy link
Member

The more general question is: is there a way to tell texlab to issue completions for a macro as if it were something else it already gives completions for?

For some commands, it is already possible (see texlab.experimental.citationCommands for example). For \ref-like commands, it will be possible with #1033.

And apologies if this is a stupid question.

Definitely not a stupid question ^^

@rdiaz02
Copy link
Author

rdiaz02 commented Mar 8, 2024

Thanks a lot for your answer!! I'll keep an eye in the PR then, and I take note that I can do that with citations already.

@rdiaz02
Copy link
Author

rdiaz02 commented Mar 11, 2024

Thanks!

@ROCKTAKEY
Copy link

@pfoerster Hi, thanks for your maintenance.
Could you please write document about "texlab.experimental.labelReferenceCommands"?
I would like to solve ROCKTAKEY/lsp-latex#46 but I don't know about this feature.

@pfoerster
Copy link
Member

@ROCKTAKEY Sure: https://github.com/latex-lsp/texlab/wiki/Configuration#texlabexperimentallabelreferencecommands

It behaves like texlab.experimental.citationCommands except that it operates on \label instead of BibTeX entries.

@ROCKTAKEY
Copy link

Thanks!

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

Successfully merging a pull request may close this issue.

3 participants