solargraph 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solargraph.rb +2 -3
  3. data/lib/solargraph/api_map.rb +6 -6
  4. data/lib/solargraph/api_map/source_to_yard.rb +1 -1
  5. data/lib/solargraph/language_server/host.rb +69 -10
  6. data/lib/solargraph/language_server/message.rb +1 -2
  7. data/lib/solargraph/language_server/message/initialize.rb +83 -15
  8. data/lib/solargraph/language_server/message/initialized.rb +7 -0
  9. data/lib/solargraph/language_server/message/text_document/formatting.rb +4 -1
  10. data/lib/solargraph/language_server/message/text_document/on_type_formatting.rb +20 -19
  11. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +19 -1
  12. data/lib/solargraph/language_server/request.rb +1 -1
  13. data/lib/solargraph/language_server/transport.rb +1 -0
  14. data/lib/solargraph/language_server/transport/data_reader.rb +66 -0
  15. data/lib/solargraph/language_server/transport/socket.rb +8 -32
  16. data/lib/solargraph/library.rb +11 -6
  17. data/lib/solargraph/page.rb +1 -1
  18. data/lib/solargraph/pin/base.rb +8 -7
  19. data/lib/solargraph/pin/method_parameter.rb +2 -15
  20. data/lib/solargraph/pin/yard_object.rb +1 -1
  21. data/lib/solargraph/plugin/runtime.rb +0 -2
  22. data/lib/solargraph/shell.rb +0 -24
  23. data/lib/solargraph/source.rb +5 -169
  24. data/lib/solargraph/source/mapper.rb +8 -3
  25. data/lib/solargraph/version.rb +1 -1
  26. data/lib/solargraph/workspace.rb +3 -3
  27. data/lib/solargraph/workspace/config.rb +7 -9
  28. data/lib/solargraph/yard_map.rb +9 -48
  29. metadata +17 -74
  30. data/lib/solargraph/server.rb +0 -212
  31. data/lib/solargraph/suggestion.rb +0 -178
@@ -249,9 +249,14 @@ module Solargraph
249
249
  end
250
250
  else
251
251
  c.children.each do |u|
252
- here = get_node_start_position(c)
253
- blk = get_block_pin(here)
254
- @locals.push Solargraph::Pin::MethodParameter.new(get_node_location(u), fqn || '', "#{u.children[0]}", docstring_for(c), blk)
252
+ # here = get_node_start_position(c)
253
+ # blk = get_block_pin(here)
254
+ # @locals.push Solargraph::Pin::MethodParameter.new(get_node_location(u), fqn || '', "#{u.children[0]}", docstring_for(c), blk)
255
+ here = get_node_start_position(u)
256
+ context = get_named_path_pin(here)
257
+ block = get_block_pin(here)
258
+ presence = Source::Range.new(here, block.location.range.ending)
259
+ @locals.push Solargraph::Pin::MethodParameter.new(get_node_location(u), fqn, u.children[0].to_s, docstring_for(c), resolve_node_signature(u.children[1]), infer_literal_node_type(u.children[1]), context, block, presence)
255
260
  end
256
261
  end
257
262
  elsif c.type == :block
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.20.0'
2
+ VERSION = '0.21.0'
3
3
  end
@@ -121,10 +121,10 @@ module Solargraph
121
121
  source_hash.clear
122
122
  unless directory.nil?
123
123
  size = config.calculated.length
124
- raise WorkspaceTooLargeError.new(size) if size > MAX_WORKSPACE_SIZE
124
+ raise WorkspaceTooLargeError.new(size) if config.max_files > 0 and size > config.max_files
125
+
125
126
  config.calculated.each do |filename|
126
- src = Solargraph::Source.load(filename)
127
- source_hash[filename] = src
127
+ source_hash[filename] = Solargraph::Source.load(filename)
128
128
  end
129
129
  end
130
130
  @stime = Time.now
@@ -13,7 +13,7 @@ module Solargraph
13
13
  def initialize workspace = nil
14
14
  @workspace = workspace
15
15
  include_globs = ['**/*.rb']
