Class: LanguageServer::Protocol::Interface::FileOperationPattern
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::FileOperationPattern
- Defined in:
- lib/language_server/protocol/interface/file_operation_pattern.rb
Overview
A pattern to describe in which file operation requests or notifications the server is interested in receiving.
Instance Attribute Summary collapse
- #attributes ⇒ Object readonly
Instance Method Summary collapse
-
#glob ⇒ string
The glob pattern to match.
-
#initialize(glob:, matches: nil, options: nil) ⇒ FileOperationPattern
constructor
A new instance of FileOperationPattern.
-
#matches ⇒ FileOperationPatternKind | nil
Whether to match files or folders with this pattern.
-
#options ⇒ FileOperationPatternOptions | nil
Additional options used during matching.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(glob:, matches: nil, options: nil) ⇒ FileOperationPattern
Returns a new instance of FileOperationPattern.
11 12 13 14 15 16 17 18 19 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 11 def initialize(glob:, matches: nil, options: nil) @attributes = {} @attributes[:glob] = glob @attributes[:matches] = matches if matches @attributes[:options] = if @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
53 54 55 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 53 def attributes @attributes end |
Instance Method Details
#glob ⇒ string
The glob pattern to match. 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)
31 32 33 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 31 def glob attributes.fetch(:glob) end |
#matches ⇒ FileOperationPatternKind | nil
Whether to match files or folders with this pattern.
Matches both if undefined.
41 42 43 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 41 def matches attributes.fetch(:matches) end |
#options ⇒ FileOperationPatternOptions | nil
Additional options used during matching.
49 50 51 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 49 def attributes.fetch(:options) end |
#to_hash ⇒ Object
55 56 57 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 55 def to_hash attributes end |
#to_json(*args) ⇒ Object
59 60 61 |
# File 'lib/language_server/protocol/interface/file_operation_pattern.rb', line 59 def to_json(*args) to_hash.to_json(*args) end |