Class: LanguageServer::Protocol::Interface::TextDocumentFilter
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::TextDocumentFilter
- Defined in:
- lib/language_server/protocol/interface/text_document_filter.rb
Overview
A document filter denotes a document by different properties like the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).
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 onexample.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 notexample.0)
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(language:, scheme: nil, pattern: nil) ⇒ TextDocumentFilter
constructor
A new instance of TextDocumentFilter.
-
#language ⇒ string
A language id, like
typescript. -
#pattern ⇒ string | nil
A glob pattern, like ‘*.ts,js`.
-
#scheme ⇒ string | nil
A Uri [scheme](#Uri.scheme), like
fileoruntitled. - #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(language:, scheme: nil, pattern: nil) ⇒ TextDocumentFilter
Returns a new instance of TextDocumentFilter.
23 24 25 26 27 28 29 30 31 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 23 def initialize(language:, scheme: nil, pattern: nil) @attributes = {} @attributes[:language] = language @attributes[:scheme] = scheme if scheme @attributes[:pattern] = pattern if pattern @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
57 58 59 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 57 def attributes @attributes end |
Instance Method Details
#language ⇒ string
A language id, like typescript. */
37 38 39 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 37 def language attributes.fetch(:language) end |
#pattern ⇒ string | nil
A glob pattern, like ‘*.ts,js`. */
53 54 55 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 53 def pattern attributes.fetch(:pattern) end |
#scheme ⇒ string | nil
A Uri [scheme](#Uri.scheme), like file or untitled. */
45 46 47 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 45 def scheme attributes.fetch(:scheme) end |
#to_hash ⇒ Object
59 60 61 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 59 def to_hash attributes end |
#to_json(*args) ⇒ Object
63 64 65 |
# File 'lib/language_server/protocol/interface/text_document_filter.rb', line 63 def to_json(*args) to_hash.to_json(*args) end |