Sha256: f5a3a21c29797b6c074c9b2b079c3a9e54f598b46e43ecbed203125bac8d501c

Contents?: true

Size: 1.94 KB

Versions: 109

Compression:

Stored size: 1.94 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # A pattern to describe in which file operation requests or notifications
      # the server is interested in.
      #
      class FileOperationPattern
        def initialize(glob:, matches: nil, options: nil)
          @attributes = {}

          @attributes[:glob] = glob
          @attributes[:matches] = matches if matches
          @attributes[:options] = options if options

          @attributes.freeze
        end

        #
        # The glob pattern to match. Glob patterns can have the following syntax:
        # - `*` to match one or more characters in a path segment
        # - `?` to match on one character in a path segment
        # - `**` to match any number of path segments, including none
        # - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}`
        # matches all TypeScript and JavaScript files)
        # - `[]` to declare a range of characters to match in a path segment
        # (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
        # - `[!...]` to negate a range of characters to match in a path segment
        # (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
        # not `example.0`)
        #
        # @return [string]
        def glob
          attributes.fetch(:glob)
        end

        #
        # Whether to match files or folders with this pattern.
        #
        # Matches both if undefined.
        #
        # @return [FileOperationPatternKind]
        def matches
          attributes.fetch(:matches)
        end

        #
        # Additional options used during matching.
        #
        # @return [FileOperationPatternOptions]
        def options
          attributes.fetch(:options)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

        def to_json(*args)
          to_hash.to_json(*args)
        end
      end
    end
  end
end

Version data entries

109 entries across 109 versions & 14 rubygems

Version Path
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/file_operation_pattern.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.17.0.3 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.17.0.2 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.17.0.1 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.16.0.3 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/file_operation_pattern.rb
language_server-protocol-3.16.0.0 lib/language_server/protocol/interface/file_operation_pattern.rb