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 for custom cite commands missing #4520

Closed
profpnin opened this issue Feb 5, 2025 · 2 comments
Closed

Intellisense for custom cite commands missing #4520

profpnin opened this issue Feb 5, 2025 · 2 comments
Labels
enhancement Issue suggests an enhancement

Comments

@profpnin
Copy link

profpnin commented Feb 5, 2025

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 issue has not been reported in this repository.
  • [ *] The issue remains after disabling all other extensions and restarting Visual Studio Code.
  • [ *] The FAQ cannot address the issue.
  • [ *] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.

Environment*

Please write exact version numbers instead of descriptors such as latest.

  • Operating System: Linux Mint 21.1
  • Visual Studio Code Version: 1.96.4
  • LaTeX Workshop Version:10.7.5
  • TeX Distribution Version: TeX Live 2022

Please list the environment and version number if you are using VSCodium, Snap or Flatpack versions of Visual Studio Code, and/or Visual Studio Code Remote Containers/SSH/WSL.

  • I am using XXX whose version is YY.ZZ

The Issue*

Not sure if that's a bug, a feature request or if I'm just missing something, so please apologize dullness...
I'm using the package csquotes for citation. Intellisense does work to autocomplete the package specific cite commands as \blockcquote, but language detection doesn't seem to regocnize these commands as cite commands. There are no citation suggestions provided. Works perfect for cite commands as \autocite, but not for the commands provided by csquotes. I tried to define own commands in setting latex-workshop.intellisense.command.user e.g. blockcquote[$2]{${1:${TM_SELECTED_TEXT:bibid}}}{$3}, but "1:${TM_SELECTED_TEXT:bibid" only offers normal word completion but no intellisiense for citation key, whilst same for autocite "autocite[][$2]{${1:${TM_SELECTED_TEXT:bibid}}}" does work as expected, meaning to open intellisense for citation keys from the provided bib file, when the curser is inside the {}.
Not sure, if I'm just missing something, would very much appreciate some help

@jlelong
Copy link
Collaborator

jlelong commented Feb 5, 2025

We use the following regex to decide whether the command argument should be completed as a citation

 /(?:\\[a-zA-Z]*[Cc]ite[a-zA-Z]*\*?(?:\([^[)]*\)){0,2}(?:<[^<>]*>|\[[^[\]]*\]|{[^{}]*})*{([^}]*)$)|(?:\\bibentry{([^}]*)$)/

It seems to me that the only commands from csquotes taking directly a bibid as argument are those ending with cquote

\textcquote[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}[⟨punct⟩]{⟨text⟩}⟨tpunct⟩
\textcquote*[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}[⟨punct⟩]{⟨text⟩}⟨tpunct⟩
\blockcquote[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}[⟨punct⟩]{⟨text⟩}⟨tpunct⟩

I will add them to the above regex

@jlelong jlelong added the enhancement Issue suggests an enhancement label Feb 5, 2025
@profpnin
Copy link
Author

profpnin commented Feb 5, 2025

Great, thank you!

@jlelong jlelong closed this as completed in 15bc97b Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue suggests an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants