module Solargraph::LanguageServer::Host::Dispatch
def diagnoser
-
(Host::Diagnoser)
-
Other tags:
- Abstract: -
def diagnoser raise NotImplementedError, 'Host::Dispatch requires a diagnoser method' end
def explicit_library_for uri
-
(Library, nil)
-
Parameters:
-
uri
(String
) --
Raises:
-
(FileNotFoundError)
- if the source could not be attached.
def explicit_library_for uri filename = UriHelpers.uri_to_file(uri) libraries.each do |lib| if lib.contain?(filename) lib.attach sources.find(uri) if sources.include?(uri) return lib end end nil end
def generic_library
-
(Library)
-
def generic_library @generic_library ||= Solargraph::Library.new(Solargraph::Workspace.new('', nil, options), nil) .tap { |lib| lib.add_observer self } end
def generic_library_for uri
-
(Library)
-
Parameters:
-
uri
(String
) --
Raises:
-
(FileNotFoundError)
- if the source could not be attached.
def generic_library_for uri generic_library.attach sources.find(uri) generic_library end
def implicit_library_for uri
-
(Library, nil)
-
Parameters:
-
uri
(String
) --
Raises:
-
(FileNotFoundError)
- if the source could not be attached.
def implicit_library_for uri filename = UriHelpers.uri_to_file(uri) libraries.each do |lib| if filename.start_with?(lib.workspace.directory) lib.attach sources.find(uri) return lib end end nil end
def libraries
-
(::Array
-)
def libraries @libraries ||= [] end
def library_for uri
-
(Library)
-
Parameters:
-
uri
(String
) --
def library_for uri result = explicit_library_for(uri) || implicit_library_for(uri) || generic_library_for(uri) # previous library for already call attach. avoid call twice # result.attach sources.find(uri) if sources.include?(uri) result end
def options
def options @options ||= {}.freeze end
def sources
-
(Sources)
-
def sources @sources ||= begin src = Sources.new src.add_observer self, :update_libraries src end end
def update progress
-
(void)
-
Parameters:
-
library
(Solargraph::Library
) --
def update progress progress&.send(self) end
def update_libraries uri
-
(void)
-
Parameters:
-
uri
(String
) --
def update_libraries uri src = sources.find(uri) using = libraries.select { |lib| lib.contain?(src.filename) } using.push library_for(uri) if using.empty? using.each { |lib| lib.merge src } diagnoser.schedule uri end