Sha256: 0aacb299e3caf3a4a4719974d7f764c6633dc772550e81118906f797f9d49372

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

module Yoda
  class Server
    module Providers
      require 'yoda/server/providers/base'

      require 'yoda/server/providers/completion'
      require 'yoda/server/providers/signature'
      require 'yoda/server/providers/hover'
      require 'yoda/server/providers/definition'
      require 'yoda/server/providers/text_document_did_change'
      require 'yoda/server/providers/text_document_did_open'
      require 'yoda/server/providers/text_document_did_save'

      CLASSES = [
        Completion,
        Definition,
        Hover,
        Signature,
        TextDocumentDidChange,
        TextDocumentDidOpen,
        TextDocumentDidSave,
      ].freeze

      class << self
        # @param method [Symbol]
        # @param notifier [Notifier]
        # @param session [Session]
        # @return [Class<Providers::Base>, nil]
        def build_provider(method:, notifier:, session:)
          find_provider_class(method)&.new(notifier: notifier, session: session)
        end

        # @param method [Symbol]
        # @return [Class<Providers::Base>, nil]
        def find_provider_class(method)
          CLASSES.find { |provider_class| provider_class.provide?(method) }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yoda-language-server-0.7.2 lib/yoda/server/providers.rb
yoda-language-server-0.7.1 lib/yoda/server/providers.rb
yoda-language-server-0.7.0 lib/yoda/server/providers.rb