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

Ability to override parser errors to make them more meaningful? #1086

Closed
trusktr opened this issue Jun 19, 2023 · 2 comments
Closed

Ability to override parser errors to make them more meaningful? #1086

trusktr opened this issue Jun 19, 2023 · 2 comments
Milestone

Comments

@trusktr
Copy link

trusktr commented Jun 19, 2023

In this conversation, #1045, I asked

There's currently no way to hook in and provide better messages for certain parser errors? Would it even be feasible for that to be a feature?

@msujew replied

Yeah, that should be feasible, but as of now the parser error message generator is hardcoded into Langium. It might make sense to extract it to a service though.

and @spoenemann asked to open an issue to track this idea, so here it is. :)

@spoenemann
Copy link
Contributor

Thanks! Question: would it work to define a different errorMessageProvider in the parser config?

https://github.com/langium/langium/blob/0cd59e78a0b8e1dd681a379df2f1c06debee514a/packages/langium/src/parser/langium-parser.ts#L515

You should be able to override the default in your DI module:

export const MyLanguageModule: Module<...> = {
    parser: {
        ParserConfig: {
            ...
        }
    }
};

@msujew
Copy link
Member

msujew commented Sep 13, 2023

Resolved by #1108.

@msujew msujew closed this as completed Sep 13, 2023
@spoenemann spoenemann added this to the v1.3.0 milestone Sep 14, 2023
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

No branches or pull requests

3 participants