From add9ef8f832b7eb204a97e9e834cebda52bb9926 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Tue, 25 Nov 2025 11:34:17 +0100 Subject: [PATCH 1/3] Use LSP4J nightly builds in target platform, update version ranges --- org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF | 6 +++--- org.eclipse.lsp4e/META-INF/MANIFEST.MF | 4 ++-- .../target-platform-latest/target-platform-latest.target | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF index a6b57c107..e76bdf18a 100644 --- a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF @@ -10,9 +10,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.debug.core, org.eclipse.debug.ui, org.eclipse.jface, - org.eclipse.lsp4j.jsonrpc;bundle-version="[0.24.0,0.25.0)", - org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.24.0,0.25.0)", - org.eclipse.lsp4j.debug;bundle-version="[0.24.0,0.25.0)", + org.eclipse.lsp4j.jsonrpc;bundle-version="[1.0.0,2.0.0)", + org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[1.0.0,2.0.0)", + org.eclipse.lsp4j.debug;bundle-version="[1.0.0,2.0.0)", org.eclipse.ui.editors, org.eclipse.core.filesystem, org.eclipse.ui.ide;bundle-version="[3.16.0,4.0.0)", diff --git a/org.eclipse.lsp4e/META-INF/MANIFEST.MF b/org.eclipse.lsp4e/META-INF/MANIFEST.MF index 8575497e9..cf0903deb 100644 --- a/org.eclipse.lsp4e/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e/META-INF/MANIFEST.MF @@ -28,8 +28,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.tm4e.ui;resolution:=optional, org.eclipse.ui.editors, org.eclipse.ui.navigator;bundle-version="3.6.100", - org.eclipse.lsp4j;bundle-version="[0.24.0,0.25.0)", - org.eclipse.lsp4j.jsonrpc;bundle-version="[0.24.0,0.25.0)", + org.eclipse.lsp4j;bundle-version="[1.0.0,2.0.0)", + org.eclipse.lsp4j.jsonrpc;bundle-version="[1.0.0,2.0.0)", org.eclipse.ui.console, org.eclipse.ltk.core.refactoring, org.eclipse.core.expressions;bundle-version="3.5.0", diff --git a/target-platforms/target-platform-latest/target-platform-latest.target b/target-platforms/target-platform-latest/target-platform-latest.target index 6c89a3f63..21674a451 100644 --- a/target-platforms/target-platform-latest/target-platform-latest.target +++ b/target-platforms/target-platform-latest/target-platform-latest.target @@ -8,7 +8,7 @@ - + From ef34a69398b70ac240ed203ecc4d480d04e02a81 Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Tue, 25 Nov 2025 15:56:50 +0100 Subject: [PATCH 2/3] Adapt to new LSP4J v. 1.0.0 API For the sake of simplicity, for now, we only use the left argument in Either tuples, i.e. the types that we used in earlier versions. --- .../test/diagnostics/DiagnosticsTest.java | 14 +++++------ .../lsp4e/test/edit/LSPEclipseUtilsTest.java | 23 ++++++++----------- .../lsp4e/IMarkerAttributeComputer.java | 6 +++-- .../org/eclipse/lsp4e/LSPEclipseUtils.java | 15 +++++++++--- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/diagnostics/DiagnosticsTest.java b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/diagnostics/DiagnosticsTest.java index f6674f003..40dcaddac 100644 --- a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/diagnostics/DiagnosticsTest.java +++ b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/diagnostics/DiagnosticsTest.java @@ -13,12 +13,10 @@ *******************************************************************************/ package org.eclipse.lsp4e.test.diagnostics; -import static org.eclipse.lsp4e.test.utils.TestUtils.waitForAndAssertCondition; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.eclipse.lsp4e.test.utils.TestUtils.*; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.*; +import static org.junit.jupiter.api.Assertions.*; import java.io.File; import java.io.FileOutputStream; @@ -106,7 +104,7 @@ public void testDiagnostics() throws CoreException { assertEquals(markerCharStart, MarkerUtilities.getCharStart(marker.get())); assertEquals(markerCharEnd, MarkerUtilities.getCharEnd(marker.get())); assertEquals(markerLineIndex + 1, MarkerUtilities.getLineNumber(marker.get())); - assertEquals(diagnostic.getMessage() + " [" + diagnostic.getCode().get() + "]", + assertEquals(diagnostic.getMessage().getLeft() + " [" + diagnostic.getCode().get() + "]", MarkerUtilities.getMessage(marker.get())); } @@ -232,7 +230,7 @@ public void testDiagnosticsRangeAfterDocument() throws CoreException { Diagnostic diagnostic = diagnostics.get(i); IMarker marker = markers[i]; - assertEquals(diagnostic.getMessage() + " [" + diagnostic.getCode().get() + "]", + assertEquals(diagnostic.getMessage().getLeft() + " [" + diagnostic.getCode().get() + "]", MarkerUtilities.getMessage(marker)); assertEquals(content.length(), MarkerUtilities.getCharStart(marker)); assertEquals(content.length(), MarkerUtilities.getCharEnd(marker)); diff --git a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/edit/LSPEclipseUtilsTest.java b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/edit/LSPEclipseUtilsTest.java index 51c70f724..7304ff251 100644 --- a/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/edit/LSPEclipseUtilsTest.java +++ b/org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/edit/LSPEclipseUtilsTest.java @@ -13,12 +13,8 @@ *******************************************************************************/ package org.eclipse.lsp4e.test.edit; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -138,8 +134,9 @@ public void testWorkspaceEdit_CreateAndPopulateFile() throws Exception { String uri = file.getLocation().toFile().toURI().toString(); edits.add(Either.forRight(new CreateFile(uri))); edits.add(Either.forLeft( - new TextDocumentEdit(new VersionedTextDocumentIdentifier(uri, null), List.of( - new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "abcHere\nabcHere2"))))); + new TextDocumentEdit(new VersionedTextDocumentIdentifier(uri, null), + List.of(Either.forLeft( + new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "abcHere\nabcHere2")))))); final var workspaceEdit = new WorkspaceEdit(edits); // they should be applied from bottom to top LSPEclipseUtils.applyWorkspaceEdit(workspaceEdit); @@ -358,8 +355,8 @@ public void testResourceOperations() throws Exception { assertTrue(targetFile.exists()); LSPEclipseUtils.applyWorkspaceEdit(new WorkspaceEdit(List.of(Either.forLeft( new TextDocumentEdit(new VersionedTextDocumentIdentifier(targetFile.getLocationURI().toString(), 1), - List.of( - new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "hello"))))))); + List.of(Either.forLeft( + new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "hello")))))))); assertEquals("hello", readContent(targetFile)); IFile otherFile = project.getFile("another/folder/file.lol"); LSPEclipseUtils.applyWorkspaceEdit(new WorkspaceEdit(List.of(Either.forRight( @@ -388,7 +385,7 @@ public void editExternalFile() throws Exception { te.setNewText("abc\ndef"); final var docEdit = new TextDocumentEdit( new VersionedTextDocumentIdentifier(file.toURI().toString(), null), - List.of(te)); + List.of(Either.forLeft(te))); final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit))); LSPEclipseUtils.applyWorkspaceEdit(we); assertTrue(file.isFile()); @@ -428,7 +425,7 @@ public void testTextEditDoesntAutomaticallySaveOpenResourceFiles() throws Except te.setNewText("abc\ndef"); final var docEdit = new TextDocumentEdit( new VersionedTextDocumentIdentifier(LSPEclipseUtils.toUri(targetFile).toString(), null), - List.of(te)); + List.of(Either.forLeft(te))); final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit))); LSPEclipseUtils.applyWorkspaceEdit(we); assertEquals("abc\ndef", ((StyledText) ((AbstractTextEditor) editor).getAdapter(Control.class)).getText()); @@ -444,7 +441,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles() throws Except te.setNewText("abc\ndef"); final var docEdit = new TextDocumentEdit( new VersionedTextDocumentIdentifier(file.toURI().toString(), null), - List.of(te)); + List.of(Either.forLeft(te))); final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit))); LSPEclipseUtils.applyWorkspaceEdit(we); assertEquals("abc\ndef", ((StyledText) ((AbstractTextEditor) editor).getAdapter(Control.class)).getText()); diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/IMarkerAttributeComputer.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/IMarkerAttributeComputer.java index 90c4ea3dc..805fc07bf 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/IMarkerAttributeComputer.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/IMarkerAttributeComputer.java @@ -16,6 +16,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.IDocument; +import org.eclipse.lsp4e.internal.NullSafetyHelper; import org.eclipse.lsp4j.Diagnostic; import org.eclipse.lsp4j.jsonrpc.messages.Either; @@ -48,8 +49,9 @@ void addMarkerAttributesForDiagnostic(Diagnostic diagnostic, @Nullable IDocument */ default String computeMarkerMessage(Diagnostic diagnostic) { final Either code = diagnostic.getCode(); + String messageText = NullSafetyHelper.defaultIfNull(diagnostic.getMessage().getLeft(), ""); //$NON-NLS-1$ return code == null // - ? diagnostic.getMessage() - : diagnostic.getMessage() + " [" + code.get() + "]"; //$NON-NLS-1$//$NON-NLS-2$ + ? messageText + : messageText + " [" + code.get() + "]"; //$NON-NLS-1$//$NON-NLS-2$ } } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java index 7270449ba..6f41a4c29 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java @@ -21,7 +21,7 @@ *******************************************************************************/ package org.eclipse.lsp4e; -import static org.eclipse.lsp4e.internal.NullSafetyHelper.castNonNull; +import static org.eclipse.lsp4e.internal.NullSafetyHelper.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -121,6 +121,7 @@ import org.eclipse.lsp4j.RenameFile; import org.eclipse.lsp4j.ResourceOperation; import org.eclipse.lsp4j.SignatureHelpParams; +import org.eclipse.lsp4j.SnippetTextEdit; import org.eclipse.lsp4j.TextDocumentEdit; import org.eclipse.lsp4j.TextDocumentIdentifier; import org.eclipse.lsp4j.TextDocumentPositionParams; @@ -1078,7 +1079,8 @@ private static boolean applyWorkspaceEditIfSingleOpenFile(WorkspaceEdit wsEdit) .map(TextDocumentIdentifier::getUri) .map(LSPEclipseUtils::toUri) .forEach(documentUris::add); - firstDocumentEdits.addAll(wsEdit.getDocumentChanges().get(0).getLeft().getEdits()); + firstDocumentEdits.addAll(toTextEditList( + wsEdit.getDocumentChanges().get(0).getLeft().getEdits())); } } if (documentUris.size() != 1 || firstDocumentEdits.isEmpty()) { @@ -1140,7 +1142,7 @@ private static CompositeChange toCompositeChange(WorkspaceEdit wsEdit, String na TextDocumentEdit edit = action.getLeft(); VersionedTextDocumentIdentifier id = edit.getTextDocument(); URI uri = URI.create(id.getUri()); - List textEdits = edit.getEdits(); + List textEdits = toTextEditList(edit.getEdits()); change.add(toChanges(uri, textEdits)); collectChangedURI(uri, textEdits, collector); } else if (action.isRight()) { @@ -1238,6 +1240,13 @@ private static CompositeChange toCompositeChange(WorkspaceEdit wsEdit, String na return change; } + private static final List toTextEditList(List> textEdits) { + return textEdits.stream() + .filter(e -> e.isLeft()) + .map(e -> e.getLeft()) + .toList(); + } + private static final Range DEFAULT_RANGE = new Range(new Position(0, 0), new Position(0, 0)); /** From ee645cac4f1bfbb3e4f401c38e177b2d7bacea4e Mon Sep 17 00:00:00 2001 From: Dietrich Travkin Date: Tue, 25 Nov 2025 16:22:14 +0100 Subject: [PATCH 3/3] Bump plug-in versions --- org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF | 2 +- org.eclipse.lsp4e.test/META-INF/MANIFEST.MF | 2 +- org.eclipse.lsp4e.test/pom.xml | 2 +- org.eclipse.lsp4e/META-INF/MANIFEST.MF | 2 +- org.eclipse.lsp4e/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF index e76bdf18a..ac0147c2f 100644 --- a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation) Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true Bundle-Vendor: Eclipse LSP4E -Bundle-Version: 0.16.1.qualifier +Bundle-Version: 0.16.2.qualifier Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, diff --git a/org.eclipse.lsp4e.test/META-INF/MANIFEST.MF b/org.eclipse.lsp4e.test/META-INF/MANIFEST.MF index 87dc67ea6..d26e58a97 100644 --- a/org.eclipse.lsp4e.test/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tests for language server bundle (Incubation) Bundle-SymbolicName: org.eclipse.lsp4e.test;singleton:=true -Bundle-Version: 0.16.2.qualifier +Bundle-Version: 0.16.3.qualifier Fragment-Host: org.eclipse.lsp4e Bundle-Vendor: Eclipse LSP4E Bundle-RequiredExecutionEnvironment: JavaSE-21 diff --git a/org.eclipse.lsp4e.test/pom.xml b/org.eclipse.lsp4e.test/pom.xml index e6b9c55fd..9984347fd 100644 --- a/org.eclipse.lsp4e.test/pom.xml +++ b/org.eclipse.lsp4e.test/pom.xml @@ -8,7 +8,7 @@ org.eclipse.lsp4e.test eclipse-test-plugin - 0.16.2-SNAPSHOT + 0.16.3-SNAPSHOT diff --git a/org.eclipse.lsp4e/META-INF/MANIFEST.MF b/org.eclipse.lsp4e/META-INF/MANIFEST.MF index cf0903deb..1fb1f873b 100644 --- a/org.eclipse.lsp4e/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation) Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true -Bundle-Version: 0.19.2.qualifier +Bundle-Version: 0.19.3.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.equinox.common;bundle-version="3.8.0", diff --git a/org.eclipse.lsp4e/pom.xml b/org.eclipse.lsp4e/pom.xml index 7bde4b2e6..249fff5a6 100644 --- a/org.eclipse.lsp4e/pom.xml +++ b/org.eclipse.lsp4e/pom.xml @@ -10,7 +10,7 @@ org.eclipse.lsp4e eclipse-plugin - 0.19.2-SNAPSHOT + 0.19.3-SNAPSHOT