Class: Solargraph::ApiMap
- Inherits:
-
Object
- Object
- Solargraph::ApiMap
- Includes:
- SourceToYard, NodeMethods
- Defined in:
- lib/solargraph/api_map.rb,
lib/solargraph/api_map/cache.rb,
lib/solargraph/api_map/config.rb,
lib/solargraph/api_map/source.rb,
lib/solargraph/api_map/source_to_yard.rb
Defined Under Namespace
Modules: SourceToYard Classes: Cache, Config, Source
Constant Summary collapse
- KEYWORDS =
[ '__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and', 'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else', 'elsif', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next', 'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super', 'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield' ].freeze
- METHODS_RETURNING_SELF =
[ 'clone', 'dup', 'freeze', 'taint', 'untaint' ].freeze
- @@source_cache =
{}
Instance Attribute Summary collapse
-
#workspace ⇒ String
readonly
The root directory of the project.
Class Method Summary collapse
Instance Method Summary collapse
- #append_source(code, filename) ⇒ Solargraph::ApiMap::Source
- #config(reload = false) ⇒ Solargraph::ApiMap::Config
- #document(path) ⇒ Array<YARD::CodeObject::Base>
- #find_fully_qualified_namespace(name, root = '', skip = []) ⇒ String
- #find_namespace_pins(fqns) ⇒ Object
- #get_class_variable_pins(namespace) ⇒ Array<Solargraph::Pin::ClassVariable>
- #get_class_variables(namespace) ⇒ Array<Solargraph::Suggestion>
-
#get_comment_for(node) ⇒ Object
deprecated
Deprecated.
Use get_docstring_for instead.
- #get_constant_pins(namespace, root) ⇒ Array<Solargraph::Pin::Constant>
- #get_constants(namespace, root = '') ⇒ Array<Solargraph::Suggestion>
-
#get_docstring_for(node) ⇒ YARD::Docstring
Get the docstring associated with a node.
- #get_filename_for(node) ⇒ String
- #get_global_variable_pins ⇒ Object
- #get_global_variables ⇒ Array<Solargraph::Suggestion>
- #get_include_strings_from(*nodes) ⇒ Array<String>
-
#get_instance_methods(namespace, root = '', visibility: [:public]) ⇒ Array<Solargraph::Suggestion>
Get an array of instance methods that are available in the specified namespace.
- #get_instance_variable_pins(namespace, scope = :instance) ⇒ Array<Solargraph::Pin::InstanceVariable>
- #get_instance_variables(namespace, scope = :instance) ⇒ Array<Solargraph::Suggestion>
-
#get_methods(namespace, root = '', visibility: [:public]) ⇒ Array<Solargraph::Suggestion>
Get an array of singleton methods that are available in the specified namespace.
- #get_namespace_nodes(fqns) ⇒ Object
- #get_namespace_type(fqns) ⇒ Object
- #get_path_suggestions(path) ⇒ Array<String>
- #get_source_for(node) ⇒ Solargraph::ApiMap::Source
- #get_symbols ⇒ Array<Solargraph::Pin::Symbol>
- #infer_assignment_node_type(node, namespace) ⇒ String
- #infer_class_variable(var, namespace) ⇒ String
- #infer_instance_variable(var, namespace, scope) ⇒ String
- #infer_signature_type(signature, namespace, scope: :class) ⇒ String
-
#initialize(workspace = nil) ⇒ ApiMap
constructor
A new instance of ApiMap.
- #live_map ⇒ Solargraph::LiveMap
- #namespace_exists?(name, root = '') ⇒ Boolean
- #namespaces ⇒ Array<String>
-
#namespaces_in(name, root = '') ⇒ Object
deprecated
Deprecated.
Use get_constants instead.
- #refresh(force = false) ⇒ Object
-
#required ⇒ Array<String>
An array of required paths in the workspace.
- #search(query) ⇒ Object
- #sources ⇒ Object
- #update(filename) ⇒ Object
- #virtualize(code, filename = nil, cursor = nil) ⇒ Solargraph::ApiMap::Source
-
#workspace_files ⇒ Object
An array of all workspace files included in the map.
- #yard_map ⇒ Solargraph::YardMap
Methods included from SourceToYard
#code_object_at, #code_object_paths
Methods included from NodeMethods
#const_from, #infer_literal_node_type, #pack_name, #resolve_node_signature, #unpack_name
Constructor Details
#initialize(workspace = nil) ⇒ ApiMap
Returns a new instance of ApiMap.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/solargraph/api_map.rb', line 35 def initialize workspace = nil @workspace = workspace.gsub(/\\/, '/') unless workspace.nil? clear require_extensions unless @workspace.nil? workspace_files.concat (self.config.included - self.config.excluded) workspace_files.each do |wf| begin @@source_cache[wf] ||= Source.load(wf) rescue Parser::SyntaxError => e STDERR.puts "Failed to load #{wf}: #{e.}" end end end @sources = {} @virtual_source = nil @virtual_filename = nil @stale = true @yard_stale = true refresh yard_map end |
Instance Attribute Details
#workspace ⇒ String (readonly)
The root directory of the project. The ApiMap will search here for additional files to parse and analyze.
32 33 34 |
# File 'lib/solargraph/api_map.rb', line 32 def workspace @workspace end |
Class Method Details
.get_keywords ⇒ Array<Solargraph::Suggestion>
150 151 152 153 154 |
# File 'lib/solargraph/api_map.rb', line 150 def self.get_keywords @keyword_suggestions ||= KEYWORDS.map{ |s| Suggestion.new(s.to_s, kind: Suggestion::KEYWORD, detail: 'Keyword') }.freeze end |
Instance Method Details
#append_source(code, filename) ⇒ Solargraph::ApiMap::Source
126 127 128 |
# File 'lib/solargraph/api_map.rb', line 126 def append_source code, filename virtualize code, filename end |
#config(reload = false) ⇒ Solargraph::ApiMap::Config
59 60 61 62 |
# File 'lib/solargraph/api_map.rb', line 59 def config reload = false @config = ApiMap::Config.new(@workspace) if @config.nil? or reload @config end |
#document(path) ⇒ Array<YARD::CodeObject::Base>
601 602 603 604 605 606 607 608 609 |
# File 'lib/solargraph/api_map.rb', line 601 def document path refresh rake_yard(@sources.values) if @yard_stale @yard_stale = false docs = [] docs.push code_object_at(path) unless code_object_at(path).nil? docs.concat yard_map.document(path) docs end |
#find_fully_qualified_namespace(name, root = '', skip = []) ⇒ String
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/solargraph/api_map.rb', line 207 def find_fully_qualified_namespace name, root = '', skip = [] refresh return nil if skip.include?(root) skip.push root if name == '' if root == '' return '' else return find_fully_qualified_namespace(root, '', skip) end else if (root == '') return name unless namespace_map[name].nil? get_include_strings_from(*file_nodes).each { |i| reroot = "#{root == '' ? '' : root + '::'}#{i}" recname = find_fully_qualified_namespace name.to_s, reroot, skip return recname unless recname.nil? } else roots = root.to_s.split('::') while roots.length > 0 fqns = roots.join('::') + '::' + name return fqns unless namespace_map[fqns].nil? roots.pop end return name unless namespace_map[name].nil? get_include_strings_from(*file_nodes).each { |i| recname = find_fully_qualified_namespace name, i, skip return recname unless recname.nil? } end end result = yard_map.find_fully_qualified_namespace(name, root) if result.nil? result = live_map.get_fqns(name, root) end result end |
#find_namespace_pins(fqns) ⇒ Object
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/solargraph/api_map.rb', line 195 def find_namespace_pins fqns set = nil if fqns.include?('::') set = @namespace_pins[fqns.split('::')[0..-2].join('::')] else set = @namespace_pins[''] end return [] if set.nil? set.select{|p| p.path == fqns} end |
#get_class_variable_pins(namespace) ⇒ Array<Solargraph::Pin::ClassVariable>
270 271 272 273 |
# File 'lib/solargraph/api_map.rb', line 270 def get_class_variable_pins(namespace) refresh @cvar_pins[namespace] || [] end |
#get_class_variables(namespace) ⇒ Array<Solargraph::Suggestion>
276 277 278 279 280 281 282 283 284 |
# File 'lib/solargraph/api_map.rb', line 276 def get_class_variables(namespace) refresh result = [] cp = @cvar_pins[namespace] unless cp.nil? result.concat suggest_unique_variables(cp) end result end |
#get_comment_for(node) ⇒ Object
Use get_docstring_for instead.
145 146 147 |
# File 'lib/solargraph/api_map.rb', line 145 def get_comment_for node get_docstring_for node end |
#get_constant_pins(namespace, root) ⇒ Array<Solargraph::Pin::Constant>
172 173 174 175 |
# File 'lib/solargraph/api_map.rb', line 172 def get_constant_pins namespace, root fqns = find_fully_qualified_namespace(namespace, root) @const_pins[fqns] || [] end |
#get_constants(namespace, root = '') ⇒ Array<Solargraph::Suggestion>
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/solargraph/api_map.rb', line 178 def get_constants namespace, root = '' result = [] skip = [] fqns = find_fully_qualified_namespace(namespace, root) if fqns.empty? result.concat inner_get_constants('', skip, false) else parts = fqns.split('::') resolved = find_namespace_pins(parts.join('::')) resolved.each do |pin| result.concat inner_get_constants(pin.path, skip, true) end end result.concat yard_map.get_constants(fqns) result end |
#get_docstring_for(node) ⇒ YARD::Docstring
Get the docstring associated with a node.
138 139 140 141 142 |
# File 'lib/solargraph/api_map.rb', line 138 def get_docstring_for node filename = get_filename_for(node) return nil if @sources[filename].nil? @sources[filename].docstring_for(node) end |
#get_filename_for(node) ⇒ String
293 294 295 296 297 298 |
# File 'lib/solargraph/api_map.rb', line 293 def get_filename_for(node) @sources.each do |filename, source| return source.filename if source.include?(node) end nil end |
#get_global_variable_pins ⇒ Object
338 339 340 341 342 343 344 |
# File 'lib/solargraph/api_map.rb', line 338 def get_global_variable_pins globals = [] @sources.values.each do |s| globals.concat s.global_variable_pins end globals end |
#get_global_variables ⇒ Array<Solargraph::Suggestion>
330 331 332 333 334 335 336 |
# File 'lib/solargraph/api_map.rb', line 330 def get_global_variables globals = [] @sources.values.each do |s| globals.concat s.global_variable_pins end suggest_unique_variables globals end |
#get_include_strings_from(*nodes) ⇒ Array<String>
525 526 527 528 529 530 531 532 533 534 535 |
# File 'lib/solargraph/api_map.rb', line 525 def get_include_strings_from *nodes arr = [] nodes.each { |node| next unless node.kind_of?(AST::Node) arr.push unpack_name(node.children[2]) if (node.type == :send and node.children[1] == :include) node.children.each { |n| arr += get_include_strings_from(n) if n.kind_of?(AST::Node) and n.type != :class and n.type != :module and n.type != :sclass } } arr end |
#get_instance_methods(namespace, root = '', visibility: [:public]) ⇒ Array<Solargraph::Suggestion>
Get an array of instance methods that are available in the specified namespace.
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
# File 'lib/solargraph/api_map.rb', line 489 def get_instance_methods(namespace, root = '', visibility: [:public]) refresh namespace = clean_namespace_string(namespace) if namespace.end_with?('#class') return get_methods(namespace.split('#').first, root, visibility: visibility) elsif namespace.end_with?('#module') return get_methods(namespace.split('#').first, root, visibility: visibility) end meths = [] meths += inner_get_instance_methods(namespace, root, [], visibility) #unless has_yardoc? fqns = find_fully_qualified_namespace(namespace, root) yard_meths = yard_map.get_instance_methods(fqns, '', visibility: visibility) if yard_meths.any? meths.concat yard_meths else type = get_namespace_type(fqns) if type == :class meths += yard_map.get_instance_methods('Object') elsif type == :module meths += yard_map.get_instance_methods('Module') end end if namespace == '' and root == '' config.domains.each do |d| meths.concat get_instance_methods(d) end end strings = meths.map(&:to_s) live_map.get_methods(namespace, root, 'instance', visibility.include?(:private)).each do |m| next if strings.include?(m) or !m.match(/^[a-z]/i) meths.push Suggestion.new(m, kind: Suggestion::METHOD, docstring: YARD::Docstring.new('(defined at runtime)'), path: "#{fqns}##{m}") end meths end |
#get_instance_variable_pins(namespace, scope = :instance) ⇒ Array<Solargraph::Pin::InstanceVariable>
253 254 255 256 |
# File 'lib/solargraph/api_map.rb', line 253 def get_instance_variable_pins(namespace, scope = :instance) refresh (@ivar_pins[namespace] || []).select{ |pin| pin.scope == scope } end |
#get_instance_variables(namespace, scope = :instance) ⇒ Array<Solargraph::Suggestion>
259 260 261 262 263 264 265 266 267 |
# File 'lib/solargraph/api_map.rb', line 259 def get_instance_variables(namespace, scope = :instance) refresh result = [] ip = @ivar_pins[namespace] unless ip.nil? result.concat suggest_unique_variables(ip.select{ |pin| pin.scope == scope }) end result end |
#get_methods(namespace, root = '', visibility: [:public]) ⇒ Array<Solargraph::Suggestion>
Get an array of singleton methods that are available in the specified namespace.
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/solargraph/api_map.rb', line 444 def get_methods(namespace, root = '', visibility: [:public]) refresh namespace = clean_namespace_string(namespace) fqns = find_fully_qualified_namespace(namespace, root) meths = [] skip = [] meths.concat inner_get_methods(namespace, root, skip) yard_meths = yard_map.get_methods(fqns, '', visibility: visibility) if yard_meths.any? meths.concat yard_meths else type = get_namespace_type(fqns) if type == :class meths.concat yard_map.get_instance_methods('Class') else meths.concat yard_map.get_instance_methods('Module') end end news = meths.select{|s| s.label == 'new'} unless news.empty? if @method_pins[fqns] inits = @method_pins[fqns].select{|p| p.name == 'initialize'} meths -= news unless inits.empty? inits.each do |pin| meths.push Suggestion.new('new', kind: pin.kind, docstring: pin.docstring, detail: pin.namespace, arguments: pin.parameters, path: pin.path) end end end if namespace == '' and root == '' config.domains.each do |d| meths.concat get_instance_methods(d) end end strings = meths.map(&:to_s) live_map.get_methods(fqns, '', 'class', visibility.include?(:private)).each do |m| next if strings.include?(m) or !m.match(/^[a-z]/i) meths.push Suggestion.new(m, kind: Suggestion::METHOD, docstring: YARD::Docstring.new('(defined at runtime)'), path: "#{fqns}.#{m}") end meths end |
#get_namespace_nodes(fqns) ⇒ Object
246 247 248 249 250 |
# File 'lib/solargraph/api_map.rb', line 246 def get_namespace_nodes(fqns) return file_nodes if fqns == '' or fqns.nil? refresh namespace_map[fqns] || [] end |
#get_namespace_type(fqns) ⇒ Object
427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/solargraph/api_map.rb', line 427 def get_namespace_type fqns return nil if fqns.nil? type = nil nodes = get_namespace_nodes(fqns) unless nodes.nil? or nodes.empty? or !nodes[0].kind_of?(AST::Node) type = nodes[0].type if [:class, :module].include?(nodes[0].type) end if type.nil? type = yard_map.get_namespace_type(fqns) end type end |
#get_path_suggestions(path) ⇒ Array<String>
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
# File 'lib/solargraph/api_map.rb', line 564 def get_path_suggestions path refresh result = [] if path.include?('#') # It's an instance method parts = path.split('#') result = get_instance_methods(parts[0], '', visibility: [:public, :private, :protected]).select{|s| s.label == parts[1]} elsif path.include?('.') # It's a class method parts = path.split('.') result = get_methods(parts[0], '', visibility: [:public, :private, :protected]).select{|s| s.label == parts[1]} else # It's a class or module parts = path.split('::') np = @namespace_pins[parts[0..-2].join('::')] unless np.nil? result.concat np.select{|p| p.name == parts.last}.map{|p| pin_to_suggestion(p)} end result.concat yard_map.objects(path) end result end |
#get_source_for(node) ⇒ Solargraph::ApiMap::Source
301 302 303 304 305 306 |
# File 'lib/solargraph/api_map.rb', line 301 def get_source_for(node) @sources.each do |filename, source| return source if source.include?(node) end nil end |
#get_symbols ⇒ Array<Solargraph::Pin::Symbol>
287 288 289 290 |
# File 'lib/solargraph/api_map.rb', line 287 def get_symbols refresh @symbol_pins.uniq(&:label) end |
#infer_assignment_node_type(node, namespace) ⇒ String
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/solargraph/api_map.rb', line 347 def infer_assignment_node_type node, namespace type = cache.get_assignment_node_type(node, namespace) if type.nil? cmnt = get_docstring_for(node) if cmnt.nil? name_i = (node.type == :casgn ? 1 : 0) sig_i = (node.type == :casgn ? 2 : 1) type = infer_literal_node_type(node.children[sig_i]) if type.nil? sig = resolve_node_signature(node.children[sig_i]) # Avoid infinite loops from variable assignments that reference themselves return nil if node.children[name_i].to_s == sig.split('.').first type = infer_signature_type(sig, namespace) end else t = cmnt.tag(:type) if t.nil? sig = resolve_node_signature(node.children[1]) type = infer_signature_type(sig, namespace) else type = t.types[0] end end cache.set_assignment_node_type(node, namespace, type) end type end |
#infer_class_variable(var, namespace) ⇒ String
319 320 321 322 323 324 325 326 327 |
# File 'lib/solargraph/api_map.rb', line 319 def infer_class_variable(var, namespace) refresh fqns = find_fully_qualified_namespace(namespace) pins = @cvar_pins[fqns] return nil if pins.nil? pin = pins.select{|p| p.name == var}.first return nil if pin.nil? pin.return_type end |
#infer_instance_variable(var, namespace, scope) ⇒ String
309 310 311 312 313 314 315 316 |
# File 'lib/solargraph/api_map.rb', line 309 def infer_instance_variable(var, namespace, scope) refresh pins = @ivar_pins[namespace] return nil if pins.nil? pin = pins.select{|p| p.name == var and p.scope == scope}.first return nil if pin.nil? pin.return_type end |
#infer_signature_type(signature, namespace, scope: :class) ⇒ String
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/solargraph/api_map.rb', line 376 def infer_signature_type signature, namespace, scope: :class namespace ||= '' if cache.has_signature_type?(signature, namespace, scope) return cache.get_signature_type(signature, namespace, scope) end return nil if signature.nil? or signature.empty? if !signature.include?('.') fqns = find_fully_qualified_namespace(signature, namespace) unless fqns.nil? or fqns.empty? type = (get_namespace_type(fqns) == :class ? 'Class' : 'Module') return "#{type}<#{fqns}>" end end result = nil if namespace.end_with?('#class') result = infer_signature_type signature, namespace[0..-7], scope: (scope == :class ? :instance : :class) else parts = signature.split('.', 2) if parts[0].start_with?('@@') type = infer_class_variable(parts[0], namespace) if type.nil? or parts.empty? result = inner_infer_signature_type(parts[1], type, scope: :instance) else result = type end elsif parts[0].start_with?('@') type = infer_instance_variable(parts[0], namespace, scope) if type.nil? or parts.empty? result = inner_infer_signature_type(parts[1], type, scope: :instance) else result = type end else type = find_fully_qualified_namespace(parts[0], namespace) if type.nil? # It's a method call type = inner_infer_signature_type(parts[0], namespace, scope: scope) if parts[1].nil? result = type else result = inner_infer_signature_type(parts[1], type, scope: :instance) end else result = inner_infer_signature_type(parts[1], type, scope: :class) end end end cache.set_signature_type signature, namespace, scope, result result end |
#live_map ⇒ Solargraph::LiveMap
88 89 90 |
# File 'lib/solargraph/api_map.rb', line 88 def live_map @live_map ||= Solargraph::LiveMap.new(self) end |
#namespace_exists?(name, root = '') ⇒ Boolean
162 163 164 |
# File 'lib/solargraph/api_map.rb', line 162 def namespace_exists? name, root = '' !find_fully_qualified_namespace(name, root).nil? end |
#namespaces ⇒ Array<String>
157 158 159 160 |
# File 'lib/solargraph/api_map.rb', line 157 def namespaces refresh namespace_map.keys end |
#namespaces_in(name, root = '') ⇒ Object
Use get_constants instead.
167 168 169 |
# File 'lib/solargraph/api_map.rb', line 167 def namespaces_in name, root = '' get_constants name, root end |
#refresh(force = false) ⇒ Object
130 131 132 |
# File 'lib/solargraph/api_map.rb', line 130 def refresh force = false process_maps if @stale or force end |
#required ⇒ Array<String>
An array of required paths in the workspace.
74 75 76 |
# File 'lib/solargraph/api_map.rb', line 74 def required @required ||= [] end |
#search(query) ⇒ Object
587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/solargraph/api_map.rb', line 587 def search query refresh rake_yard(@sources.values) if @yard_stale @yard_stale = false found = [] code_object_paths.each do |k| if found.empty? or (query.include?('.') or query.include?('#')) or !(k.include?('.') or k.include?('#')) found.push k if k.downcase.include?(query.downcase) end end found.concat(yard_map.search(query)).uniq.sort end |
#sources ⇒ Object
559 560 561 |
# File 'lib/solargraph/api_map.rb', line 559 def sources @sources.values end |
#update(filename) ⇒ Object
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
# File 'lib/solargraph/api_map.rb', line 537 def update filename filename.gsub!(/\\/, '/') if filename.end_with?('.rb') if @virtual_filename == filename @virtual_filename = nil @virtual_source = nil end if @workspace_files.include?(filename) eliminate filename @@source_cache[filename] = Source.load(filename) rebuild_local_yardoc #if @workspace_files.include?(filename) @stale = true else @workspace_files = config(true).calculated update filename if @workspace_files.include?(filename) end elsif File.basename(filename) == '.solargraph.yml' # @todo Finish refreshing the map @workspace_files = config(true).calculated end end |
#virtualize(code, filename = nil, cursor = nil) ⇒ Solargraph::ApiMap::Source
Get rid of the cursor parameter. Tracking stubbed lines is the better option.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/solargraph/api_map.rb', line 98 def virtualize code, filename = nil, cursor = nil workspace_files.delete_if do |f| if File.exist?(f) false else eliminate f true end end if filename.nil? or filename.end_with?('.rb') eliminate @virtual_filename unless @virtual_source.nil? or @virtual_filename == filename or workspace_files.include?(@virtual_filename) @virtual_filename = filename @virtual_source = Source.fix(code, filename, cursor) unless filename.nil? or workspace_files.include?(filename) current_files = @workspace_files @workspace_files = config(true).calculated (current_files - @workspace_files).each { |f| eliminate f } end process_virtual else unless filename.nil? # @todo Handle special files like .solargraph.yml end end @virtual_source end |
#workspace_files ⇒ Object
An array of all workspace files included in the map.
67 68 69 |
# File 'lib/solargraph/api_map.rb', line 67 def workspace_files @workspace_files ||= [] end |
#yard_map ⇒ Solargraph::YardMap
79 80 81 82 83 84 85 |
# File 'lib/solargraph/api_map.rb', line 79 def yard_map refresh if @yard_map.nil? || @yard_map.required != required @yard_map = Solargraph::YardMap.new(required: required, workspace: workspace) end @yard_map end |