Class: Solargraph::LiveMap
- Inherits:
-
Object
- Object
- Solargraph::LiveMap
- Defined in:
- lib/solargraph/live_map.rb,
lib/solargraph/live_map/cache.rb
Overview
The LiveMap allows extensions to add their own completion suggestions.
Defined Under Namespace
Classes: Cache
Constant Summary collapse
- @@plugins =
[]
Instance Attribute Summary collapse
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Class Method Summary collapse
Instance Method Summary collapse
- #get_instance_methods(namespace, root = '', with_private = false) ⇒ Object
- #get_methods(namespace, root = '', with_private = false) ⇒ Object
-
#initialize(workspace) ⇒ LiveMap
constructor
A new instance of LiveMap.
- #reload ⇒ Object
- #restart ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(workspace) ⇒ LiveMap
Returns a new instance of LiveMap.
9 10 11 12 13 |
# File 'lib/solargraph/live_map.rb', line 9 def initialize workspace @workspace = workspace @runners = [] at_exit { stop } end |
Instance Attribute Details
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace.
7 8 9 |
# File 'lib/solargraph/live_map.rb', line 7 def workspace @workspace end |
Class Method Details
.install(cls) ⇒ Object
61 62 63 |
# File 'lib/solargraph/live_map.rb', line 61 def self.install cls @@plugins.push cls end |
Instance Method Details
#get_instance_methods(namespace, root = '', with_private = false) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/solargraph/live_map.rb', line 41 def get_instance_methods(namespace, root = '', with_private = false) result = [] @runners.each do |p| resp = p.get_methods(namespace: namespace, root: root, scope: 'instance', with_private: with_private) STDERR.puts resp. unless resp.ok? result.concat(resp.data) end result end |
#get_methods(namespace, root = '', with_private = false) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/solargraph/live_map.rb', line 51 def get_methods(namespace, root = '', with_private = false) result = [] @runners.each do |p| resp = p.get_methods(namespace: namespace, root: root, scope: 'class', with_private: with_private) STDERR.puts resp. unless resp.ok? result.concat(resp.data) end result end |
#reload ⇒ Object
25 26 27 |
# File 'lib/solargraph/live_map.rb', line 25 def reload restart end |
#restart ⇒ Object
29 30 31 32 |
# File 'lib/solargraph/live_map.rb', line 29 def restart stop start end |
#start ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/solargraph/live_map.rb', line 15 def start unless workspace.nil? @@plugins.each do |p| r = p.new(workspace) r.start @runners.push r end end end |
#stop ⇒ Object
34 35 36 37 38 39 |
# File 'lib/solargraph/live_map.rb', line 34 def stop @runners.each do |p| p.stop end @runners.clear end |