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

A flag to resolve populating index using ASTParser #2701

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

mickaelistria
Copy link
Contributor

What it does

Introduce a SourceIndexer.DOM_BASED_INDEXER flag which instead of using the ECJ-derived parser uses ASTParser to create a DOM and then crawls this DOM to populate index.

This has the benefit of:

  • Simplifying the code as an crawling DOM is usually simpler than dealing with lower-level parser
  • allowing other parsers as backend if ASTParser is configured for it

How to test

Author checklist

@@ -19,7 +19,7 @@
import org.eclipse.jdt.core.dom.CompilationUnit;

public class ASTHolderCUInfo extends CompilationUnitElementInfo {
int astLevel;
public int astLevel;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably better to introduce a public getter method.

@mickaelistria mickaelistria force-pushed the indexer-astParser branch 2 times, most recently from 846f8cd to 3e5350d Compare October 18, 2024 13:59
@mickaelistria mickaelistria marked this pull request as draft October 18, 2024 14:00
@mickaelistria
Copy link
Contributor Author

I'm converting as a draft as one of the remaining TODO is critical.

Introduce an alternative strategy to popular index from source file by
building and visiting their DOM using ASTParser. This allows to make
code a bit higher-level than ECJ, and allow to leverage recent changes
to use alternative strategy to get DOM too.
A system property SourceIndexer.DOM_BASED_INDEXER acts as a flag which
when "true" will enable this DOM-strategy in place of direct ECJ
parsing.
@mickaelistria
Copy link
Contributor Author

With latest version of everything, I couldn't reproduce the issue that triggered to commenting out the indexDocumentFromDOM in indexResolveDocument. So I think this is now ready for review.

@mickaelistria mickaelistria reopened this Oct 18, 2024
@mickaelistria mickaelistria marked this pull request as ready for review October 18, 2024 14:22
Copy link
Contributor

@jjohnstn jjohnstn left a comment

Choose a reason for hiding this comment

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

With the commented out code now being called and the code being completely optional and distinct from regular JDT usage, I am merging.

@jjohnstn jjohnstn merged commit dbc7c7a into eclipse-jdt:master Oct 18, 2024
14 checks passed
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.

2 participants