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

Add types declaration #406

Merged
merged 24 commits into from
Feb 22, 2022
Merged

Add types declaration #406

merged 24 commits into from
Feb 22, 2022

Conversation

pluralia
Copy link
Contributor

@pluralia pluralia commented Feb 10, 2022

  • Adds interface and type syntax
  • Adds ReturnType & adds it to the scope for cross-references
  • Removes properties lifting by replacement interfaces with types in the AST (closes #408)
  • Adds references in types as @ and arrays as [] (for example, @MyType[] means an array of references on MyType)
  • Adds types in the AST reflection
  • Sorts the AST: interfaces and types / fields / fields types / container types / cases in reflection

@pluralia pluralia marked this pull request as ready for review February 19, 2022 21:16
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

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

Thanks, @pluralia! At first glance this looks good. I'll have a more in-depth look later, here are a few initial remarks.

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

This is looking fantastic, thanks 👍

I noticed that highlighting of return types for terminal rules does no longer work as expected. You should replace this code:

https://github.com/langium/langium/blob/e3145e483ab2e9afe9554bb8d6c899d492b6d34a/packages/langium/src/grammar/langium-grammar-semantic-token-provider.ts#L30-L35

With this:

} else if ((isParserRule(node) && isDataTypeRule(node) || isTerminalRule(node)) && node.type?.name) {
  acceptor({
    node: node.type,
    feature: 'name',
    type: SemanticTokenTypes.type
  });
}

packages/langium/src/grammar/grammar-util.ts Show resolved Hide resolved
packages/langium-cli/src/generator/ast-generator.ts Outdated Show resolved Hide resolved
packages/langium-cli/src/generator/type-collector.ts Outdated Show resolved Hide resolved
packages/langium-cli/src/generator/type-collector.ts Outdated Show resolved Hide resolved
packages/langium-cli/src/generator/type-collector.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

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

Let's ship this! We need to work on a few basic validations, then release v0.3.0 is ready to go.

packages/langium/src/grammar/grammar-util.ts Outdated Show resolved Hide resolved
packages/langium/src/grammar/grammar-util.ts Outdated Show resolved Hide resolved
@pluralia pluralia merged commit 54652ab into main Feb 22, 2022
@pluralia pluralia deleted the pluralia/types branch February 22, 2022 09:28
@spoenemann spoenemann added this to the v0.3.0 milestone Mar 3, 2022
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.

Remove properties lifting
3 participants