Class: LanguageServer::Protocol::Interface::DocumentFilter
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::DocumentFilter
- Defined in:
- lib/language_server/protocol/interface/document_filter.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(language: nil, scheme: nil, pattern: nil) ⇒ DocumentFilter
constructor
A new instance of DocumentFilter.
-
#language ⇒ string
A language id, like ‘typescript`.
-
#pattern ⇒ string
A glob pattern, like ‘*.ts,js`.
-
#scheme ⇒ string
A Uri [scheme](#Uri.scheme), like ‘file` or `untitled`.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(language: nil, scheme: nil, pattern: nil) ⇒ DocumentFilter
Returns a new instance of DocumentFilter.
5 6 7 8 9 10 11 12 13 |
# 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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
51 52 53 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 51 def attributes @attributes end |
Instance Method Details
#language ⇒ string
A language id, like ‘typescript`.
19 20 21 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 19 def language attributes.fetch(:language) end |
#pattern ⇒ string
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`)
47 48 49 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 47 def pattern attributes.fetch(:pattern) end |
#scheme ⇒ string
A Uri [scheme](#Uri.scheme), like ‘file` or `untitled`.
27 28 29 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 27 def scheme attributes.fetch(:scheme) end |
#to_hash ⇒ Object
53 54 55 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 53 def to_hash attributes end |
#to_json(*args) ⇒ Object
57 58 59 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 57 def to_json(*args) to_hash.to_json(*args) end |