module Solargraph::Pin::Conversions

def completion_item

Returns:
  • (Hash) -
def completion_item
  @completion_item ||= {
    label: name,
    kind: completion_item_kind,
    detail: detail,
    data: {
      path: path,
      return_type: return_type.tag,
      location: (location ? location.to_hash : nil),
      deprecated: deprecated?
    }
  }
end

def completion_item_kind

Other tags:
    Abstract: -

Returns:
  • (Integer) -
def completion_item_kind
  raise NotImplementedError
end

def deprecated?

Returns:
  • (Boolean) -

Other tags:
    Abstract: -
def deprecated?
  raise NotImplementedError
end

def detail

Returns:
  • (String, nil) -
def detail
  # This property is not cached in an instance variable because it can

  # change when pins get proxied.

  detail = String.new
  detail += "=#{probed? ? '~' : (proxied? ? '^' : '>')} #{return_type.to_s}" unless return_type.undefined?
  detail.strip!
  return nil if detail.empty?
  detail
end

def escape_brackets text

Returns:
  • (String) -

Parameters:
  • text (String) --
def escape_brackets text
  # text.gsub(/(\<|\>)/, "\\#{$1}")

  text.gsub("<", '\<').gsub(">", '\>')
end

def generate_link

Returns:
  • (String, nil) -
def generate_link
  this_path = path || name || return_type.tag
  return nil if this_path == 'undefined'
  return nil if this_path.nil? || this_path == 'undefined'
  return this_path if path.nil?
  "[#{escape_brackets(this_path).gsub('_', '\\\\_')}](solargraph:/document?query=#{CGI.escape(this_path)})"
end

def link_documentation

Returns:
  • (String) -
def link_documentation
  @link_documentation ||= generate_link
end

def probed?

Other tags:
    Abstract: -
def probed?
  raise NotImplementedError
end

def proxied?

Other tags:
    Abstract: -
def proxied?
  raise NotImplementedError
end

def reset_conversions

Returns:
  • (void) -
def reset_conversions
  @completion_item = nil
  @resolve_completion_item = nil
  @signature_help = nil
  @detail = nil
  @link_documentation = nil
end

def resolve_completion_item

Returns:
  • (Hash) -
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

def signature_help

Returns:
  • (::Array) -
def signature_help
  []
end

def text_documentation

Returns:
  • (String, nil) -
def text_documentation
  this_path = path || name || return_type.tag
  return nil if this_path == 'undefined'
  escape_brackets this_path
end