Class: LanguageServer::Protocol::Interface::FileOperationOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/file_operation_options.rb,
sig/language_server/protocol/interface/file_operation_options.rbs

Overview

Options for notifications/requests for user operations on files.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(did_create: nil, will_create: nil, did_rename: nil, will_rename: nil, did_delete: nil, will_delete: nil) ⇒ FileOperationOptions

Returns a new instance of FileOperationOptions.

Parameters:

  • did_create: (Object) (defaults to: nil)
  • will_create: (Object) (defaults to: nil)
  • did_rename: (Object) (defaults to: nil)
  • will_rename: (Object) (defaults to: nil)
  • did_delete: (Object) (defaults to: nil)
  • will_delete: (Object) (defaults to: nil)

Since:

  • 3.16.0



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 10

def initialize(did_create: nil, will_create: nil, did_rename: nil, will_rename: nil, did_delete: nil, will_delete: nil)
  @attributes = {}

  @attributes[:didCreate] = did_create if did_create
  @attributes[:willCreate] = will_create if will_create
  @attributes[:didRename] = did_rename if did_rename
  @attributes[:willRename] = will_rename if will_rename
  @attributes[:didDelete] = did_delete if did_delete
  @attributes[:willDelete] = will_delete if will_delete

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.16.0



71
72
73
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 71

def attributes
  @attributes
end

Instance Method Details

#did_createFileOperationRegistrationOptions

The server is interested in receiving didCreateFiles notifications.

Returns:

Since:

  • 3.16.0



27
28
29
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 27

def did_create
  attributes.fetch(:didCreate)
end

#did_deleteFileOperationRegistrationOptions

The server is interested in receiving didDeleteFiles file notifications.

Returns:

Since:

  • 3.16.0



59
60
61
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 59

def did_delete
  attributes.fetch(:didDelete)
end

#did_renameFileOperationRegistrationOptions

The server is interested in receiving didRenameFiles notifications.

Returns:

Since:

  • 3.16.0



43
44
45
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 43

def did_rename
  attributes.fetch(:didRename)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.16.0



73
74
75
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 73

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

Since:

  • 3.16.0



77
78
79
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 77

def to_json(*args)
  to_hash.to_json(*args)
end

#will_createFileOperationRegistrationOptions

The server is interested in receiving willCreateFiles requests.

Returns:

Since:

  • 3.16.0



35
36
37
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 35

def will_create
  attributes.fetch(:willCreate)
end

#will_deleteFileOperationRegistrationOptions

The server is interested in receiving willDeleteFiles file requests.

Returns:

Since:

  • 3.16.0



67
68
69
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 67

def will_delete
  attributes.fetch(:willDelete)
end

#will_renameFileOperationRegistrationOptions

The server is interested in receiving willRenameFiles requests.

Returns:

Since:

  • 3.16.0



51
52
53
# File 'lib/language_server/protocol/interface/file_operation_options.rb', line 51

def will_rename
  attributes.fetch(:willRename)
end