Class: Solargraph::LanguageServer::Host
- Inherits:
-
Object
- Object
- Solargraph::LanguageServer::Host
- Includes:
- Observable, Dispatch, UriHelpers, Solargraph::Logging
- Defined in:
- lib/solargraph/language_server/host.rb,
lib/solargraph/language_server/host/sources.rb,
lib/solargraph/language_server/host/dispatch.rb,
lib/solargraph/language_server/host/diagnoser.rb,
lib/solargraph/language_server/host/message_worker.rb
Overview
The language server protocol’s data provider. Hosts are responsible for querying the library and processing messages. They also provide thread safety for multi-threaded transports.
Defined Under Namespace
Modules: Dispatch Classes: Diagnoser, MessageWorker, Sources
Constant Summary
Constants included from Solargraph::Logging
Solargraph::Logging::DEFAULT_LOG_LEVEL, Solargraph::Logging::LOG_LEVELS
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#allow_registration(method) ⇒ void
Flag a method as available for dynamic registration.
-
#can_register?(method) ⇒ Boolean
True if the specified LSP method can be dynamically registered.
-
#cancel(id) ⇒ void
Cancel the method with the specified ID.
-
#cancel?(id) ⇒ Boolean
True if the host received a request to cancel the method with the specified ID.
- #catalog ⇒ void
-
#change(params) ⇒ void
Update a document from the parameters of a textDocument/didChange method.
-
#clear(id) ⇒ void
Delete the specified ID from the list of cancelled IDs if it exists.
- #client_supports_progress? ⇒ Boolean
-
#close(uri) ⇒ void
Close the file specified by the URI.
-
#command_path ⇒ String
@sg-ignore Need to validate config @sg-ignore Need to validate config.
- #completions_at(uri, line, column) ⇒ Solargraph::SourceMap::Completion?
-
#configure(update) ⇒ void
Update the configuration options with the provided hash.
-
#create(*uris) ⇒ Boolean
Respond to a notification that files were created in the workspace.
- #default_configuration ⇒ Hash{String => Boolean,String}
- #definitions_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>?
-
#delete(*uris) ⇒ void
Delete the specified files from the library.
- #diagnose(uri) ⇒ void
- #document(query) ⇒ Array
- #document_symbols(uri) ⇒ Array<Solargraph::Pin::Base>
-
#flush ⇒ String
Clear the message buffer and return the most recent data.
- #folders ⇒ Array<String>
- #folding_ranges(uri) ⇒ Array<Range>
- #formatter_config(uri) ⇒ Hash
-
#initialize ⇒ Host
constructor
A new instance of Host.
-
#locate_pins(params) ⇒ Array<Pin::Base>
Locate multiple pins that match a completion item.
-
#open(uri, text, version) ⇒ void
Open the specified file in the library.
-
#open?(uri) ⇒ Boolean
True if the specified file is currently open in the library.
- #open_from_disk(uri) ⇒ void
- #options ⇒ Hash{String => Boolean, String}
-
#pending_completions? ⇒ Bool
If has pending completion request.
-
#pending_requests ⇒ Array<Integer>
Get a list of IDs for server requests that are waiting for responses from the client.
-
#prepare(directory, name = nil) ⇒ void
Prepare a library for the specified directory.
-
#prepare_folders(array) ⇒ void
Prepare multiple folders.
-
#process(request) ⇒ void
Called by adapter, to handle the request.
- #query_symbols(query) ⇒ Array<Solargraph::Pin::Base>
-
#queue(message) ⇒ void
Queue a message to be sent to the client.
- #read_text(uri) ⇒ String
-
#receive(request) ⇒ Solargraph::LanguageServer::Message::Base, ...
Start processing a request from the client.
- #references_from(uri, line, column, strip: true, only: false) ⇒ Array<Solargraph::Location>
-
#register_capabilities(methods) ⇒ void
Register the methods as capabilities with the client.
-
#registered?(method) ⇒ Boolean
True if the specified method has been registered.
-
#remove(directory) ⇒ void
Remove a directory.
- #remove_folders(array) ⇒ void
- #search(query) ⇒ Array<String>
-
#send_notification(method, params) ⇒ void
Send a notification to the client.
-
#send_request(method, params, &block) {|The| ... } ⇒ void
Send a request to the client and execute the provided block to process the response.
-
#show_message(text, type = LanguageServer::MessageTypes::INFO) ⇒ void
Send a notification to the client.
-
#show_message_request(text, type, actions, &block) {|The| ... } ⇒ void
Send a notification with optional responses.
- #signatures_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>
-
#start ⇒ void
Start asynchronous process handling.
- #stop ⇒ void
- #stopped? ⇒ Boolean
- #synchronizing? ⇒ Boolean
- #type_definitions_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>?
-
#unregister_capabilities(methods) ⇒ void
Unregister the methods with the client.
Methods included from Dispatch
#explicit_library_for, #generic_library, #generic_library_for, #implicit_library_for, #libraries, #library_for, #sources, #update, #update_libraries
Methods included from Solargraph::Logging
Methods included from UriHelpers
decode, encode, file_to_uri, uri_to_file
Constructor Details
#initialize ⇒ Host
Returns a new instance of Host.
26 27 28 29 30 31 32 33 34 |
# File 'lib/solargraph/language_server/host.rb', line 26 def initialize @buffer_semaphore = Mutex.new @request_mutex = Mutex.new @buffer = String.new @stopped = true @next_request_id = 1 @dynamic_capabilities = Set.new @registered_capabilities = Set.new end |
Instance Attribute Details
#client_capabilities ⇒ Hash{String => Hash{String => Boolean}}
702 703 704 |
# File 'lib/solargraph/language_server/host.rb', line 702 def client_capabilities @client_capabilities ||= {} end |
Instance Method Details
#allow_registration(method) ⇒ void
This method returns an undefined value.
Flag a method as available for dynamic registration.
437 438 439 |
# File 'lib/solargraph/language_server/host.rb', line 437 def allow_registration method @dynamic_capabilities.add method end |
#can_register?(method) ⇒ Boolean
True if the specified LSP method can be dynamically registered.
445 446 447 |
# File 'lib/solargraph/language_server/host.rb', line 445 def can_register? method @dynamic_capabilities.include?(method) end |
#cancel(id) ⇒ void
This method returns an undefined value.
Cancel the method with the specified ID.
65 66 67 |
# File 'lib/solargraph/language_server/host.rb', line 65 def cancel id cancelled.push id end |
#cancel?(id) ⇒ Boolean
True if the host received a request to cancel the method with the specified ID.
74 75 76 |
# File 'lib/solargraph/language_server/host.rb', line 74 def cancel? id cancelled.include? id end |
#catalog ⇒ void
This method returns an undefined value.
696 697 698 699 |
# File 'lib/solargraph/language_server/host.rb', line 696 def catalog return unless libraries.all?(&:mapped?) libraries.each(&:catalog) end |
#change(params) ⇒ void
This method returns an undefined value.
Update a document from the parameters of a textDocument/didChange method.
250 251 252 253 254 |
# File 'lib/solargraph/language_server/host.rb', line 250 def change params updater = generate_updater(params) sources.update params['textDocument']['uri'], updater diagnoser.schedule params['textDocument']['uri'] end |
#clear(id) ⇒ void
This method returns an undefined value.
Delete the specified ID from the list of cancelled IDs if it exists.
82 83 84 |
# File 'lib/solargraph/language_server/host.rb', line 82 def clear id cancelled.delete id end |
#client_supports_progress? ⇒ Boolean
706 707 708 |
# File 'lib/solargraph/language_server/host.rb', line 706 def client_supports_progress? client_capabilities['window'] && client_capabilities['window']['workDoneProgress'] end |
#close(uri) ⇒ void
This method returns an undefined value.
Close the file specified by the URI.
197 198 199 200 201 |
# File 'lib/solargraph/language_server/host.rb', line 197 def close uri logger.info "Closing #{uri}" sources.close uri diagnoser.schedule uri end |
#command_path ⇒ String
@sg-ignore Need to validate config @sg-ignore Need to validate config
307 308 309 310 |
# File 'lib/solargraph/language_server/host.rb', line 307 def command_path # @type [String] ['commandPath'] || 'solargraph' end |
#completions_at(uri, line, column) ⇒ Solargraph::SourceMap::Completion?
544 545 546 547 |
# File 'lib/solargraph/language_server/host.rb', line 544 def completions_at uri, line, column library = library_for(uri) library.completions_at uri_to_file(uri), line, column end |
#configure(update) ⇒ void
This method returns an undefined value.
Update the configuration options with the provided hash.
50 51 52 53 54 |
# File 'lib/solargraph/language_server/host.rb', line 50 def configure update return if update.nil? .merge! update logger.level = LOG_LEVELS[['logLevel']] || DEFAULT_LOG_LEVEL end |
#create(*uris) ⇒ Boolean
Respond to a notification that files were created in the workspace. The libraries will determine whether the files should be merged; see Solargraph::Library#create_from_disk.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/solargraph/language_server/host.rb', line 134 def create *uris filenames = uris.map { |uri| uri_to_file(uri) } result = false libraries.each do |lib| result = true if lib.create_from_disk(*filenames) end uris.each do |uri| diagnoser.schedule uri if open?(uri) end result end |
#default_configuration ⇒ Hash{String => Boolean,String}
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/solargraph/language_server/host.rb', line 671 def default_configuration { 'completion' => true, 'hover' => true, 'symbols' => true, 'definitions' => true, 'typeDefinitions' => true, 'rename' => true, 'references' => true, 'autoformat' => false, 'diagnostics' => true, 'formatting' => false, 'folding' => true, 'highlights' => true, 'logLevel' => 'warn' } end |
#definitions_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>?
558 559 560 561 |
# File 'lib/solargraph/language_server/host.rb', line 558 def definitions_at uri, line, column library = library_for(uri) library.definitions_at(uri_to_file(uri), line, column) end |
#delete(*uris) ⇒ void
This method returns an undefined value.
Delete the specified files from the library.
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/solargraph/language_server/host.rb', line 150 def delete *uris filenames = uris.map { |uri| uri_to_file(uri) } libraries.each do |lib| lib.delete_observer self lib.delete(*filenames) end uris.each do |uri| send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: [] } end end |
#diagnose(uri) ⇒ void
This method returns an undefined value.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/solargraph/language_server/host.rb', line 205 def diagnose uri if sources.include?(uri) library = library_for(uri) if library.mapped? && library.synchronized? logger.info "Diagnosing #{uri}" begin results = library.diagnose uri_to_file(uri) send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: results } rescue DiagnosticsError => e logger.warn "Error in diagnostics: #{e.}" ['diagnostics'] = false send_notification 'window/showMessage', { type: LanguageServer::MessageTypes::ERROR, message: "Error in diagnostics: #{e.}" } rescue FileNotFoundError => e # @todo This appears to happen when an external file is open and # scheduled for diagnosis, but the file was closed (i.e., the # editor moved to a different file) before diagnosis started logger.warn "Unable to diagnose #{uri} : #{e.}" send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: [] } end else logger.info "Deferring diagnosis of #{uri}" diagnoser.schedule uri end else send_notification 'textDocument/publishDiagnostics', { uri: uri, diagnostics: [] } end end |
#document(query) ⇒ Array
614 615 616 617 618 619 620 621 622 |
# File 'lib/solargraph/language_server/host.rb', line 614 def document query result = [] if libraries.empty? result.concat generic_library.document(query) else libraries.each { |lib| result.concat lib.document(query) } end result end |
#document_symbols(uri) ⇒ Array<Solargraph::Pin::Base>
626 627 628 629 630 631 632 |
# File 'lib/solargraph/language_server/host.rb', line 626 def document_symbols uri library = library_for(uri) # At this level, document symbols should be unique; e.g., a # module_function method should return the location for Module.method # or Module#method, but not both. library.document_symbols(uri_to_file(uri)).uniq(&:location) end |
#flush ⇒ String
Clear the message buffer and return the most recent data.
269 270 271 272 273 274 275 276 |
# File 'lib/solargraph/language_server/host.rb', line 269 def flush tmp = '' @buffer_semaphore.synchronize do tmp = @buffer.clone @buffer.clear end tmp end |
#folders ⇒ Array<String>
346 347 348 |
# File 'lib/solargraph/language_server/host.rb', line 346 def folders libraries.map { |lib| lib.workspace.directory } end |
#folding_ranges(uri) ⇒ Array<Range>
691 692 693 |
# File 'lib/solargraph/language_server/host.rb', line 691 def folding_ranges uri sources.find(uri).folding_ranges end |
#formatter_config(uri) ⇒ Hash
535 536 537 538 |
# File 'lib/solargraph/language_server/host.rb', line 535 def formatter_config uri library = library_for(uri) library.workspace.config.formatter end |
#locate_pins(params) ⇒ Array<Pin::Base>
Locate multiple pins that match a completion item. The first match is based on the corresponding location in a library source if available. Subsequent matches are based on path.
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
# File 'lib/solargraph/language_server/host.rb', line 481 def locate_pins params return [] unless params['data'] && params['data']['uri'] library = library_for(params['data']['uri']) # @type [Array<Pin::Base>] result = [] if params['data']['location'] location = Location.new( params['data']['location']['filename'], Range.from_to( params['data']['location']['range']['start']['line'], params['data']['location']['range']['start']['character'], params['data']['location']['range']['end']['line'], params['data']['location']['range']['end']['character'] ) ) result.concat(library.locate_pins(location).select { |pin| pin.name == params['label'] }) end if params['data']['path'] result.concat library.path_pins(params['data']['path']) # @todo This exception is necessary because `Library#path_pins` does # not perform a namespace method query, so the implicit `.new` pin # might not exist. if result.empty? && params['data']['path'] =~ /\.new$/ result.concat(library.path_pins(params['data']['path'].sub(/\.new$/, '#initialize')).map do |pin| next pin unless pin.name == 'initialize' Pin::Method.new( name: 'new', scope: :class, location: pin.location, # @sg-ignore Unresolved call to parameters on Solargraph::Pin::Base parameters: pin.parameters, return_type: ComplexType.try_parse(params['data']['path']), comments: pin.comments, closure: pin.closure, source: :solargraph ) end) end end # Selecting by both location and path can result in duplicate pins result.uniq { |p| [p.path, p.location] } end |
#open(uri, text, version) ⇒ void
This method returns an undefined value.
Open the specified file in the library.
170 171 172 173 174 175 176 |
# File 'lib/solargraph/language_server/host.rb', line 170 def open uri, text, version src = sources.open(uri, text, version) libraries.each do |lib| lib.merge src end diagnoser.schedule uri end |
#open?(uri) ⇒ Boolean
True if the specified file is currently open in the library.
189 190 191 |
# File 'lib/solargraph/language_server/host.rb', line 189 def open? uri sources.include? uri end |
#open_from_disk(uri) ⇒ void
This method returns an undefined value.
180 181 182 183 |
# File 'lib/solargraph/language_server/host.rb', line 180 def open_from_disk uri sources.open_from_disk(uri) diagnoser.schedule uri end |
#options ⇒ Hash{String => Boolean, String}
57 58 59 |
# File 'lib/solargraph/language_server/host.rb', line 57 def @options ||= default_configuration end |
#pending_completions? ⇒ Bool
Returns if has pending completion request.
550 551 552 |
# File 'lib/solargraph/language_server/host.rb', line 550 def pending_completions? ..reverse_each.any? { |req| req['method'] == 'textDocument/completion' } end |
#pending_requests ⇒ Array<Integer>
Get a list of IDs for server requests that are waiting for responses from the client.
666 667 668 |
# File 'lib/solargraph/language_server/host.rb', line 666 def pending_requests requests.keys end |
#prepare(directory, name = nil) ⇒ void
This method returns an undefined value.
Prepare a library for the specified directory.
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/solargraph/language_server/host.rb', line 283 def prepare directory, name = nil # No need to create a library without a directory. The generic library # will handle it. return if directory.nil? logger.info "Preparing library for #{directory}" path = '' path = normalize_separators(directory) unless directory.nil? begin workspace = Solargraph::Workspace.new(path, nil, ) lib = Solargraph::Library.new(workspace, name) lib.add_observer self libraries.push lib library_map lib rescue WorkspaceTooLargeError => e send_notification 'window/showMessage', { 'type' => Solargraph::LanguageServer::MessageTypes::WARNING, 'message' => e. } end end |
#prepare_folders(array) ⇒ void
This method returns an undefined value.
Prepare multiple folders.
316 317 318 319 320 321 |
# File 'lib/solargraph/language_server/host.rb', line 316 def prepare_folders array return if array.nil? array.each do |folder| prepare uri_to_file(folder['uri']), folder['name'] end end |
#process(request) ⇒ void
This method returns an undefined value.
Called by adapter, to handle the request
89 90 91 |
# File 'lib/solargraph/language_server/host.rb', line 89 def process request .queue(request) end |
#query_symbols(query) ⇒ Array<Solargraph::Pin::Base>
598 599 600 601 602 |
# File 'lib/solargraph/language_server/host.rb', line 598 def query_symbols query result = [] (libraries + [generic_library]).each { |lib| result.concat lib.query_symbols(query) } result.uniq end |
#queue(message) ⇒ void
This method returns an undefined value.
Queue a message to be sent to the client.
260 261 262 263 264 |
# File 'lib/solargraph/language_server/host.rb', line 260 def queue @buffer_semaphore.synchronize { @buffer += } changed notify_observers end |
#read_text(uri) ⇒ String
527 528 529 530 531 |
# File 'lib/solargraph/language_server/host.rb', line 527 def read_text uri library = library_for(uri) filename = uri_to_file(uri) library.read_text(filename) end |
#receive(request) ⇒ Solargraph::LanguageServer::Message::Base, ...
Start processing a request from the client. After the message is processed, caller is responsible for sending the response.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/solargraph/language_server/host.rb', line 99 def receive request if request['method'] logger.info "Host received ##{request['id']} #{request['method']}" logger.debug request = Message.select(request['method']).new(self, request) begin .process unless cancel?(request['id']) rescue StandardError => e logger.warn "Error processing request: [#{e.class}] #{e.}" # @sg-ignore Need to add nil check here logger.warn e.backtrace.join("\n") .set_error Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.}" end elsif request['id'] if requests[request['id']] requests[request['id']].process(request['result']) requests.delete request['id'] else logger.warn "Discarding client response to unrecognized message #{request['id']}" nil end else logger.warn 'Invalid message received.' logger.debug request nil end end |
#references_from(uri, line, column, strip: true, only: false) ⇒ Array<Solargraph::Location>
587 588 589 590 591 592 593 594 |
# File 'lib/solargraph/language_server/host.rb', line 587 def references_from uri, line, column, strip: true, only: false library = library_for(uri) library.references_from(uri_to_file(uri), line, column, strip: strip, only: only) rescue FileNotFoundError, InvalidOffsetError => e Solargraph.logger.warn "[#{e.class}] #{e.}" Solargraph.logger.debug e.backtrace [] end |
#register_capabilities(methods) ⇒ void
This method returns an undefined value.
Register the methods as capabilities with the client. This method will avoid duplicating registrations and ignore methods that were not flagged for dynamic registration by the client.
400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/solargraph/language_server/host.rb', line 400 def register_capabilities methods logger.debug "Registering capabilities: #{methods}" registrations = methods.select { |m| can_register?(m) and !registered?(m) }.map do |m| @registered_capabilities.add m { id: m, method: m, registerOptions: [m] } end return if registrations.empty? send_request 'client/registerCapability', { registrations: registrations } end |
#registered?(method) ⇒ Boolean
True if the specified method has been registered.
453 454 455 |
# File 'lib/solargraph/language_server/host.rb', line 453 def registered? method @registered_capabilities.include?(method) end |
#remove(directory) ⇒ void
This method returns an undefined value.
Remove a directory.
327 328 329 330 331 332 333 334 335 |
# File 'lib/solargraph/language_server/host.rb', line 327 def remove directory logger.info "Removing library for #{directory}" # @param lib [Library] libraries.delete_if do |lib| next false if lib.workspace.directory != directory lib.delete_observer self true end end |
#remove_folders(array) ⇒ void
This method returns an undefined value.
339 340 341 342 343 |
# File 'lib/solargraph/language_server/host.rb', line 339 def remove_folders array array.each do |folder| remove uri_to_file(folder['uri']) end end |
#search(query) ⇒ Array<String>
606 607 608 609 610 |
# File 'lib/solargraph/language_server/host.rb', line 606 def search query result = [] libraries.each { |lib| result.concat lib.search(query) } result end |
#send_notification(method, params) ⇒ void
This method returns an undefined value.
Send a notification to the client.
355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/solargraph/language_server/host.rb', line 355 def send_notification method, params response = { jsonrpc: '2.0', method: method, params: params } json = response.to_json envelope = "Content-Length: #{json.bytesize}\r\n\r\n#{json}" queue envelope logger.info "Server sent #{method}" logger.debug params end |
#send_request(method, params, &block) {|The| ... } ⇒ void
This method returns an undefined value.
Send a request to the client and execute the provided block to process the response. If an ID is not provided, the host will use an auto- incrementing integer.
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/solargraph/language_server/host.rb', line 377 def send_request method, params, &block @request_mutex.synchronize do = { jsonrpc: '2.0', method: method, params: params, id: @next_request_id } json = .to_json requests[@next_request_id] = Request.new(@next_request_id, &block) envelope = "Content-Length: #{json.bytesize}\r\n\r\n#{json}" queue envelope @next_request_id += 1 logger.debug params end end |
#show_message(text, type = LanguageServer::MessageTypes::INFO) ⇒ void
This method returns an undefined value.
Send a notification to the client.
639 640 641 642 643 644 |
# File 'lib/solargraph/language_server/host.rb', line 639 def text, type = LanguageServer::MessageTypes::INFO send_notification 'window/showMessage', { type: type, message: text } end |
#show_message_request(text, type, actions, &block) {|The| ... } ⇒ void
This method returns an undefined value.
Send a notification with optional responses.
654 655 656 657 658 659 660 |
# File 'lib/solargraph/language_server/host.rb', line 654 def text, type, actions, &block send_request 'window/showMessageRequest', { type: type, message: text, actions: actions }, &block end |
#signatures_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>
576 577 578 579 |
# File 'lib/solargraph/language_server/host.rb', line 576 def signatures_at uri, line, column library = library_for(uri) library.signatures_at(uri_to_file(uri), line, column) end |
#start ⇒ void
This method returns an undefined value.
Start asynchronous process handling.
39 40 41 42 43 44 |
# File 'lib/solargraph/language_server/host.rb', line 39 def start return unless stopped? @stopped = false diagnoser.start .start end |
#stop ⇒ void
This method returns an undefined value.
462 463 464 465 466 467 468 469 |
# File 'lib/solargraph/language_server/host.rb', line 462 def stop return if @stopped @stopped = true .stop diagnoser.stop changed notify_observers end |
#stopped? ⇒ Boolean
471 472 473 |
# File 'lib/solargraph/language_server/host.rb', line 471 def stopped? @stopped end |
#synchronizing? ⇒ Boolean
457 458 459 |
# File 'lib/solargraph/language_server/host.rb', line 457 def synchronizing? !libraries.all?(&:synchronized?) end |
#type_definitions_at(uri, line, column) ⇒ Array<Solargraph::Pin::Base>?
567 568 569 570 |
# File 'lib/solargraph/language_server/host.rb', line 567 def type_definitions_at uri, line, column library = library_for(uri) library.type_definitions_at(uri_to_file(uri), line, column) end |
#unregister_capabilities(methods) ⇒ void
This method returns an undefined value.
Unregister the methods with the client. This method will avoid duplicating unregistrations and ignore methods that were not flagged for dynamic registration by the client.
420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/solargraph/language_server/host.rb', line 420 def unregister_capabilities methods logger.debug "Unregistering capabilities: #{methods}" unregisterations = methods.select { |m| registered?(m) }.map do |m| @registered_capabilities.delete m { id: m, method: m } end return if unregisterations.empty? send_request 'client/unregisterCapability', { unregisterations: unregisterations } end |