Inline support on protoype
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
复现使用 lib/calculator.rb 和 bin/rbs 的 prototype rb,输出位于 sig/lib/calculator.rbs。首先运行该命令并跟踪 prototype 路径,查看为什么内联注释仍然是注释。生成的签名使用如图所示的 Integer 参数和返回类型即表示完成。
由索引模型根据 Issue 内容生成。
描述
I was hoping to use inline documentation to generate proper type signatures, but it doesn't seem to be working at the moment. I have a PR with everything set up to demonstrate here.
Here is the gist, though:
I expect that this calculator.rb file:
class Calculator
# @rbs (Integer, Integer) -> Integer
def add(a, b)
a + b
end
end
And after running this command:
bin/rbs prototype rb lib/calculator.rb > sig/lib/calculator.rbs
Would produce this sig/lib/calculator.rbs file:
class Calculator
def add: (Integer a, Integer b) -> Integer
end
But at the moment, it produces this:
class Calculator
# @rbs (Integer, Integer) -> Integer
def add: (untyped a, untyped b) -> untyped
end
All this with the current specs:
❯ ruby --version
ruby 3.2.7 (2025-02-04 revision 02ec315244) [arm64-darwin23]
❯ bundle info rbs
* rbs (4.0.0.dev.4 8a97819)
Summary: Type signature for Ruby.
Homepage: https://github.com/ruby/rbs
Source Code: https://github.com/ruby/rbs.git
Changelog: https://github.com/ruby/rbs/blob/master/CHANGELOG.md
Path: /Users/aemadrid/.local/share/mise/installs/ruby/3.2.7/lib/ruby/gems/3.2.0/bundler/gems/rbs-8a97819d4419
Is this something that is in the works but not quite ready?
- 主要语言
- Ruby
- 星标
- 2.2k
- 派生
- 263
- 平均合并
- 1 天 20 小时
- 30 天内合并 PR
- 64
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/rbs 的其他 Issue
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class body可能已有人在做 @ksss 于 50 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
相似的 Issue
-
Pro request form loses all text when the subject is too long可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug f:request-creation professional
难度 2/5 1-3 小时 新手友好度 64/100
mysociety/alaveteli#9733 · 1 条评论 ·
维护者通常 1 天内回复
-
needs verification
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 13 天内回复
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
难度 2/5 1-3 小时 新手友好度 76/100
betagouv/conseillers-entreprises#4808 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 78/100