Sha256: 0a4bba02df2c3b53c0c5c2a725716055b2f6cf8754be444fbb5e629391683a87

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class FileSystemWatcher
        def initialize(glob_pattern:, kind: nil)
          @attributes = {}

          @attributes[:globPattern] = glob_pattern
          @attributes[:kind] = kind if kind

          @attributes.freeze
        end

        #
        # The  glob pattern to watch.
        #
        # 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 conditions (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_pattern
          attributes.fetch(:globPattern)
        end

        #
        # The kind of events of interest. If omitted it defaults
        # to WatchKind.Create | WatchKind.Change | WatchKind.Delete
        # which is 7.
        #
        # @return [number]
        def kind
          attributes.fetch(:kind)
        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

6 entries across 6 versions & 1 rubygems

Version Path
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/file_system_watcher.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/file_system_watcher.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/file_system_watcher.rb
language_server-protocol-3.14.0.2 lib/language_server/protocol/interface/file_system_watcher.rb
language_server-protocol-3.14.0.1 lib/language_server/protocol/interface/file_system_watcher.rb
language_server-protocol-3.14.0.0 lib/language_server/protocol/interface/file_system_watcher.rb