Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should all these not use 1.1.0 instead of 2.0.0?

Copy link
Copy Markdown
Contributor Author

@travkin79 travkin79 Feb 10, 2026

Choose a reason for hiding this comment

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

No, it is intentionally set to 1.0.0. There was no LSP4E release yet based on the latest LSP4J release vers. 1.0.0 and LSP4J vers. 1.1.0 is still under development. see #1421 (comment)

Should LSP4E not always depend on a released LSP4J version?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did not mean to change 1.0.0, I meant change 2.0.0 to 1.1.0, which would be the next minor version bump, equivalent to what we have been doing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, I should have read your comment more properly. Sorry for that.

But I'm still not sure if an upper range limit of 1.1.0 instead of 2.0.0 is what we want. Starting with LSP4J 1.0.0, semantic versioning is used. Doesn't that mean that increasing the minor version of LSP4J would not introduce any breaking change and we can leave the upper range limit being 2.0.0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see your point. Let's go for this. I have rerun one failing build and if it passes, I will merge it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@travkin79 , actually I cannot merge. Can you do the rebase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Its already merged, but here is a +1 review as requested.

Doesn't that mean that increasing the minor version of LSP4J would not introduce any breaking change and we can leave the upper range limit being 2.0.0?

I hope so! Assuming LSP4J doesn't screw up.

It may not mean any less updates needed to version ranges, but at least those updates will be semantic version compliant. i.e the next version LSP4J releases may well be 2.0.0, it is still TBD depending on what patches/improvements the project gets.

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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -107,7 +105,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()));
}

Expand Down Expand Up @@ -233,7 +231,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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand All @@ -386,7 +383,7 @@ public void editExternalFile(@TempDir Path tempDir) 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(Files.isRegularFile(file));
Expand Down Expand Up @@ -425,7 +422,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());
Expand All @@ -441,7 +438,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles(@TempDir Path t
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());
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same

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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -48,8 +49,9 @@ void addMarkerAttributesForDiagnostic(Diagnostic diagnostic, @Nullable IDocument
*/
default String computeMarkerMessage(Diagnostic diagnostic) {
final Either<String, Integer> 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$
}
}
15 changes: 12 additions & 3 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,6 +120,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;
Expand Down Expand Up @@ -1093,7 +1094,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()) {
Expand Down Expand Up @@ -1155,7 +1157,7 @@ private static CompositeChange toCompositeChange(WorkspaceEdit wsEdit, String na
TextDocumentEdit edit = action.getLeft();
VersionedTextDocumentIdentifier id = edit.getTextDocument();
URI uri = URI.create(id.getUri());
List<TextEdit> textEdits = edit.getEdits();
List<TextEdit> textEdits = toTextEditList(edit.getEdits());
change.add(toChanges(uri, textEdits));
collectChangedURI(uri, textEdits, collector);
} else if (action.isRight()) {
Expand Down Expand Up @@ -1253,6 +1255,13 @@ private static CompositeChange toCompositeChange(WorkspaceEdit wsEdit, String na
return change;
}

private static final List<TextEdit> toTextEditList(List<Either<TextEdit, SnippetTextEdit>> 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));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<unit id="org.eclipse.lsp4j.debug" version="0.0.0"/>
<unit id="org.eclipse.lsp4j.jsonrpc.debug" version="0.0.0"/>
<unit id="com.google.gson" version="0.0.0"/>
<repository location="https://download.eclipse.org/lsp4j/updates/releases/0.24.0/"/>
<repository location="https://download.eclipse.org/lsp4j/updates/releases/1.0.0/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.ui.tests.harness" version="0.0.0"/>
Expand Down