Skip to content

Conversation

@palukku
Copy link
Member

@palukku palukku commented Oct 5, 2025

Closes palukku#57 partially

Added the ability to ctrl + click on an [@citationKey] in markdown files and it jumps to the entry in the GUI (if running in gui mode) else it jumps to the content of the entry in the bib file also ctrl + hover shows a preview of the entry then.

Also works if the same citationkey is defined in multiple bib files in the workspace.

image image

Steps to test

Start the Language Server and an VSCode instance with the extension enabled.

Have a .bib file with entries in it.

Cite one entry in an markdown file and ctrl + click on it.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@palukku palukku marked this pull request as draft October 5, 2025 23:10
@koppor
Copy link
Member

koppor commented Oct 11, 2025

Related work on finding the start of the citation key: org.jabref.logic.texparser.DefaultLatexParser#CITE_PATTERN. However, that one is easy, because it just looks for } as terminating symbol.

@subhramit subhramit added this to the 6.0-alpha.3 milestone Oct 14, 2025

public abstract class DefinitionProvider {

private static final Pattern CITATION_KEY_PATTERN = Pattern.compile("@[a-z0-9_\\-.+:]+", Pattern.CASE_INSENSITIVE);
Copy link
Member

Choose a reason for hiding this comment

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

@koppor koppor marked this pull request as ready for review October 16, 2025 14:16
@koppor koppor enabled auto-merge October 16, 2025 14:16
@jabref-machine
Copy link
Collaborator

Your pull request needs to link an issue correctly.

To ease organizational workflows, please link this pull request to the issue by including a supported keyword in the pull request's description as per syntax described in GitHub's documentation.

Examples

  • Fixes #xyz links pull-request to issue. Merging the PR will close the issue.
  • Fixes https://github.com/JabRef/jabref/issues/xyz links pull-request to issue. Merging the PR will close the issue.
  • Fixes https://github.com/Koppor/jabref/issues/xyz links pull-request to issue. Merging the PR will close the issue.
  • Fixes [#xyz](https://github.com/JabRef/jabref/issues/xyz) links pull-request to issue. Merging the PR will NOT close the issue.

@koppor koppor added this pull request to the merge queue Oct 16, 2025
Merged via the queue into JabRef:main with commit a985422 Oct 16, 2025
50 of 64 checks passed
@koppor koppor deleted the add-md-definition-locations branch October 16, 2025 14:45
bblhd pushed a commit to bblhd/jabref that referenced this pull request Oct 16, 2025
* Add definition links for Markdown

* add ability to jumpToEntry from LSP and when running in standalone open the article in the bibfile

* fix jbang

* fix jbang again

* fix jbang again...

* reformat

* reformat again

* rename Logging Class

* fix modernizer

* switch to jspecify annotation

* remove workspace capabilities

* remove unused messagehandler

* remove unused import

* refactor

* refactor: enhance citation key pattern matching and validation

* sort alphabetically

* docs: add clarification comment regarding LSP position handling

---------

Co-authored-by: Christoph <[email protected]>
hisunll added a commit to hisunll/jabref that referenced this pull request Oct 22, 2025
@palukku palukku changed the title LSP add definition links for Markdown Feat: Add definition links for Markdown Files Nov 9, 2025
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
* Add definition links for Markdown

* add ability to jumpToEntry from LSP and when running in standalone open the article in the bibfile

* fix jbang

* fix jbang again

* fix jbang again...

* reformat

* reformat again

* rename Logging Class

* fix modernizer

* switch to jspecify annotation

* remove workspace capabilities

* remove unused messagehandler

* remove unused import

* refactor

* refactor: enhance citation key pattern matching and validation

* sort alphabetically

* docs: add clarification comment regarding LSP position handling

---------

Co-authored-by: Christoph <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in .md files (when using [citekey])

5 participants