Class: LanguageServer::Protocol::Interface::DocumentFilter
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::DocumentFilter
- Defined in:
- lib/language_server/protocol/interface/document_filter.rb,
sig/language_server/protocol/interface/document_filter.rbs
Overview
A document filter describes a top level text document or a notebook cell document.
Instance Attribute Summary collapse
- #attributes ⇒ Hash[Symbol, untyped] readonly
Instance Method Summary collapse
-
#initialize(language: nil, scheme: nil, pattern: nil, notebook: nil) ⇒ DocumentFilter
constructor
A new instance of DocumentFilter.
-
#language ⇒ string
A language id, like
typescript. -
#notebook ⇒ string | NotebookDocumentFilter
A filter that matches against the notebook containing the notebook cell.
-
#pattern ⇒ string
A glob pattern, like
*.{ts,js}. -
#scheme ⇒ string
A Uri Uri.scheme scheme, like
fileoruntitled. - #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(language: nil, scheme: nil, pattern: nil, notebook: nil) ⇒ DocumentFilter
Returns a new instance of DocumentFilter.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 11 def initialize(language: nil, scheme: nil, pattern: nil, notebook: nil) @attributes = {} @attributes[:language] = language if language @attributes[:scheme] = scheme if scheme @attributes[:pattern] = pattern if pattern @attributes[:notebook] = notebook if notebook @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
64 65 66 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 64 def attributes @attributes end |
Instance Method Details
#language ⇒ string
A language id, like typescript.
--- OR ---
A language id like python.
Will be matched against the language id of the notebook cell document. '*' matches every language.
33 34 35 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 33 def language attributes.fetch(:language) end |
#notebook ⇒ string | NotebookDocumentFilter
A filter that matches against the notebook containing the notebook cell. If a string value is provided it matches against the notebook type. '*' matches every notebook.
60 61 62 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 60 def notebook attributes.fetch(:notebook) end |
#pattern ⇒ string
A glob pattern, like *.{ts,js}.
49 50 51 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 49 def pattern attributes.fetch(:pattern) end |
#scheme ⇒ string
A Uri Uri.scheme scheme, like file or untitled.
41 42 43 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 41 def scheme attributes.fetch(:scheme) end |
#to_hash ⇒ Hash[Symbol, untyped]
66 67 68 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 66 def to_hash attributes end |
#to_json(*args) ⇒ String
70 71 72 |
# File 'lib/language_server/protocol/interface/document_filter.rb', line 70 def to_json(*args) to_hash.to_json(*args) end |