Class: TypeProf::LSP::Message
- Inherits:
-
Object
- Object
- TypeProf::LSP::Message
show all
- Defined in:
- lib/typeprof/lsp/messages.rb
Direct Known Subclasses
CancelRequest, Exit, Initialize, Initialized, Shutdown, TextDocument::CodeLens, TextDocument::Completion, TextDocument::Definition, TextDocument::DidChange, TextDocument::DidClose, TextDocument::DidOpen, TextDocument::Hover, TextDocument::References, TextDocument::Rename, TextDocument::TypeDefinition, Workspace::ExecuteCommand
Defined Under Namespace
Modules: TextDocument, Workspace
Classes: CancelRequest, Exit, Initialize, Initialized, Shutdown
Constant Summary
collapse
- Classes =
[]
- Table =
Hash.new(Message)
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(server, json) ⇒ Message
Returns a new instance of Message.
3
4
5
6
7
8
|
# File 'lib/typeprof/lsp/messages.rb', line 3
def initialize(server, json)
@server = server
@id = json[:id]
@method = json[:method]
@params = json[:params]
end
|
Class Method Details
.build_table ⇒ Object
37
38
39
40
41
|
# File 'lib/typeprof/lsp/messages.rb', line 37
def self.build_table
Classes.each do |klass|
Table[klass::METHOD] = klass
end
end
|
.find(method) ⇒ Object
43
44
45
|
# File 'lib/typeprof/lsp/messages.rb', line 43
def self.find(method)
Table[method]
end
|
.inherited(klass) ⇒ Object
32
33
34
|
# File 'lib/typeprof/lsp/messages.rb', line 32
def self.inherited(klass)
Classes << klass
end
|
Instance Method Details
#log(msg) ⇒ Object
14
15
|
# File 'lib/typeprof/lsp/messages.rb', line 14
def log(msg)
end
|
#notify(method, **params) ⇒ Object
27
28
29
|
# File 'lib/typeprof/lsp/messages.rb', line 27
def notify(method, **params)
@server.send_notification(method, **params)
end
|
#respond(result) ⇒ Object
17
18
19
20
|
# File 'lib/typeprof/lsp/messages.rb', line 17
def respond(result)
raise "do not respond to notification" if @id == nil
@server.send_response(id: @id, result: result)
end
|
#respond_error(error) ⇒ Object
22
23
24
25
|
# File 'lib/typeprof/lsp/messages.rb', line 22
def respond_error(error)
raise "do not respond to notification" if @id == nil
@server.send_response(id: @id, error: error)
end
|
#run ⇒ Object
10
11
12
|
# File 'lib/typeprof/lsp/messages.rb', line 10
def run
p [:ignored, @method]
end
|