16
- exclude_globs = ['spec/**/*', 'test/**/*']
16
+ exclude_globs = ['spec/**/*', 'test/**/*', 'vendor/**/*']
17
17
  unless @workspace.nil?
18
18
  sfile = File.join(@workspace, '.solargraph.yml')
19
19
  if File.file?(sfile)
@@ -26,10 +26,11 @@ module Solargraph
26
26
  @raw_data ||= {}
27
27
  @raw_data['include'] ||= include_globs
28
28
  @raw_data['exclude'] ||= exclude_globs
29
- @raw_data['reporters'] ||= []
29
+ @raw_data['require'] ||= []
30
30
  @raw_data['domains'] ||= []
31
- @raw_data['required'] ||= []
31
+ @raw_data['reporters'] ||= %w[rubocop require_not_found]
32
32
  @raw_data['plugins'] ||= []
33
+ @raw_data['max_files'] ||= Workspace::MAX_WORKSPACE_SIZE
33
34
  included
34
35
  excluded
35
36
  end
@@ -63,7 +64,7 @@ module Solargraph
63
64
  end
64
65
 
65
66
  def required
66
- raw_data['required']
67
+ raw_data['require']
67
68
  end
68
69
 
69
70
  def plugins
@@ -74,8 +75,8 @@ module Solargraph
74
75
  raw_data['reporters']
75
76
  end
76
77
 
77
- def require_paths
78
- @require_paths ||= generate_require_paths
78
+ def max_files
79
+ raw_data['max_files']
79
80
  end
80
81
 
81
82
  private
@@ -110,9 +111,6 @@ module Solargraph
110
111
  def glob_to_directory glob
111
112
  glob.gsub(/(\/\*|\/\*\*\/\*\*?)$/, '')
112
113
  end
113
-
114
- def generate_require_paths
115
- end
116
114
  end
117
115
  end
118
116
  end
@@ -1,5 +1,4 @@
1
1
  require 'yard'
2
- require 'bundler'
3
2
 
4
3
  module Solargraph
5
4
  class YardMap
@@ -26,7 +25,7 @@ module Solargraph
26
25
  @required = required.clone
27
26
  @namespace_yardocs = {}
28
27
  @gem_paths = {}
29
- process_gem_paths
28
+ process_requires
30
29
  yardocs.push CoreDocs.yardoc_file
31
30
  yardocs.uniq!
32
31
  yardocs.delete_if{ |y| y.start_with? workspace.directory } unless workspace.nil? or workspace.directory.nil?
@@ -92,7 +91,7 @@ module Solargraph
92
91
  found
93
92
  end
94
93
 
95
- # @return [Array<Suggestion>]
94
+ # @return [Array<Solargraph::Pin::Base>]
96
95
  def get_constants namespace , scope = ''
97
96
  cached = cache.get_constants(namespace, scope)
98
97
  return cached unless cached.nil?
@@ -113,26 +112,22 @@ module Solargraph
113
112
  return_type = nil
114
113
  if c.kind_of?(YARD::CodeObjects::ClassObject)
115
114
  detail = 'Class'
116
- kind = Suggestion::CLASS
117
115
  return_type = "Class<#{c.to_s}>"
118
116
  elsif c.kind_of?(YARD::CodeObjects::ModuleObject)
119
117
  detail = 'Module'
120
- kind = Suggestion::MODULE
121
118
  return_type = "Module<#{c.to_s}>"
122
119
  elsif c.kind_of?(YARD::CodeObjects::ConstantObject)
123
120
  detail = 'Constant'
124
- kind = Suggestion::CONSTANT
125
121
  else
126
122
  next
127
123
  end
128
- # result.push Suggestion.new(c.to_s.split('::').last, detail: c.to_s, kind: kind, docstring: c.docstring, return_type: return_type, location: object_location(c))
129
124
  result.push Pin::YardObject.new(c, object_location(c))
130
125
  }
131
126
  cache.set_constants(namespace, scope, result)
132
127
  result
133
128
  end
134
129
 
