Feat: Initial implementation of an LSP for integrity checks#13612
Conversation
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
|
|
||
| private final CliPreferences jabRefCliPreferences; | ||
| private final JournalAbbreviationRepository abbreviationRepository; | ||
| private LanguageClient client; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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<>())); |
There was a problem hiding this comment.
Modern Java practices suggest using List.of() for creating empty lists instead of instantiating ArrayList directly.
| public void setClient(LanguageClient client) { | ||
| this.client = client; | ||
| } |
There was a problem hiding this comment.
The method lacks null parameter validation. According to modern Java practices and special instruction #19, null should never be passed to methods.
koppor
left a comment
There was a problem hiding this comment.
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)
| private void handleDiagnostics(String uri, String content, int version) { | ||
| BibDatabaseContext bibDatabaseContext; | ||
| try { | ||
| bibDatabaseContext = new BibtexParser(jabRefCliPreferences.getImportFormatPreferences()).parse(StringReader.of(content)).getDatabaseContext(); |
|
@trag-bot didn't find any issues in the code! ✅✨ |
* 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)
Steps to test
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)