class Solargraph::LanguageServer::Host::Sources


A Host class for managing sources.

def add_uri(uri)

Returns:
  • (void) -

Parameters:
  • uri (String) --
def add_uri(uri)
  queue.push(uri)
end

def clear

Returns:
  • (void) -
def clear
  open_source_hash.clear
end

def close uri

Returns:
  • (void) -

Parameters:
  • uri (String) --
def close uri
  open_source_hash.delete uri
end

def find uri

Returns:
  • (Solargraph::Source) -

Parameters:
  • uri (String) --

Raises:
  • (FileNotFoundError) - if the URI does not match an open source.
def find uri
  open_source_hash[uri] || raise(Solargraph::FileNotFoundError, "Host could not find #{uri}")
end

def include? uri

Returns:
  • (Boolean) -

Parameters:
  • uri (String) --
def include? uri
  open_source_hash.key? uri
end

def open uri, text, version

Returns:
  • (Source) -

Parameters:
  • version (Integer) --
  • text (String) --
  • uri (String) --
def open uri, text, version
  filename = uri_to_file(uri)
  source = Solargraph::Source.new(text, filename, version)
  open_source_hash[uri] = source
end

def open_from_disk uri

Returns:
  • (void) -

Parameters:
  • uri (String) --
def open_from_disk uri
  source = Solargraph::Source.load(UriHelpers.uri_to_file(uri))
  open_source_hash[uri] = source
end

def open_source_hash

Returns:
  • (Hash{String => Solargraph::Source}) -
def open_source_hash
  @open_source_hash ||= {}
end

def queue

Returns:
  • (::Array) -
def queue
  @queue ||= []
end

def update uri, updater

Returns:
  • (void) -

Parameters:
  • updater (Source::Updater) --
  • uri (String) --

Raises:
  • (FileNotFoundError) - if the URI does not match an open source.
def update uri, updater
  src = find(uri)
  open_source_hash[uri] = src.synchronize(updater)
  changed
  notify_observers uri
end