Module: Solargraph::Pin::Conversions
Overview
TODO:
Move this stuff. It should be the responsibility of the language server.
TODO:
abstract methods below should be verified to be overridden by type checker when mixin included by non-abstract class
Instance Attribute Summary
Attributes included from Common
Instance Method Summary collapse
- #completion_item ⇒ Hash
- #completion_item_kind ⇒ Integer abstract
- #deprecated? ⇒ Boolean abstract
- #detail ⇒ String?
-
#link_documentation ⇒ String?
Get a markdown-flavored link to a documentation page.
- #probed? ⇒ Boolean abstract
- #proxied? ⇒ Boolean abstract
- #reset_conversions ⇒ void
- #resolve_completion_item ⇒ Hash
- #signature_help ⇒ ::Array<Hash>
- #text_documentation ⇒ String?
Methods included from Common
#binder, #closure, #closure=, #comments, #name, #namespace, #path, #reset_generated!, #return_type, #source
Methods included from Documenting
#documentation, normalize_indentation, strip_html_comments
Instance Method Details
#completion_item ⇒ Hash
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/solargraph/pin/conversions.rb', line 38 def completion_item @completion_item ||= { label: name, kind: completion_item_kind, detail: detail, data: { path: path, return_type: return_type.tag, location: location&.to_hash, deprecated: deprecated? } } end |
#completion_item_kind ⇒ Integer
This method is abstract.
17 18 19 |
# File 'lib/solargraph/pin/conversions.rb', line 17 def completion_item_kind raise NotImplementedError end |
#deprecated? ⇒ Boolean
This method is abstract.
23 24 25 |
# File 'lib/solargraph/pin/conversions.rb', line 23 def deprecated? raise NotImplementedError end |
#detail ⇒ String?
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/solargraph/pin/conversions.rb', line 71 def detail # This property is not cached in an instance variable because it can # change when pins get proxied. detail = String.new unless return_type.undefined? detail += "=#{if probed? '~' else (proxied? ? '^' : '>') end} #{return_type}" end detail.strip! return nil if detail.empty? detail end |
#link_documentation ⇒ String?
Get a markdown-flavored link to a documentation page.
90 91 92 |
# File 'lib/solargraph/pin/conversions.rb', line 90 def link_documentation @link_documentation ||= generate_link end |
#probed? ⇒ Boolean
This method is abstract.
28 29 30 |
# File 'lib/solargraph/pin/conversions.rb', line 28 def probed? raise NotImplementedError end |
#proxied? ⇒ Boolean
This method is abstract.
33 34 35 |
# File 'lib/solargraph/pin/conversions.rb', line 33 def proxied? raise NotImplementedError end |
#reset_conversions ⇒ void
This method returns an undefined value.
102 103 104 105 106 107 108 |
# File 'lib/solargraph/pin/conversions.rb', line 102 def reset_conversions @completion_item = nil @resolve_completion_item = nil @signature_help = nil @detail = nil @link_documentation = nil end |
#resolve_completion_item ⇒ Hash
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/solargraph/pin/conversions.rb', line 53 def resolve_completion_item @resolve_completion_item ||= begin extra = {} alldoc = '' # alldoc += link_documentation unless link_documentation.nil? # alldoc += "\n\n" unless alldoc.empty? alldoc += documentation unless documentation.nil? extra[:documentation] = alldoc unless alldoc.empty? completion_item.merge(extra) end end |
#signature_help ⇒ ::Array<Hash>
66 67 68 |
# File 'lib/solargraph/pin/conversions.rb', line 66 def signature_help [] end |
#text_documentation ⇒ String?
95 96 97 98 99 |
# File 'lib/solargraph/pin/conversions.rb', line 95 def text_documentation this_path = path || name || return_type.tag return nil if this_path == 'undefined' escape_brackets this_path end |