Class: Steep::Services::CompletionProvider::TypeNameItem
- Defined in:
- lib/steep/services/completion_provider.rb
Instance Attribute Summary collapse
-
#absolute_type_name ⇒ Object
Returns the value of attribute absolute_type_name.
-
#env ⇒ Object
Returns the value of attribute env.
-
#range ⇒ Object
Returns the value of attribute range.
-
#relative_type_name ⇒ Object
Returns the value of attribute relative_type_name.
Instance Method Summary collapse
Instance Attribute Details
#absolute_type_name ⇒ Object
Returns the value of attribute absolute_type_name
124 125 126 |
# File 'lib/steep/services/completion_provider.rb', line 124 def absolute_type_name @absolute_type_name end |
#env ⇒ Object
Returns the value of attribute env
124 125 126 |
# File 'lib/steep/services/completion_provider.rb', line 124 def env @env end |
#range ⇒ Object
Returns the value of attribute range
124 125 126 |
# File 'lib/steep/services/completion_provider.rb', line 124 def range @range end |
#relative_type_name ⇒ Object
Returns the value of attribute relative_type_name
124 125 126 |
# File 'lib/steep/services/completion_provider.rb', line 124 def relative_type_name @relative_type_name end |
Instance Method Details
#comments ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/steep/services/completion_provider.rb', line 145 def comments comments = [] #: Array[RBS::AST::Comment] case when absolute_type_name.interface? if comment = env.interface_decls.fetch(absolute_type_name).decl.comment comments << comment end when absolute_type_name.alias? if comment = env.type_alias_decls.fetch(absolute_type_name).decl.comment comments << comment end when absolute_type_name.class? case entry = env.module_class_entry(absolute_type_name) when ::RBS::Environment::ClassEntry, ::RBS::Environment::ModuleEntry entry.each_decl do |decl| case decl when ::RBS::AST::Declarations::Base if comment = decl.comment comments << comment end when ::RBS::AST::Ruby::Declarations::Base # noop end end when ::RBS::Environment::ClassAliasEntry, ::RBS::Environment::ModuleAliasEntry if comment = entry.decl.comment comments << comment end else raise end else raise end comments end |
#decl ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/steep/services/completion_provider.rb', line 125 def decl case when absolute_type_name.interface? env.interface_decls.fetch(absolute_type_name).decl when absolute_type_name.alias? env.type_alias_decls.fetch(absolute_type_name).decl when absolute_type_name.class? case entry = env.module_class_entry(absolute_type_name) when ::RBS::Environment::ClassEntry, ::RBS::Environment::ModuleEntry entry.primary_decl when ::RBS::Environment::ClassAliasEntry, ::RBS::Environment::ModuleAliasEntry entry.decl else raise "absolute_type_name=#{absolute_type_name}, relative_type_name=#{relative_type_name}" end else raise end end |