Skip to content

Conversation

@palukku
Copy link
Member

@palukku palukku commented Nov 10, 2025

Closes palukku#32

Adds the ability to ctrl + click on a linked pdf if the path is absolute and opens it in vscode (if pdf preview extension is installed)

Steps to test

Start JabLs from this branch and than vscode with the extension enabled.

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 changed the title add pdf opening ability Feat: Add the ability to open linked pdf files in bib files Nov 10, 2025
// We need state to have a more clean code. Thus, we instantiate the class and then return the result
FileFieldParser fileFieldParser = new FileFieldParser(value);
return fileFieldParser.parse();
return new ArrayList<>(fileFieldParser.parse().stream().map(LinkedFilePosition::linkedFile).toList());
Copy link
Member

Choose a reason for hiding this comment

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

To create a modifiable list, the usual way is with .collect(Colltectors.toList()) (or similar).

Also add to JavaDoc that the list is modifiable.

However - why do you need the result be modifiable? I think, the caller should convert it to a modifiable list (I might be wrong here, did not check all the code, but only thought of parsing and that the parsed representation should be read-only, because the underlying thing does not change)

Comment on lines +84 to +87
@Override
public List<DocumentLink> provideDocumentLinks(String fileUri, String content) {
return List.of();
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes because this is only relevant (for now) when we want to execute commands or do stuff in the ui, but pdf opening is (currently) only for opening them in vscode and therefore we dont need this

@palukku palukku marked this pull request as draft November 10, 2025 10:02
@palukku
Copy link
Member Author

palukku commented Nov 10, 2025

sorry for force pushing, but I accidentally re ordered a commit in gitbutler and than reversed it to the original state, but because of gitbutlerapp/gitbutler#10266 I needed to force push in order to get it working...

@palukku palukku marked this pull request as ready for review November 10, 2025 11:26
@palukku palukku requested a review from koppor November 10, 2025 11:26
InAnYan
InAnYan previously approved these changes Nov 10, 2025
Copy link
Member

@InAnYan InAnYan left a comment

Choose a reason for hiding this comment

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

I can confirm that with absolute paths it works.

Though, from the UI side, I don't like, that it underscores only a single word, not a full URL, but for now ça suffit

@palukku
Copy link
Member Author

palukku commented Nov 10, 2025

Though, from the UI side, I don't like, that it underscores only a single word, not a full URL, but for now ça suffit

But this is from VSCodes side, i set the range for the link to the whole file. The hyperlink view only works for documentLinks, maybe it could be reworked to use DocumentLinks

""",
importFormatPreferences);
List<LinkedFile> files = parserResult.getDatabaseContext().getEntries().getFirst().getFiles();
assertNotNull(files.getLast().getLink());
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer an assertEquals here, if possible

Copy link
Member Author

Choose a reason for hiding this comment

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

Shouldnt you also check for two occurrences?

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.

Open attached PDF

5 participants