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
104 105 106 |
# File 'lib/steep/services/completion_provider.rb', line 104 def absolute_type_name @absolute_type_name end |
#env ⇒ Object
Returns the value of attribute env
104 105 106 |
# File 'lib/steep/services/completion_provider.rb', line 104 def env @env end |
#range ⇒ Object
Returns the value of attribute range
104 105 106 |
# File 'lib/steep/services/completion_provider.rb', line 104 def range @range end |
#relative_type_name ⇒ Object
Returns the value of attribute relative_type_name
104 105 106 |
# File 'lib/steep/services/completion_provider.rb', line 104 def relative_type_name @relative_type_name end |
Instance Method Details
#comments ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/steep/services/completion_provider.rb', line 125 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.decls.each do |decl| if comment = decl.decl.comment comments << comment 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
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/steep/services/completion_provider.rb', line 105 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 |