Skip to content

changes to upgrade lsp4j.version to 1.0.0#1781

Merged
angelozerr merged 4 commits into
eclipse-lemminx:mainfrom
venmanyarun:lsp4j_1.0.0_upgrade
Jun 9, 2026
Merged

changes to upgrade lsp4j.version to 1.0.0#1781
angelozerr merged 4 commits into
eclipse-lemminx:mainfrom
venmanyarun:lsp4j_1.0.0_upgrade

Conversation

@venmanyarun

@venmanyarun venmanyarun commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Related to #1780

Method signatures updated

  1. The TextDocumentEdit constructor now requires List<Either<TextEdit, SnippetTextEdit>> instead of List.
// OLD (LSP4J 0.23.1)
new TextDocumentEdit(identifier, List<TextEdit> edits)
// NEW (LSP4J 1.0.0)
new TextDocumentEdit(identifier, List<Either<TextEdit, SnippetTextEdit>> edits)
  1. Diagnostic.getMessage() now returns Either<String, MarkupContent> instead of String.
// OLD (LSP4J 0.23.1)
String message = diagnostic.getMessage();
// NEW (LSP4J 1.0.0)
Either<String, MarkupContent> message = diagnostic.getMessage();
  1. TextDocumentEdit.getEdits() Return Type Change

// OLD (LSP4J 0.23.1)
List<TextEdit> edits = textDocumentEdit.getEdits();
// NEW (LSP4J 1.0.0)
List<Either<TextEdit, SnippetTextEdit>> edits = textDocumentEdit.getEdits();

also found some invalid constructors for TextEdit and TextDocumentContentChangeEvent

@angelozerr

Copy link
Copy Markdown
Contributor

Thanks. Have you tested if it is working with Eclipse IDE and vscode-xml?

@angelozerr

Copy link
Copy Markdown
Contributor

And please note that if we merge this PR, we need also take care of https://github.com/eclipse-lemminx/lemminx-maven

@venmanyarun

venmanyarun commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Have you tested if it is working with Eclipse IDE and vscode-xml?
Yes tested

Tested in vscode-xml

Screen.Recording.2026-06-04.at.6.08.51.PM.mov

Tested in wildwebdeveloper

Screen.Recording.2026-06-04.at.6.24.52.PM.mov

@angelozerr

Copy link
Copy Markdown
Contributor

Great!

The last part is to test it with lemminx maven

@venmanyarun

venmanyarun commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Great!

The last part is to test it with lemminx maven

Created an issue in lemminx-maven. eclipse-lemminx/lemminx-maven#665
Should take this up once lemminx is released

@venmanyarun
venmanyarun requested a review from angelozerr June 8, 2026 04:54

private static final Logger LOGGER = Logger.getLogger(TextEditUtils.class.getName());

/**

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 noticed that all code of this utility class is not linked to to DOM lemminx code except for

public static TextDocumentEdit creatTextDocumentEdit(DOMDocument document, List<TextEdit> textEdits) {

I suggest that you:

  • move TextEditUtils to org/eclipse/commons package.
  • remove public static TextDocumentEdit creatTextDocumentEdit(DOMDocument document, List<TextEdit> textEdits) {
  • create a new method public static TextDocumentEdit creatTextDocumentEdit(TextDocument document, List<TextEdit> textEdits) { and use document.getUri() -isntead of document.getDocumentUri()
  • create DOMTextEditUtils in this utils package with a signle method public static TextDocumentEdit creatTextDocumentEdit(DOMDocument document, List<TextEdit> textEdits) { which will call TextEditUtils with document.getTextDocument.

and in lemminx maven, rename TextEditUtils to DOMTextEditUtils in https://github.com/eclipse-lemminx/lemminx-maven/blob/e85154e3616404a128e07209b3a6efedaefdb41b/lemminx-maven/src/test/java/org/eclipse/lemminx/extensions/maven/participants/rename/MavenPropertyRenameParticipantTest.java#L13

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.. Deprecated TextEditUtils in lemminx/utils/TextEditUtils
Created new TextEditUtils in commons and added DOMTextEditUtils as well

Created org.eclipse.lemminx.commons.DiagnosticUtils, updated some tests to use these
Created org.eclipse.lemminx.commons.TextEditUtils
Created org.eclipse.lemminx.utils.DOMTextEditUtils

// Insert the expected content.
try {
org.eclipse.lsp4j.Position endPos = textDocument.positionAt(to);

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.

Use import

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

}
}
return leftLimit;
return org.eclipse.lemminx.commons.TextEditUtils.adjustOffsetWithLeftWhitespaces(leftLimit, to, text);

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.

use import

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

@venmanyarun
venmanyarun requested a review from angelozerr June 9, 2026 06:57
@angelozerr
angelozerr merged commit 84644f4 into eclipse-lemminx:main Jun 9, 2026
6 checks passed
@angelozerr

Copy link
Copy Markdown
Contributor

Thanks so much @venmanyarun !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants