diff --git a/.gitignore b/.gitignore index 9106b2a..35706a9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /pkg/ /spec/reports/ /tmp/ +/.gem_rbs_collection diff --git a/Steepfile b/Steepfile new file mode 100644 index 0000000..b49afc6 --- /dev/null +++ b/Steepfile @@ -0,0 +1,29 @@ +# D = Steep::Diagnostic +# +# target :lib do +# signature "sig" +# +# check "lib" # Directory name +# check "Gemfile" # File name +# check "app/models/**/*.rb" # Glob +# # ignore "lib/templates/*.rb" +# +# # library "pathname" # Standard libraries +# # library "strong_json" # Gems +# +# # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default) +# # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting +# # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting +# # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting +# # configure_code_diagnostics do |hash| # You can setup everything yourself +# # hash[D::Ruby::NoMethod] = :information +# # end +# end + +# target :test do +# signature "sig", "sig-private" +# +# check "test" +# +# # library "pathname" # Standard libraries +# end diff --git a/lib/rbs/inline/ast.rb b/lib/rbs/inline/ast.rb new file mode 100644 index 0000000..73d4715 --- /dev/null +++ b/lib/rbs/inline/ast.rb @@ -0,0 +1,36 @@ +module RBS + module Inline + module AST + module Member + class RubyDef + end + + class RubyAlias + end + + class RubyMixin + end + + class RubyAttr + end + + class RBSDef + end + + class RBSAlias + end + + class RBSAttr + end + end + + module Declaration + class ModuleDecl + end + + class ClassDecl + end + end + end + end +end diff --git a/rbs_collection.lock.yaml b/rbs_collection.lock.yaml new file mode 100644 index 0000000..d106958 --- /dev/null +++ b/rbs_collection.lock.yaml @@ -0,0 +1,64 @@ +--- +path: ".gem_rbs_collection" +gems: +- name: abbrev + version: '0' + source: + type: stdlib +- name: fileutils + version: '0' + source: + type: stdlib +- name: json + version: '0' + source: + type: stdlib +- name: logger + version: '0' + source: + type: stdlib +- name: minitest + version: '0' + source: + type: stdlib +- name: monitor + version: '0' + source: + type: stdlib +- name: mutex_m + version: '0' + source: + type: stdlib +- name: optparse + version: '0' + source: + type: stdlib +- name: pathname + version: '0' + source: + type: stdlib +- name: prism + version: 0.24.0 + source: + type: rubygems +- name: rake + version: '13.0' + source: + type: git + name: ruby/gem_rbs_collection + revision: e047afdf7e470acf0d0cdff31bd9c3123be3ea39 + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems +- name: rbs + version: 3.4.4 + source: + type: rubygems +- name: rdoc + version: '0' + source: + type: stdlib +- name: tsort + version: '0' + source: + type: stdlib +gemfile_lock_path: Gemfile.lock diff --git a/rbs_collection.yaml b/rbs_collection.yaml new file mode 100644 index 0000000..66e30ec --- /dev/null +++ b/rbs_collection.yaml @@ -0,0 +1,19 @@ +# Download sources +sources: + - type: git + name: ruby/gem_rbs_collection + remote: https://github.com/ruby/gem_rbs_collection.git + revision: main + repo_dir: gems + +# You can specify local directories as sources also. +# - type: local +# path: path/to/your/local/repository + +# A directory to install the downloaded RBSs +path: .gem_rbs_collection + +# gems: +# # If you want to avoid installing rbs files for gems, you can specify them here. +# - name: GEM_NAME +# ignore: true diff --git a/sig/rbs/inline/ast.rbs b/sig/rbs/inline/ast.rbs new file mode 100644 index 0000000..adf45bd --- /dev/null +++ b/sig/rbs/inline/ast.rbs @@ -0,0 +1,12 @@ +module RBS + module Inline + module AST + module Member + type t = MethodDefinition + end + + module Declaration + end + end + end +end diff --git a/yard-samples/hello.rb b/yard-samples/hello.rb new file mode 100644 index 0000000..a23b493 --- /dev/null +++ b/yard-samples/hello.rb @@ -0,0 +1,6 @@ +require "prism" + +ast = Prism.parse_file("yard-samples/sample1.rb") + +pp ast.value +pp ast.comments diff --git a/yard-samples/sample1.rb b/yard-samples/sample1.rb new file mode 100644 index 0000000..4dc7acc --- /dev/null +++ b/yard-samples/sample1.rb @@ -0,0 +1,26 @@ +module Foo + # This is `Foo#foo` method + # + # @param i [Integer] Size of something + # @param j [Symbol,Integer] Something doing meaningful + # @return [String?] Returns a string or nil + # + # + # @rbs.method (Integer, String) -> void + # | [A] () { () [self: String] -> A } -> A? + # + def foo(i, j) + + end + + # @rbs.inline + # attr_reader hoge: String + # attr_reader name: String? + def hoge + + end + + class Foo + # @rbs.inline include Foo[String] + end +end