class LanguageServer::Protocol::Interface::DocumentFilter

Attributes

attributes[R]

Public Class Methods

new(language: nil, scheme: nil, pattern: nil) click to toggle source
# File lib/language_server/protocol/interface/document_filter.rb, line 5
def initialize(language: nil, scheme: nil, pattern: nil)
  @attributes = {}

  @attributes[:language] = language if language
  @attributes[:scheme] = scheme if scheme
  @attributes[:pattern] = pattern if pattern

  @attributes.freeze
end

Public Instance Methods

language() click to toggle source

A language id, like `typescript`.

@return [string]

# File lib/language_server/protocol/interface/document_filter.rb, line 19
def language
  attributes.fetch(:language)
end
pattern() click to toggle source

A glob pattern, like `*.{ts,js}`.

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.` to match on `example.0`, `example.1`, …)

  • `[!…]` to negate a range of characters to match in a path segment

(e.g., `example.` to match on `example.a`, `example.b`, but not `example.0`)

@return [string]

# File lib/language_server/protocol/interface/document_filter.rb, line 47
def pattern
  attributes.fetch(:pattern)
end
scheme() click to toggle source

A Uri [scheme](#Uri.scheme), like `file` or `untitled`.

@return [string]

# File lib/language_server/protocol/interface/document_filter.rb, line 27
def scheme
  attributes.fetch(:scheme)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/document_filter.rb, line 53
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/document_filter.rb, line 57
def to_json(*args)
  to_hash.to_json(*args)
end