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 resolved: true magic comment #2234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Jan 15, 2025

The resolved: true magic comment allows skipping type name resolution on a file-by-file basis.

  • The magic comment can be placed on the first line of RBS files.
  • Writer doesn't work if the magic comment is given, and the documentation is also given from the first line.
# resolved: true
# The class is something to explain the writer bug.
class WriterHasABug
end

The output will have duplicated resolved: true lines.

@soutaro soutaro added this to the RBS 3.9 milestone Jan 15, 2025
@soutaro soutaro force-pushed the resolved-magic-comment branch from 3f9a1ff to cfa558f Compare January 15, 2025 01:52
@ParadoxV5
Copy link
Contributor

What’s resolved? How about rbs:ignore?

@soutaro
Copy link
Member Author

soutaro commented Jan 15, 2025

Loading RBS files requires resolving relative type names to absolute ones. This takes ~10 secs for bigger libraries, like aws-sdk. The resolved: true magic comment solves this problem, because the type definitions included in aws-sdk are generated from other type declarations. The type name resolution can be done during generation.

@ParadoxV5
Copy link
Contributor

resolve-relative-types-during-generation? lazy-relative-resolve?? 🤔

@soutaro
Copy link
Member Author

soutaro commented Jan 15, 2025

Hmm. More descriptive syntax would make sense, while I prefer the compact syntax.

# resolved: true
# resolved-type-names: true
# no-relative-type-names: true

It's not lazy resolution nor only for generation.

@ParadoxV5
Copy link
Contributor

resolve-type-names: false (note lack of -d) sounds good. or resolve-types, resolve-relative-types

@soutaro soutaro force-pushed the resolved-magic-comment branch from 0023116 to df94af2 Compare January 16, 2025 03:23
@soutaro
Copy link
Member Author

soutaro commented Jan 16, 2025

Going with resolve-type-names: false syntax. true is also allowed, but it doesn't make much sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants