eclipse-xtext / eclipse-xtext/xtext

LSP4J is entangled with IDE

Open
#2,387 24 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

Currently xtext.ide.server extensively uses LSP4J which makes it hard to get dependencies right.
I will be using this example PR as basis for the explanation.

I wanted to create an adapter from IOccurrenceComputer to IDocumentHighlightService so that I only have to implement it once for it to work on LSP and Eclipse. The code is quite simple, just transform the inputs and the outputs.

The problem is that the IDocumentHighlightService API uses LSP4J arguments (TextDocumentPositionParams as input and DocumentHighlightKind as output) which requires to add LSP4J as a dependency to xtext.ui.

Another solution would be to do the transformations on the xtext.ide side, but that would require a dependency from xtext.ide to xtext.ui which is impossible.

In conclusion, there is no way to write an adapter from xtext.ui to xtext.ide without adding LSP4J as a dependency for xtext.ui. Creating new interfaces for the LSP4J arguments in xtext.ide and delegating those to said LSP4J objects could alleviate the problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with example PR #710, then trace how xtext.ide.server, xtext.ide, and xtext.ui use IOccurrenceComputer and IDocumentHighlightService. Compare the LSP4J input and output types and document the dependency constraints; done requires an agreed design that permits the adapter without adding the prohibited dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.