Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to make some operations rely on DOM instead of ECJ #1983

Closed

Conversation

mickaelistria
Copy link
Contributor

@mickaelistria mickaelistria commented Feb 8, 2024

(continuation of #1863 as the source repo/branch changed)

Switch to make some operations rely on DOM instead of ECJ

Introduced 2 system property switches to control whether some IDE
operations are using ECJ parser (legacy/default) or whether to make
those operations powered by a full DOM.

  • CompilationUnit.DOM_BASED_OPERATIONS will make codeSelect (hover, link to definition...), buildStructure (JDT Project element model), reconciler (code diagnostics feedback); this one seems currently working ✔
  • CompilationUnit.codeComplete.DOM_BASED_OPERATIONS controls completion (unlike other operations, completion based on DOM is far from being complete or straightforward) 🏗️
  • SourceIndexer.DOM_BASED_INDEXER controls whether the indexation of a source document should first build/use a full DOM. This one is currently incomplete 🏗️

The DOM-based operation can then allow to plug alternative compiler then ECJ and still get JDT functionalities working.

@mickaelistria mickaelistria changed the title https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1863Dom based operations Switch to make some operations rely on DOM instead of ECJ Feb 8, 2024
@mickaelistria mickaelistria marked this pull request as draft February 16, 2024 23:09
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 5 times, most recently from 48eebfc to 7052ee5 Compare February 25, 2024 16:57
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 8 times, most recently from 4330a3f to edba7c2 Compare March 11, 2024 20:20
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 4 times, most recently from 5a5ca09 to 7649a67 Compare March 15, 2024 09:38
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 2 times, most recently from 3c2413d to cb01ee7 Compare March 25, 2024 10:58
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 5 times, most recently from f984518 to b4bd774 Compare March 29, 2024 13:51
@mickaelistria mickaelistria force-pushed the dom-based-operations branch 9 times, most recently from 8ebcc50 to b5f5f0a Compare April 5, 2024 13:46
Introduced 2 system property switches to control whether some IDE
operations are using ECJ parser (legacy/default) or whether to make
those operations powered by a full DOM.

* CompilationUnit.DOM_BASED_OPERATIONS will make codeSelect (hover, link
to definition...), buildStructure (JDT Project element model),
reconciler (code diagnostics feedback); this one seems currently working ✔
* CompilationUnit.codeComplete.DOM_BASED_OPERATIONS controls completion
(unlike other
operations, completion based on DOM is far from being complete or
straightforward) 🏗️
* SourceIndexer.DOM_BASED_INDEXER controls whether the indexation of a source
document should first build/use a full DOM. This one is currently incomplete 🏗️

The DOM-based operation can then allow to plug alternative compiler then
ECJ and still get JDT functionalities working.

Also-By: David Thompson <[email protected]>
Also-By: Snjezana Peco <[email protected]>
The parser used to build AST isn't recovering as well as the selection
parser. Let's disable those at the moment. They can be re-enabled is the parser
used by ASTParser is made to recover better.
Some other tests related to particular bugs in JDT are also skipped for the moment.

We can't leverage Assume.assume... and skipped tests because those tests
run with JUnit 3
@mickaelistria
Copy link
Contributor Author

We won't work further on making JDT's DOM-first approach fully compatible with ECJ. It would still be a nice-to-have, but the remaining issues are hard to fix in ECJ and are not a requirement to fix them in order to enable alternative compiler backends, so no further work in planned on this topic. DOM-first is now fully included with DOM with Javac branch.
If anyone still believes this DOM-first work makes sense independently of Javac, please start the discussion and we'd be happy to support anyone willing to consolidate DOM-first with ECJ, it's more or less a matter of making ~30 tests pass (but they are tricky ones).

@mickaelistria
Copy link
Contributor Author

FWIW, I'll probably rewrite this patch to not include the implementation, but just have an extension point allowing to define alternative startegies for

  • model population/reconcile
  • codeSelect
  • codeComplete
  • populateIndex

@mickaelistria
Copy link
Contributor Author

I have splitted this in 3 distinct PRs:
#2699 , #2700 an #2701 so far. Completion and Search are not yet well enough covered with a DOM-first approach and will probably be contributed later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant