Skip to content

Conversation

@palukku
Copy link
Member

@palukku palukku commented Nov 9, 2025

Closes palukku#53

Added ctrl + click and ctrl + hover for .tex files.

image image

Steps to test

Start the jabls server and after that checkout the last version of https://github.com/JabRef/lsp-vscode-extension and start it.

After that you should see that after opening your bibfile you can ctrl + click or hover to go to/see the definition.

Mandatory checks

@palukku palukku changed the title Add tex definiton Feat: Add definition links for TeX Files Nov 9, 2025
Comment on lines -58 to +65
Arguments.of(UNRESOLVED, "\\cite[pre][post]{UnresolvedKey}"),
Arguments.of(UNRESOLVED, "\\cite*{UnresolvedKey}"),
Arguments.of(UNRESOLVED, "\\parencite[post]{UnresolvedKey}"),
Arguments.of(EINSTEIN_C, "\\citep{Einstein1920c}"),
Arguments.of(EINSTEIN_C, "\\autocite{Einstein1920c}"),
Arguments.of(EINSTEIN_C, "\\Autocite{Einstein1920c}"),
Arguments.of(DARWIN, "\\blockcquote[p. 28]{Darwin1888}{some text}"),
Arguments.of(DARWIN, "\\textcquote[p. 18]{Darwin1888}{blablabla}")
Arguments.of(UNRESOLVED, 17, 30, "\\cite[pre][post]{UnresolvedKey}"),
Arguments.of(UNRESOLVED, 7, 20, "\\cite*{UnresolvedKey}"),
Arguments.of(UNRESOLVED, 17, 30, "\\parencite[post]{UnresolvedKey}"),
Arguments.of(EINSTEIN_C, 7, 20, "\\citep{Einstein1920c}"),
Arguments.of(EINSTEIN_C, 10, 23, "\\autocite{Einstein1920c}"),
Arguments.of(EINSTEIN_C, 10, 23, "\\Autocite{Einstein1920c}"),
Arguments.of(DARWIN, 20, 30, "\\blockcquote[p. 28]{Darwin1888}{some text}"),
Arguments.of(DARWIN, 19, 29, "\\textcquote[p. 18]{Darwin1888}{blablabla}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future work: rewrite to CsvSource

Path path = Path.of("");
LatexParserResult latexParserResult = new LatexParserResult(path);
matchCitation(path, 1, citeString, latexParserResult);
String[] citeStrings = citeString.split(System.lineSeparator());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment would be nice why this is necessary. I would have assumed that the code also can cover multiline \cite statements

Copy link
Member Author

@palukku palukku Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm never thought of multiline citation, but this would neither work for both methods because \n is not included in the pattern as far as i understand and for the second method the parsing is done line by line.
Maybe futurework to make this better?

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move fast here...

@koppor koppor added this pull request to the merge queue Nov 9, 2025
github-merge-queue bot pushed a commit that referenced this pull request Nov 9, 2025
* add support for latex citation definitions and refactor citation handling logic

* enhance LSP range utility and modularize definition handling functions

* improve citation and range handling across parser and definition providers

* fix formatting

* fix jbang

* update associated tests

* update associated tests2

---------

Co-authored-by: Oliver Kopp <[email protected]>
Merged via the queue into JabRef:main with commit ea18473 Nov 9, 2025
51 of 56 checks passed
@koppor koppor deleted the add-tex-definiton branch November 9, 2025 23:48
@palukku palukku restored the add-tex-definiton branch November 10, 2025 02:25
@palukku palukku mentioned this pull request Nov 10, 2025
1 task
Siedlerchr added a commit that referenced this pull request Nov 10, 2025
* main:
  Fix calling JBang command (#14282)
  .jbang scripts should not be included inside themselves (#14278)
  Fix typos (#14277)
  Refactor importDatabase for better readability (#14274)
  fix jbang (#14276)
  Feat: Add definition links for TeX Files (#14260)
  Update preventing module commits (#14273)
  Fix JabKitLuancher
  Rename packages in jabkit to start with org.jabref.toolkit to avoid split packages between jabkit and jabgui (#14052). (#14271)
  Add doi-to-bibtex to examples and JabKit (#14244)
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
* add support for latex citation definitions and refactor citation handling logic

* enhance LSP range utility and modularize definition handling functions

* improve citation and range handling across parser and definition providers

* fix formatting

* fix jbang

* update associated tests

* update associated tests2

---------

Co-authored-by: Oliver Kopp <[email protected]>
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 this pull request may close these issues.

in .tex files

2 participants