Skip to content

Comments

Collect rule call statistics - initial#8

Merged
dhuebner merged 5 commits intomainfrom
dhuebner/document-analyzer
Nov 24, 2025
Merged

Collect rule call statistics - initial#8
dhuebner merged 5 commits intomainfrom
dhuebner/document-analyzer

Conversation

@dhuebner
Copy link
Contributor

As we need the document when analyzing rules usage I moved document creation to an abstract AbstractDocumentEvaluator class that also handle Document build failure.

Existing LangiumEvaluator now implements abstract evaluateDocument() method. Otherwise everything works as before.

If the use now wants to collect usage statistic it can use the new LangiumDocumentAnalyzer that extends LangiumEvaluator. In the evaluateDocument the evaluation result EvaluatorResult will be enriched with additional syntax_statistics data.

Overall I'm not quite satisfied with the existing evaluation API. I think we need a possibility to register Evaluators that work with Langium documents directly. Otherwise we will probably build same document several times or maintain the documents state in document related evaluators.

@dhuebner dhuebner force-pushed the dhuebner/document-analyzer branch from 954dcc3 to 2d83231 Compare November 21, 2025 11:15
@dhuebner dhuebner marked this pull request as ready for review November 21, 2025 11:16
@dhuebner dhuebner requested a review from montymxb November 21, 2025 15:48
Copy link
Contributor

@montymxb montymxb left a comment

Choose a reason for hiding this comment

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

Approved :octocat: ! This looks really good, just one question about the Gini index calculation, but overall looks fine.

@dhuebner dhuebner merged commit e1b1816 into main Nov 24, 2025
2 checks passed
@dhuebner dhuebner deleted the dhuebner/document-analyzer branch November 24, 2025 09:23
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