Replies: 1 comment 3 replies
-
Hey @ydaveluy, thanks for explaining a better solution to this problem! I'm wondering whether the performance improvements are noticeable for languages without qualified name scoping as well. Like for languages where renaming is possible (like in TypeScript/JavaScript imports) or "normal" languages without the ability to have an element available under two different names. I'm generally hesitant to include features into the framework that only benefit very few languages. I know that Xtext was more lenient in that regard, but it also contained qualified name scoping as a default feature, so it kind of made sense. However, we aim to keep the framework small to ensure a minimal bundle size, which was never a concern for Xtext (see its 40mb minimum size language servers). Note that we do have some special handling for a few languages (like with the new indentation aware lexing), but these can be tree-shaken so they don't end up in languages that don't actually need them. It gets more difficult to tree-shake stuff when it's part of the default implementation or even in the interface of a core service. What do you think about adding this as part of the respective guide? I'd be all-in for that. |
Beta Was this translation helpful? Give feedback.
-
Hello,
[edit: this change decreases the performances of the linking phase so DON'T DO THIS !]
For languages with qualified name scoping it is necessary to import the descriptions from the nested scopes to the local scope:
It involve a lot of calls to the AstNodeDescriptionProvider to re-create the description at each level.
This could be improved by creating an AstNodeDescriptionAlias from the existing AstNodeDescription. Xtext provides a similar mechanism.
I tested the following implementation:
And changed the createQualifiedDescription function to:
With my DSL, it improves performance by at least 50% to compute Local Scopes:
Is it something that could be integrated in the AstNodeDescriptionProvider ?
Beta Was this translation helpful? Give feedback.
All reactions