135
- # @return [Array<Suggestion>]
130
+ # @return [Array<Solargraph::Pin::Base>]
136
131
  def get_methods namespace, scope = '', visibility: [:public]
137
132
  return [] if namespace == '' and scope == ''
138
133
  cached = cache.get_methods(namespace, scope, visibility)
@@ -160,7 +155,7 @@ module Solargraph
160
155
  meths
161
156
  end
162
157
 
163
- # @return [Array<Suggestion>]
158
+ # @return [Array<Solargraph::Pin::Base>]
164
159
  def get_instance_methods namespace, scope = '', visibility: [:public]
165
160
  return [] if namespace == '' and scope == ''
166
161
  cached = cache.get_instance_methods(namespace, scope, visibility)
@@ -173,14 +168,14 @@ module Solargraph
173
168
  ns = nil
174
169
  ns = find_first_resolved_object(yard, namespace, scope)
175
170
  unless ns.nil?
176
- ns.meths(scope: :instance, visibility: visibility).each { |m|
171
+ ns.meths(scope: :instance, visibility: visibility).each do |m|
177
172
  n = m.to_s.split(/[\.#]/).last
178
173
  # HACK: Special treatment for #initialize
179
174
  next if n == 'initialize' and !visibility.include?(:private)
180
175
  if (namespace == 'Kernel' or !m.to_s.start_with?('Kernel#')) and !m.docstring.to_s.include?(':nodoc:')
181
176
  meths.push Pin::YardObject.new(m, object_location(m))
182
177
  end
183
- }
178
+ end
184
179
  if ns.kind_of?(YARD::CodeObjects::ClassObject) and namespace != 'Object'
185
180
  unless ns.nil?
186
181
  meths += get_instance_methods(ns.superclass.to_s)
@@ -267,52 +262,22 @@ module Solargraph
267
262
  get_constants '', ''
268
263
  end
269
264
 
270
- def process_gem_paths
271
- if !has_bundle? or workspace.nil? or ENV['BUNDLE_GEMFILE'] == File.join(workspace.directory, 'Gemfile')
272
- # Trust the current environment if Bundler is not being used or the
273
- # workspace's Gemfile was loaded
274
- process_requires
275
- else
276
- # Temporarily load the workspace in a clean environment to identify
277
- # its gems
278
- processed = false
279
- Bundler.with_clean_env do
280
- Bundler.environment.chdir(workspace.directory) do
281
- begin
282
- Bundler.reset!
283
- process_requires
284
- processed = true
285
- rescue Exception => e
286
- STDERR.puts "#{e.class}: #{e.message}"
287
- end
288
- end
289
- end
290
- Bundler.reset!
291
- process_requires unless processed
292
- end
293
- end
294
-
295
265
  def process_requires
296
266
  tried = []
297
267
  unresolved_requires.clear
298
268
  required.each do |r|
299
- next if !workspace.nil? and workspace.would_require?(r)
300
269
  begin
301
- name = r.split('/').first
302
- next if name.nil?
303
- spec = Gem::Specification.find_by_name(name)
304
- if spec.nil?
305
- unresolved_requires.push r
306
- next
307
- end
270
+ spec = Gem::Specification.find_by_path(r) || Gem::Specification.find_by_name(r.split('/').first)
308
271
  ver = spec.version.to_s
309
272
  ver = ">= 0" if ver.empty?
310
273
  add_gem_dependencies spec
274
+ next if !workspace.nil? and workspace.would_require?(r)
311
275
  yd = YARD::Registry.yardoc_file_for_gem(spec.name, ver)
312
276
  @gem_paths[spec.name] = spec.full_gem_path
313
277
  unresolved_requires.push r if yd.nil?
314
278
  yardocs.unshift yd unless yd.nil? or yardocs.include?(yd)
315
279
  rescue Gem::LoadError => e
280
+ next if !workspace.nil? and workspace.would_require?(r)
316
281
  unresolved_requires.push r
317
282
  end
318
283
  end
@@ -364,9 +329,5 @@ module Solargraph
364
329
  end
365
330
  nil
366
331
  end
367
-
368
- def has_bundle?
369
- !workspace.nil? and !workspace.directory.nil? and File.exist?(File.join workspace.directory, 'Gemfile')
370
- end
371
332
  end
372
333
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -44,20 +44,6 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.19.4
47
- - !ruby/object:Gem::Dependency
48
- name: sinatra
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '2'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '2'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: yard
63
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,20 +58,6 @@ dependencies:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
60
  version: '0.9'
75
- - !ruby/object:Gem::Dependency
76
- name: bundler
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1.14'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '1.14'
89
61
  - !ruby/object:Gem::Dependency
90
62
  name: eventmachine
91
63
  requirement: !ruby/object:Gem::Requirement
@@ -189,39 +161,39 @@ dependencies:
189
161
  - !ruby/object:Gem::Version
190
162
  version: '0.52'
191
163
  - !ruby/object:Gem::Dependency
192
- name: rspec
164
+ name: tilt
193
165
  requirement: !ruby/object:Gem::Requirement
194
166
  requirements:
195
167
  - - "~>"
196
168
  - !ruby/object:Gem::Version
197
- version: '3.5'
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: 3.5.0
201
- type: :development
169
+ version: '2.0'
170
+ type: :runtime
202
171
  prerelease: false
203
172
  version_requirements: !ruby/object:Gem::Requirement
204
173
  requirements:
205
174
  - - "~>"
206
175
  - !ruby/object:Gem::Version
207
- version: '3.5'
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- version: 3.5.0
176
+ version: '2.0'
211
177
  - !ruby/object:Gem::Dependency
212
- name: rack-test
178
+ name: rspec
213
179
  requirement: !ruby/object:Gem::Requirement
214
180
  requirements:
215
181
  - - "~>"
216
182
  - !ruby/object:Gem::Version
217
- version: '0.7'
183
+ version: '3.5'
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 3.5.0
218
187
  type: :development
219
188
  prerelease: false
220
189
  version_requirements: !ruby/object:Gem::Requirement
221
190
  requirements:
222
191
  - - "~>"
223
192
  - !ruby/object:Gem::Version
224
- version: '0.7'
193
+ version: '3.5'
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: 3.5.0
225
197
  - !ruby/object:Gem::Dependency
226
198
  name: simplecov
227
199
  requirement: !ruby/object:Gem::Requirement
@@ -236,34 +208,6 @@ dependencies:
236
208
  - - "~>"
237
209
  - !ruby/object:Gem::Version
238
210
  version: '0.14'
239
- - !ruby/object:Gem::Dependency
240
- name: debase
241
- requirement: !ruby/object:Gem::Requirement
242
- requirements:
243
- - - "~>"
244
- - !ruby/object:Gem::Version
245
- version: '0.2'
246
- type: :development
247
- prerelease: false
248
- version_requirements: !ruby/object:Gem::Requirement
249
- requirements:
250
- - - "~>"
251
- - !ruby/object:Gem::Version
252
- version: '0.2'
253
- - !ruby/object:Gem::Dependency
254
- name: ruby-debug-ide
255
- requirement: !ruby/object:Gem::Requirement
256
- requirements:
257
- - - "~>"
258
- - !ruby/object:Gem::Version
259
- version: '0.6'
260
- type: :development
261
- prerelease: false
262
- version_requirements: !ruby/object:Gem::Requirement
263
- requirements:
264
- - - "~>"
265
- - !ruby/object:Gem::Version
266
- version: '0.6'
267
211
  description: IDE tools for code completion and inline documentation
268
212
  email: admin@castwide.com
269
213
  executables:
@@ -331,6 +275,7 @@ files:
331
275
  - lib/solargraph/language_server/request.rb
332
276
  - lib/solargraph/language_server/symbol_kinds.rb
333
277
  - lib/solargraph/language_server/transport.rb
278
+ - lib/solargraph/language_server/transport/data_reader.rb
334
279
  - lib/solargraph/language_server/transport/socket.rb
335
280
  - lib/solargraph/language_server/uri_helpers.rb
336
281
  - lib/solargraph/library.rb
@@ -366,7 +311,6 @@ files:
366
311
  - lib/solargraph/plugin/canceler.rb
367
312
  - lib/solargraph/plugin/process.rb
368
313
  - lib/solargraph/plugin/runtime.rb
369
- - lib/solargraph/server.rb
370
314
  - lib/solargraph/server_methods.rb
371
315
  - lib/solargraph/shell.rb
372
316
  - lib/solargraph/source.rb
@@ -378,7 +322,6 @@ files:
378
322
  - lib/solargraph/source/position.rb
379
323
  - lib/solargraph/source/range.rb
380
324
  - lib/solargraph/source/updater.rb
381
- - lib/solargraph/suggestion.rb
382
325
  - lib/solargraph/version.rb
383
326
  - lib/solargraph/views/_method.erb
384
327
  - lib/solargraph/views/_name_type_tag.erb
@@ -405,7 +348,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
405
348
  requirements:
406
349
  - - ">="
407
350
  - !ruby/object:Gem::Version
408
- version: 2.2.2
351
+ version: '2.1'
409
352
  required_rubygems_version: !ruby/object:Gem::Requirement
410
353
  requirements:
411
354
  - - ">="
@@ -1,212 +0,0 @@
1
- require 'sinatra/base'
2
- require 'thread'
3
- require 'yard'
4
- require 'open3'
5
- require 'shellwords'
6
-
7
- module Solargraph
8
- class Server < Sinatra::Base
9
-
10
- set :port, 7657
11
- set :server, :webrick
12
-
13
- # @@api_hash = {}
14
- @@semaphore = Mutex.new
15
-
16
- @@library = Solargraph::Library.new
17
-
18
- after do
19
- GC.start
20
- end
21
-
22
- def self.wait
23
- @@semaphore.lock
24
- @@semaphore.unlock
25
- end
26
-
27
- post '/diagnostics' do
28
- content_type :json
29
- severities = {
30
- 'refactor' => 4,
31
- 'convention' => 3,
32
- 'warning' => 2,
33
- 'error' => 1,
34
- 'fatal' => 1
35
- }
36
- begin
37
- filename = params['filename']
38
- text = params['text']
39
- o, e, s = Open3.capture3("bundle exec rubocop -f j -s #{Shellwords.escape(filename)}", stdin_data: text)
40
- STDERR.puts e unless e.nil? or e.empty?
41
- resp = JSON.parse(o)
42
- diagnostics = []
43
- if resp['summary']['offense_count'] > 0
44
- resp['files'].each do |file|
45
- file['offenses'].each do |off|
46
- diag = {
47
- range: {
48
- start: {
49
- line: off['location']['start_line'] - 1,
50
- character: off['location']['start_column'] - 1
51
- },
52
- end: {
53
- line: off['location']['last_line'] - 1,
54
- character: off['location']['last_column']
55
- }
56
- },
57
- # 1 = Error, 2 = Warning, 3 = Information, 4 = Hint
58
- severity: severities[off['severity']],
59
- source: off['cop_name'],
60
- message: off['message'].gsub(/^#{off['cop_name']}\:/, '')
61
- }
62
- diagnostics.push diag
63
- end
64
- end
65
- end
66
- { "status" => "ok", "data" => diagnostics }.to_json
67
- rescue Exception => e
68
- send_exception e
69
- end
70
- end
71
-
72
- post '/prepare' do
73
- content_type :json
74
- begin
75
- workspace = params['workspace'].to_s.gsub(/\\/, '/')
76
- STDERR.puts "Preparing #{workspace}"
77
- @@library = Solargraph::Library.load(workspace) unless workspace.empty?
78
- { "status" => "ok"}.to_json
79
- rescue Exception => e
80
- send_exception e
81
- end
82
- end
83
-
84
- post '/update' do
85
- content_type :json
86
- begin
87
- filename = params['filename'].to_s.gsub(/\\/, '/')
88
- @@library.open filename, File.read(filename), 0
89
- { "status" => "ok"}.to_json
90
- rescue Exception => e
91
- send_exception e
92
- end
93
- end
94
-
95
- post '/suggest' do
96
- content_type :json
97
- begin
98
- filename = params['filename'].to_s.gsub(/\\/, '/')
99
- @@library.open filename, params['text'], 0
100
- @@library.checkout filename
101
- @@library.refresh
102
- with_all = params['all'] == '1' ? true : false
103
- completion = @@library.completions_at(filename, params['line'].to_i, params['column'].to_i)
104
- JSON.generate({ "status" => "ok", "suggestions" => completion.pins.map{|s| Suggestion.pull(s).as_json(all: with_all)} })
105
- rescue Exception => e
106
- send_exception e
107
- end
108
- end
109
-
110
- post '/signify' do
111
- content_type :json
112
- begin
113
- filename = params['filename'].to_s.gsub(/\\/, '/')
114
- @@library.open filename, params['text'], 0
115
- @@library.checkout filename
116
- @@library.refresh
117
- sugg = @@library.signatures_at(filename, params['line'].to_i, params['column'].to_i)
118
- { "status" => "ok", "suggestions" => sugg.map{|s| Suggestion.pull(s).as_json(all: true)} }.to_json
119
- rescue Exception => e
120
- send_exception e
121
- end
122
- end
123
-
124
- post '/resolve' do
125
- content_type :json
126
- begin
127
- result = @@library.get_path_pins(params['path'])
128
- { "status" => "ok", "suggestions" => result.map{|s| Suggestion.pull(s).as_json(all: true)} }.to_json
129
- rescue Exception => e
130
- send_exception e
131
- end
132
- end
133
-
134
- post '/define' do
135
- content_type :json
136
- begin
137
- filename = params['filename'].to_s.gsub(/\\/, '/')
138
- @@library.open filename, params['text'], 0
139
- @@library.checkout filename
140
- sugg = @@library.definitions_at(filename, params['line'].to_i, params['column'].to_i)
141
- { "status" => "ok", "suggestions" => sugg.map{|s| Suggestion.pull(s).as_json(all: true)} }.to_json
142
- rescue Exception => e
143
- send_exception e
144
- end
145
- end
146
-
147
- # @deprecated Use /define instead.
148
- post '/hover' do
149
- content_type :json
150
- begin
151
- filename = params['filename'].to_s.gsub(/\\/, '/')
152
- @@library.open filename, params['text'], 0
153
- @@library.refresh
154
- @@library.checkout filename
155
- sugg = @@library.definitions_at(filename, params['line'].to_i, params['column'].to_i)
156
- { "status" => "ok", "suggestions" => sugg.map{|s| Suggestion.pull(s).as_json(all: true)} }.to_json
157
- rescue Exception => e
158
- send_exception e
159
- end
160
- end
161
-
162
- get '/search' do
163
- @results = @@library.search(params['query'])
164
- erb :search, locals: { query: params['query'], results: @results }
165
- end
166
-
167
- get '/document' do
168
- @objects = @@library.document(params['query'])
169
- erb :document, locals: { objects: @objects }
170
- end
171
-
172
- def htmlify text
173
- rdoc_to_html text
174
- end
175
-
176
- def rdoc_to_html text
177
- h = Helpers.new
178
- h.html_markup_rdoc(text)
179
- end
180
-
181
- def ruby_to_html code
182
- h = Helpers.new
183
- h.html_markup_ruby(code)
184
- end
185
-
186
- def send_exception e
187
- STDERR.puts e
188
- STDERR.puts e.backtrace.join("\n")
189
- { "status" => "err", "message" => e.message + "\n" + e.backtrace.join("\n") }.to_json
190
- end
191
-
192
- class Helpers
193
- include YARD::Templates::Helpers::HtmlHelper
194
-
195
- attr_accessor :object
196
- attr_accessor :serializer
197
-
198
- def url_for(object)
199
- '.'
200
- end
201
-
202
- def options
203
- @options ||= YARD::Templates::TemplateOptions.new
204
- end
205
-
206
- # HACK: The linkify method just returns the arguments as plain text
207
- def linkify *args
208
- args.join(', ')
209
- end
210
- end
211
- end
212
- end