Class: Mui::Lsp::Handlers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/mui/lsp/handlers/base.rb

Overview

Base class for LSP response handlers

Direct Known Subclasses

Completion, Definition, Hover, References

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(editor:, client:) ⇒ Base



10
11
12
13
# File 'lib/mui/lsp/handlers/base.rb', line 10

def initialize(editor:, client:)
  @editor = editor
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/mui/lsp/handlers/base.rb', line 8

def client
  @client
end

#editorObject (readonly)

Returns the value of attribute editor.



8
9
10
# File 'lib/mui/lsp/handlers/base.rb', line 8

def editor
  @editor
end

Instance Method Details

#handle(result, error) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/mui/lsp/handlers/base.rb', line 15

def handle(result, error)
  if error
    handle_error(error)
  elsif result
    handle_result(result)
  else
    handle_empty
  end
end