Skip to content

Add resolve-type-names: false magic comment - #2234

Merged
soutaro merged 2 commits into
masterfrom
resolved-magic-comment
Jan 20, 2025
Merged

soutaro merged 2 commits into
masterfrom
resolved-magic-comment

Conversation

@soutaro

@soutaro soutaro commented Jan 15, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

What’s resolved? How about rbs:ignore?

@soutaro

soutaro commented Jan 15, 2025

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Contributor

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

@soutaro

soutaro commented Jan 15, 2025

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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

soutaro commented Jan 16, 2025

Copy link
Copy Markdown
Member Author

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

@soutaro soutaro changed the title Add resolved: true magic comment Add resolve-type-names: false magic comment Jan 18, 2025
@soutaro
soutaro added this pull request to the merge queue Jan 20, 2025
Merged via the queue into master with commit 1b66e98 Jan 20, 2025
@soutaro
soutaro deleted the resolved-magic-comment branch January 20, 2025 01:43
@soutaro soutaro added the Released PRs already included in the released version label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Released PRs already included in the released version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants