Sha256: e13bdfdf8bc7e4ee24bc3d4c8b2de4cf2163ffb1c6fc2c1cf4af60d8ce5e8b91

Contents?: true

Size: 1.79 KB

Versions: 4

Compression:

Stored size: 1.79 KB

Contents

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

      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'
      require 'yoda/server/providers/workspace_did_change_workspace_folders'
      require 'yoda/server/providers/workspace_did_create_files'
      require 'yoda/server/providers/workspace_did_delete_files'
      require 'yoda/server/providers/workspace_did_rename_files'
      require 'yoda/server/providers/workspace_symbol'

      CLASSES = [
        Completion,
        Definition,
        Hover,
        Signature,
        TextDocumentDidChange,
        TextDocumentDidOpen,
        TextDocumentDidSave,
        WorkspaceDidChangeWorkspaceFolders,
        WorkspaceDidCreateFiles,
        WorkspaceDidDeleteFiles,
        WorkspaceDidRenameFiles,
        WorkspaceSymbol,
      ].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

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/server/providers.rb
yoda-language-server-0.10.0 lib/yoda/server/providers.rb
yoda-language-server-0.9.0 lib/yoda/server/providers.rb
yoda-language-server-0.8.0 lib/yoda/server/providers.rb