Class: Canopus::Plugins::LocalRuntime

Inherits:
Object
  • Object
show all
Defined in:
lib/canopus/plugins/local_runtime.rb

Instance Method Summary collapse

Constructor Details

#initialize(workspace, source, path, permissions) ⇒ LocalRuntime

Returns a new instance of LocalRuntime.



6
7
8
9
# File 'lib/canopus/plugins/local_runtime.rb', line 6

def initialize(workspace, source, path, permissions)
  @workspace, @plugin_id, @api = workspace, path, Canopus::Plugins::API.new(workspace, permissions)
  instance_eval(source, path, 1)
end

Instance Method Details

#close ⇒ Object



23
# File 'lib/canopus/plugins/local_runtime.rb', line 23

def close; end

#configure_lsp(language, command) ⇒ Object



19
20
21
22
# File 'lib/canopus/plugins/local_runtime.rb', line 19

def configure_lsp(language, command)
  @api.permit!("process")
  @workspace.configure_plugin_language_server(@plugin_id, language, command)
end

#register_action(name, description: name, &block) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/canopus/plugins/local_runtime.rb', line 10

def register_action(name, description: name, &block)
  raise ArgumentError, "action callback required" unless block
  @workspace.register_action(name, description: description) { block.call(@api) }
end

#register_language(name, **options) ⇒ Object



18
# File 'lib/canopus/plugins/local_runtime.rb', line 18

def register_language(name, **options) = @workspace.register_language(name, **options)

#register_panel(name, side: :right, &block) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
# File 'lib/canopus/plugins/local_runtime.rb', line 14

def register_panel(name, side: :right, &block)
  raise ArgumentError, "panel callback required" unless block
  @workspace.register_panel(name, side: side) { block.call(@api) }
end