Skip to content

Feat: Initial implementation of an LSP for integrity checks#13612

Merged
koppor merged 16 commits into
JabRef:mainfrom
palukku:LSP-initial
Jul 31, 2025
Merged

Feat: Initial implementation of an LSP for integrity checks#13612
koppor merged 16 commits into
JabRef:mainfrom
palukku:LSP-initial

Conversation

@palukku

@palukku palukku commented Jul 30, 2025

Copy link
Copy Markdown
Member

Steps to test

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked 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 to the documentation repository.


private final CliPreferences jabRefCliPreferences;
private final JournalAbbreviationRepository abbreviationRepository;
private LanguageClient client;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The client field should be marked as @nullable since it can be null before setClient is called, and null handling should be explicit using JSpecify annotations.

List<IntegrityMessage> messages = integrityCheck.checkEntry(entry);
for (IntegrityMessage message : messages) {
diagnostics.add(new Diagnostic(
// works because the whole bibtex file gets parsed on every change

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment merely restates what is obvious from the code and doesn't provide additional insight or reasoning about why this approach was chosen.


@Override
public void didClose(DidCloseTextDocumentParams params) {
client.publishDiagnostics(new PublishDiagnosticsParams(params.getTextDocument().getUri(), new ArrayList<>()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Modern Java practices suggest using List.of() for creating empty lists instead of instantiating ArrayList directly.

Comment on lines +26 to +28
public void setClient(LanguageClient client) {
this.client = client;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The method lacks null parameter validation. According to modern Java practices and special instruction #19, null should never be passed to methods.

Comment thread jabls-cli/src/main/java/org/jabref/languageserver/cli/ServerCli.java Outdated
Comment thread jabls/src/main/java/org/jabref/languageserver/LSPServer.java Outdated
Comment thread jabls-cli/src/main/java/org/jabref/languageserver/cli/ServerCli.java Outdated
Comment thread jabls/src/main/java/org/jabref/languageserver/BibtexTextDocumentService.java Outdated

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add respective commands to https://github.com/JabRef/jabref/blob/main/.jbang/README.md

Please also add a line

With npm:

npx @jbangdev/jbang jabls@jabref

Submit a PR to https://github.com/JabRef/jbang-catalog/blob/main/jbang-catalog.json to add jabls (alphabetically)

Comment thread jabls-cli/src/main/java/org/jabref/languageserver/cli/ServerCli.java Outdated
Comment thread build.gradle.kts Outdated
Comment thread build.gradle.kts Outdated
Comment thread .jbang/JabSrvLauncher.java Outdated
Comment thread jabls-cli/src/main/java/module-info.java Outdated
private void handleDiagnostics(String uri, String content, int version) {
BibDatabaseContext bibDatabaseContext;
try {
bibDatabaseContext = new BibtexParser(jabRefCliPreferences.getImportFormatPreferences()).parse(StringReader.of(content)).getDatabaseContext();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I filed #13617

Comment thread jabls/src/main/java/org/jabref/languageserver/BibtexTextDocumentService.java Outdated
Comment thread jabls/src/main/java/org/jabref/languageserver/BibtexTextDocumentService.java Outdated
Comment thread jabls/src/main/java/org/jabref/languageserver/LSPServer.java Outdated
Comment thread jabls/src/main/java/org/jabref/languageserver/LSPServer.java Outdated
@palukku palukku marked this pull request as ready for review July 31, 2025 15:30

private LanguageClient client;

// Todo: handle event

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comments that don't provide additional information about implementation details or reasoning should be removed. These TODO comments don't add value beyond what's obvious from the method names.

@trag-bot

trag-bot Bot commented Jul 31, 2025

Copy link
Copy Markdown

@trag-bot didn't find any issues in the code! ✅✨

@koppor koppor added this pull request to the merge queue Jul 31, 2025
Merged via the queue into JabRef:main with commit d33d55c Jul 31, 2025
1 check passed
@koppor koppor deleted the LSP-initial branch July 31, 2025 22:14
Siedlerchr added a commit that referenced this pull request Aug 2, 2025
* upstream/main:
  Issue 13619 Make Citation relations text more clear. (#13620)
  Explain how to handle notifications (#13630)
  Fix scope of 'determine issue number' job (#13627)
  Add proper closing (#13626)
  Implement logic orchestration for Git Pull/Push operations (#13518)
  Make pattern for issue number more strict
  Fix "Cannot load file MultiMergeEntries.fxml" (#13624)
  Add Copy markdown to copy citation (#13387)
  Add ADR-0047 (#13621)
  Initial start of implementing a LSP for integrity checks (#13612)
  Refactor merge entries package structure (#13614)
  New Crowdin updates (#13616)
  BibEntry class no longer implements Cloneable (#13615)
  Fix dark mode in {} of Citation Relations tab of the entry editor (#13609)
  Update dependency org.kohsuke:github-api to v2.0-rc.4 (#13611)
  Fix setting of proxy without password (#13605)
@palukku palukku changed the title Initial start of implementing a LSP for integrity checks Feat: Initial implementation of an LSP for integrity checks Nov 9, 2025
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.

2 participants