solargraph 0.60.4 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/linting.yml +24 -2
- data/.github/workflows/plugins.yml +19 -1
- data/.github/workflows/rspec.yml +17 -2
- data/.github/workflows/typecheck.yml +6 -0
- data/CHANGELOG.md +54 -0
- data/Gemfile +0 -3
- data/lib/solargraph/api_map/index.rb +28 -4
- data/lib/solargraph/api_map/store.rb +19 -0
- data/lib/solargraph/api_map.rb +91 -80
- data/lib/solargraph/cache_dir.rb +58 -0
- data/lib/solargraph/collection/base.rb +50 -0
- data/lib/solargraph/collection/core.rb +17 -0
- data/lib/solargraph/collection/gem.rb +59 -0
- data/lib/solargraph/collection/stdlib.rb +25 -0
- data/lib/solargraph/collection.rb +30 -0
- data/lib/solargraph/complex_type/unique_type.rb +13 -0
- data/lib/solargraph/complex_type.rb +23 -3
- data/lib/solargraph/convention.rb +5 -7
- data/lib/solargraph/diagnostics/require_not_found.rb +0 -4
- data/lib/solargraph/diagnostics/type_check.rb +0 -1
- data/lib/solargraph/external.rb +187 -0
- data/lib/solargraph/language_server/host/diagnoser.rb +1 -1
- data/lib/solargraph/language_server/host/dispatch.rb +4 -2
- data/lib/solargraph/language_server/host.rb +10 -2
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +10 -3
- data/lib/solargraph/language_server/message/text_document/definition.rb +5 -2
- data/lib/solargraph/language_server/message/text_document/hover.rb +1 -2
- data/lib/solargraph/library.rb +26 -53
- data/lib/solargraph/metagem.rb +80 -0
- data/lib/solargraph/parser/node_processor/base.rb +6 -0
- data/lib/solargraph/parser/parser_gem/node_chainer.rb +22 -3
- data/lib/solargraph/parser/parser_gem/node_methods.rb +29 -6
- data/lib/solargraph/parser/parser_gem/node_processors/class_definition/class_assignment_node.rb +98 -0
- data/lib/solargraph/parser/parser_gem/node_processors/class_definition.rb +54 -0
- data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +1 -0
- data/lib/solargraph/parser/parser_gem/node_processors/data_definition/data_assignment_node.rb +65 -0
- data/lib/solargraph/parser/parser_gem/node_processors/data_definition/data_definition_node.rb +97 -0
- data/lib/solargraph/parser/parser_gem/node_processors/data_definition.rb +110 -0
- data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +1 -0
- data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +2 -0
- data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +1 -0
- data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +185 -0
- data/lib/solargraph/parser/parser_gem/node_processors/struct_definition/struct_assignment_node.rb +66 -0
- data/lib/solargraph/parser/parser_gem/node_processors/struct_definition/struct_definition_node.rb +108 -0
- data/lib/solargraph/parser/parser_gem/node_processors/struct_definition.rb +170 -0
- data/lib/solargraph/parser/parser_gem/node_processors.rb +33 -29
- data/lib/solargraph/pin/base.rb +25 -1
- data/lib/solargraph/pin/base_variable.rb +31 -1
- data/lib/solargraph/pin/callable.rb +11 -2
- data/lib/solargraph/pin/closure.rb +17 -0
- data/lib/solargraph/pin/delegated_method.rb +5 -0
- data/lib/solargraph/pin/duck_method.rb +36 -16
- data/lib/solargraph/pin/factory_parameter.rb +84 -0
- data/lib/solargraph/pin/instance_variable.rb +45 -0
- data/lib/solargraph/pin/method.rb +10 -0
- data/lib/solargraph/pin/method_alias.rb +4 -0
- data/lib/solargraph/pin/parameter.rb +1 -1
- data/lib/solargraph/pin/reference/included_mixin.rb +22 -0
- data/lib/solargraph/pin/reference.rb +1 -0
- data/lib/solargraph/pin.rb +1 -0
- data/lib/solargraph/plugin/active_support.rb +100 -0
- data/lib/solargraph/plugin/addon.rb +16 -0
- data/lib/solargraph/plugin/base.rb +25 -0
- data/lib/solargraph/plugin/panel.rb +37 -0
- data/lib/solargraph/plugin.rb +26 -0
- data/lib/solargraph/rbs_collection.rb +119 -0
- data/lib/solargraph/rbs_map/base.rb +31 -0
- data/lib/solargraph/rbs_map/conversions.rb +109 -48
- data/lib/solargraph/rbs_map/{core_map.rb → core.rb} +18 -39
- data/lib/solargraph/rbs_map/core_fills.rb +1 -1
- data/lib/solargraph/rbs_map/gem.rb +16 -0
- data/lib/solargraph/rbs_map/helpers.rb +61 -0
- data/lib/solargraph/rbs_map/path.rb +19 -0
- data/lib/solargraph/rbs_map/stdlib.rb +24 -0
- data/lib/solargraph/rbs_map.rb +7 -198
- data/lib/solargraph/rbs_translator.rb +105 -70
- data/lib/solargraph/repo.rb +177 -0
- data/lib/solargraph/shell.rb +49 -99
- data/lib/solargraph/source/chain/call.rb +58 -14
- data/lib/solargraph/source/chain/literal.rb +17 -17
- data/lib/solargraph/source/chain/parameter.rb +79 -0
- data/lib/solargraph/source/chain.rb +8 -0
- data/lib/solargraph/source/node_map.rb +27 -0
- data/lib/solargraph/source/source_chainer.rb +40 -44
- data/lib/solargraph/source.rb +17 -0
- data/lib/solargraph/source_map/call.rb +18 -0
- data/lib/solargraph/source_map/clip.rb +5 -3
- data/lib/solargraph/source_map/mapper.rb +6 -2
- data/lib/solargraph/source_map.rb +28 -9
- data/lib/solargraph/type_checker/rules.rb +3 -2
- data/lib/solargraph/type_checker.rb +4 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace.rb +0 -1
- data/lib/solargraph/yard_map/cache.rb +1 -1
- data/lib/solargraph/yard_map/directives/attribute_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives/domain_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives/method_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives/override_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives/parse_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives/scope_directive.rb +178 -0
- data/lib/solargraph/yard_map/directives/visibility_directive.rb +1 -1
- data/lib/solargraph/yard_map/directives.rb +5 -2
- data/lib/solargraph/yard_map/helpers.rb +1 -1
- data/lib/solargraph/yard_map/macro.rb +85 -6
- data/lib/solargraph/yard_map/mapper/to_constant.rb +1 -1
- data/lib/solargraph/yard_map/mapper/to_method.rb +1 -1
- data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -1
- data/lib/solargraph/yard_map/mapper.rb +2 -2
- data/lib/solargraph/yard_map.rb +1 -1
- data/lib/solargraph/yardoc.rb +43 -60
- data/lib/solargraph.rb +8 -3
- data/rbs/fills/boolean/0/boolean.rbs +12 -0
- data/solargraph.gemspec +2 -2
- metadata +41 -18
- data/lib/solargraph/convention/active_support_concern.rb +0 -111
- data/lib/solargraph/convention/data_definition/data_assignment_node.rb +0 -61
- data/lib/solargraph/convention/data_definition/data_definition_node.rb +0 -93
- data/lib/solargraph/convention/data_definition.rb +0 -108
- data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +0 -62
- data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +0 -103
- data/lib/solargraph/convention/struct_definition.rb +0 -168
- data/lib/solargraph/doc_map.rb +0 -439
- data/lib/solargraph/gem_pins.rb +0 -87
- data/lib/solargraph/pin_cache.rb +0 -248
- data/lib/solargraph/rbs_map/stdlib_map.rb +0 -71
- data/lib/solargraph/workspace/gemspecs.rb +0 -373
data/lib/solargraph/yardoc.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'open3'
|
|
4
|
+
require 'fileutils'
|
|
4
5
|
|
|
5
6
|
module Solargraph
|
|
6
7
|
# Methods for caching and loading YARD documentation for gems.
|
|
@@ -8,83 +9,65 @@ module Solargraph
|
|
|
8
9
|
module Yardoc
|
|
9
10
|
module_function
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# @param
|
|
16
|
-
# @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
12
|
+
def path_for metagem
|
|
13
|
+
File.join(CacheDir.yard_dir, "#{metagem.cache_name}.yardoc")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @param metagem [Metagem]
|
|
17
|
+
# @param force [Boolean]
|
|
18
|
+
# @return [void]
|
|
19
|
+
def cache metagem, force: false
|
|
20
|
+
return unless force || !cached?(metagem)
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
22
|
+
Solargraph.logger.info "Caching yardoc for #{metagem.cache_name}"
|
|
23
|
+
path = path_for(metagem)
|
|
24
|
+
FileUtils.mkdir_p File.dirname(path)
|
|
25
|
+
cmd = ['yardoc', '--db', path, '--no-output', '--plugin', 'solargraph', '--plugin', 'activesupport-concern']
|
|
26
|
+
Solargraph.logger.debug "Running: #{cmd.inspect}"
|
|
27
|
+
output, status = Open3.capture2e(*cmd, chdir: metagem.full_path)
|
|
28
|
+
return if status.success?
|
|
29
29
|
|
|
30
|
-
Solargraph.logger.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# @sg-ignore Unrecognized keyword argument chdir to Open3.capture2e
|
|
37
|
-
stdout_and_stderr_str, status = Open3.capture2e(current_bundle_env_tweaks, cmd, chdir: gemspec.gem_dir)
|
|
38
|
-
unless status.success?
|
|
39
|
-
Solargraph.logger.warn { "YARD failed running #{cmd.inspect} in #{gemspec.gem_dir}" }
|
|
40
|
-
Solargraph.logger.info stdout_and_stderr_str
|
|
41
|
-
end
|
|
42
|
-
path
|
|
30
|
+
Solargraph.logger.warn { "YARD failed running #{cmd.inspect} in #{metagem.full_path}" }
|
|
31
|
+
Solargraph.logger.info output
|
|
32
|
+
# @todo Ignore missing metagems for now. We need to figure out why this
|
|
33
|
+
# happens in GitHub actions.
|
|
34
|
+
rescue Errno::ENOENT => _e
|
|
35
|
+
Solargraph.logger.warn "Gem #{metagem.name} #{metagem.version} not found at #{metagem.full_path}"
|
|
43
36
|
end
|
|
44
37
|
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
# @param metagem [Metagem]
|
|
39
|
+
# @return [void]
|
|
40
|
+
def uncache metagem
|
|
41
|
+
FileUtils.rm_rf path_for(metagem)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @param metagem [Metagem]
|
|
45
|
+
def cached? metagem
|
|
46
|
+
yardoc = File.join(path_for(metagem), 'complete')
|
|
50
47
|
File.exist?(yardoc)
|
|
51
48
|
end
|
|
49
|
+
alias exist? cached?
|
|
52
50
|
|
|
53
51
|
# True if another process is currently building the yardoc cache.
|
|
54
52
|
#
|
|
55
|
-
# @param
|
|
56
|
-
def processing?
|
|
57
|
-
yardoc = File.join(
|
|
53
|
+
# @param metagem [Metagem]
|
|
54
|
+
def processing? metagem
|
|
55
|
+
yardoc = File.join(path_for(metagem), 'processing')
|
|
58
56
|
File.exist?(yardoc)
|
|
59
57
|
end
|
|
60
58
|
|
|
61
|
-
# Load a gem's yardoc and return its code objects.
|
|
59
|
+
# Load a gem's yardoc cache and return its code objects.
|
|
62
60
|
#
|
|
63
61
|
# @note This method modifies the global YARD registry.
|
|
64
62
|
#
|
|
65
|
-
# @param
|
|
63
|
+
# @param metagem [Metagem]
|
|
66
64
|
# @return [Array<YARD::CodeObjects::Base>]
|
|
67
|
-
def load!
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
end
|
|
65
|
+
def load! metagem
|
|
66
|
+
cache metagem
|
|
67
|
+
return [] unless cached?(metagem)
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# directories.
|
|
75
|
-
#
|
|
76
|
-
# 'bundle exec' sets an absolute path here, but at least the
|
|
77
|
-
# overcommit gem does not, breaking on-the-fly documention with a
|
|
78
|
-
# spawned yardoc command from our current bundle
|
|
79
|
-
#
|
|
80
|
-
# @return [Hash{String => String}] a hash of environment variables to override
|
|
81
|
-
def current_bundle_env_tweaks
|
|
82
|
-
tweaks = {}
|
|
83
|
-
# @sg-ignore Unresolved call to empty? on String, nil
|
|
84
|
-
if ENV['BUNDLE_GEMFILE'] && !ENV['BUNDLE_GEMFILE'].empty?
|
|
85
|
-
tweaks['BUNDLE_GEMFILE'] = File.expand_path(ENV['BUNDLE_GEMFILE'])
|
|
86
|
-
end
|
|
87
|
-
tweaks
|
|
69
|
+
YARD::Registry.load! path_for(metagem)
|
|
70
|
+
YARD::Registry.all
|
|
88
71
|
end
|
|
89
72
|
end
|
|
90
73
|
end
|
data/lib/solargraph.rb
CHANGED
|
@@ -4,6 +4,7 @@ Encoding.default_external = 'UTF-8'
|
|
|
4
4
|
|
|
5
5
|
require 'bundler'
|
|
6
6
|
require 'set'
|
|
7
|
+
require 'yard-activesupport-concern'
|
|
7
8
|
require 'yard-solargraph'
|
|
8
9
|
require 'solargraph/yard_tags'
|
|
9
10
|
require 'solargraph/version'
|
|
@@ -31,7 +32,10 @@ module Solargraph
|
|
|
31
32
|
autoload :Yardoc, 'solargraph/yardoc'
|
|
32
33
|
autoload :YardMap, 'solargraph/yard_map'
|
|
33
34
|
autoload :Pin, 'solargraph/pin'
|
|
34
|
-
autoload :
|
|
35
|
+
autoload :Metagem, 'solargraph/metagem'
|
|
36
|
+
autoload :Repo, 'solargraph/repo'
|
|
37
|
+
autoload :External, 'solargraph/external'
|
|
38
|
+
autoload :Collection, 'solargraph/collection'
|
|
35
39
|
autoload :ServerMethods, 'solargraph/server_methods'
|
|
36
40
|
autoload :LanguageServer, 'solargraph/language_server'
|
|
37
41
|
autoload :Workspace, 'solargraph/workspace'
|
|
@@ -47,9 +51,10 @@ module Solargraph
|
|
|
47
51
|
autoload :Convention, 'solargraph/convention'
|
|
48
52
|
autoload :Parser, 'solargraph/parser'
|
|
49
53
|
autoload :RbsMap, 'solargraph/rbs_map'
|
|
50
|
-
autoload :
|
|
51
|
-
autoload :PinCache, 'solargraph/pin_cache'
|
|
54
|
+
autoload :CacheDir, 'solargraph/cache_dir'
|
|
52
55
|
autoload :RbsTranslator, 'solargraph/rbs_translator'
|
|
56
|
+
autoload :RbsCollection, 'solargraph/rbs_collection'
|
|
57
|
+
autoload :Plugin, 'solargraph/plugin'
|
|
53
58
|
|
|
54
59
|
dir = File.dirname(__FILE__)
|
|
55
60
|
VIEWS_PATH = File.join(dir, 'solargraph', 'views')
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Boolean is Solargraph's name for the RBS `bool` type. Store#get_superclass
|
|
2
|
+
# already gives TrueClass and FalseClass `Boolean` as their superclass, but
|
|
3
|
+
# nothing defined it, so it had no pin and carried only Object's methods.
|
|
4
|
+
#
|
|
5
|
+
# The members are the ones TrueClass and FalseClass share beyond Object.
|
|
6
|
+
class Boolean
|
|
7
|
+
def &: (untyped obj) -> bool
|
|
8
|
+
|
|
9
|
+
def ^: (untyped obj) -> bool
|
|
10
|
+
|
|
11
|
+
def |: (untyped obj) -> bool
|
|
12
|
+
end
|
data/solargraph.gemspec
CHANGED
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
|
44
44
|
s.add_dependency 'ostruct', '~> 0.6'
|
|
45
45
|
s.add_dependency 'parser', '~> 3.0'
|
|
46
46
|
s.add_dependency 'prism', '~> 1.4'
|
|
47
|
-
s.add_dependency 'rbs', '>= 3.10.
|
|
47
|
+
s.add_dependency 'rbs', '>= 3.10.4'
|
|
48
48
|
s.add_dependency 'rdoc', '~> 7.0'
|
|
49
49
|
s.add_dependency 'reverse_markdown', '~> 3.0'
|
|
50
50
|
s.add_dependency 'rubocop', '~> 1.76'
|
|
@@ -66,7 +66,7 @@ Gem::Specification.new do |s|
|
|
|
66
66
|
# even more specific on RuboCop itself, which is written into _todo
|
|
67
67
|
# file.
|
|
68
68
|
s.add_development_dependency 'overcommit', '~> 0.71.0'
|
|
69
|
-
s.add_development_dependency 'rubocop', '~> 1.80
|
|
69
|
+
s.add_development_dependency 'rubocop', '~> 1.80'
|
|
70
70
|
s.add_development_dependency 'rubocop-rake', '~> 0.7.1'
|
|
71
71
|
s.add_development_dependency 'rubocop-rspec', '~> 3.6.0'
|
|
72
72
|
s.add_development_dependency 'rubocop-yard', '~> 1.0.0'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solargraph
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.62.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
@@ -217,14 +217,14 @@ dependencies:
|
|
|
217
217
|
requirements:
|
|
218
218
|
- - ">="
|
|
219
219
|
- !ruby/object:Gem::Version
|
|
220
|
-
version: 3.10.
|
|
220
|
+
version: 3.10.4
|
|
221
221
|
type: :runtime
|
|
222
222
|
prerelease: false
|
|
223
223
|
version_requirements: !ruby/object:Gem::Requirement
|
|
224
224
|
requirements:
|
|
225
225
|
- - ">="
|
|
226
226
|
- !ruby/object:Gem::Version
|
|
227
|
-
version: 3.10.
|
|
227
|
+
version: 3.10.4
|
|
228
228
|
- !ruby/object:Gem::Dependency
|
|
229
229
|
name: rdoc
|
|
230
230
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -433,14 +433,14 @@ dependencies:
|
|
|
433
433
|
requirements:
|
|
434
434
|
- - "~>"
|
|
435
435
|
- !ruby/object:Gem::Version
|
|
436
|
-
version: 1.80
|
|
436
|
+
version: '1.80'
|
|
437
437
|
type: :development
|
|
438
438
|
prerelease: false
|
|
439
439
|
version_requirements: !ruby/object:Gem::Requirement
|
|
440
440
|
requirements:
|
|
441
441
|
- - "~>"
|
|
442
442
|
- !ruby/object:Gem::Version
|
|
443
|
-
version: 1.80
|
|
443
|
+
version: '1.80'
|
|
444
444
|
- !ruby/object:Gem::Dependency
|
|
445
445
|
name: rubocop-rake
|
|
446
446
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -588,22 +588,21 @@ files:
|
|
|
588
588
|
- lib/solargraph/api_map/source_to_yard.rb
|
|
589
589
|
- lib/solargraph/api_map/store.rb
|
|
590
590
|
- lib/solargraph/bench.rb
|
|
591
|
+
- lib/solargraph/cache_dir.rb
|
|
592
|
+
- lib/solargraph/collection.rb
|
|
593
|
+
- lib/solargraph/collection/base.rb
|
|
594
|
+
- lib/solargraph/collection/core.rb
|
|
595
|
+
- lib/solargraph/collection/gem.rb
|
|
596
|
+
- lib/solargraph/collection/stdlib.rb
|
|
591
597
|
- lib/solargraph/complex_type.rb
|
|
592
598
|
- lib/solargraph/complex_type/conformance.rb
|
|
593
599
|
- lib/solargraph/complex_type/type_methods.rb
|
|
594
600
|
- lib/solargraph/complex_type/unique_type.rb
|
|
595
601
|
- lib/solargraph/convention.rb
|
|
596
|
-
- lib/solargraph/convention/active_support_concern.rb
|
|
597
602
|
- lib/solargraph/convention/base.rb
|
|
598
|
-
- lib/solargraph/convention/data_definition.rb
|
|
599
|
-
- lib/solargraph/convention/data_definition/data_assignment_node.rb
|
|
600
|
-
- lib/solargraph/convention/data_definition/data_definition_node.rb
|
|
601
603
|
- lib/solargraph/convention/gemfile.rb
|
|
602
604
|
- lib/solargraph/convention/gemspec.rb
|
|
603
605
|
- lib/solargraph/convention/rakefile.rb
|
|
604
|
-
- lib/solargraph/convention/struct_definition.rb
|
|
605
|
-
- lib/solargraph/convention/struct_definition/struct_assignment_node.rb
|
|
606
|
-
- lib/solargraph/convention/struct_definition/struct_definition_node.rb
|
|
607
606
|
- lib/solargraph/converters/dd.rb
|
|
608
607
|
- lib/solargraph/converters/dl.rb
|
|
609
608
|
- lib/solargraph/converters/dt.rb
|
|
@@ -616,10 +615,9 @@ files:
|
|
|
616
615
|
- lib/solargraph/diagnostics/severities.rb
|
|
617
616
|
- lib/solargraph/diagnostics/type_check.rb
|
|
618
617
|
- lib/solargraph/diagnostics/update_errors.rb
|
|
619
|
-
- lib/solargraph/doc_map.rb
|
|
620
618
|
- lib/solargraph/environ.rb
|
|
621
619
|
- lib/solargraph/equality.rb
|
|
622
|
-
- lib/solargraph/
|
|
620
|
+
- lib/solargraph/external.rb
|
|
623
621
|
- lib/solargraph/language_server.rb
|
|
624
622
|
- lib/solargraph/language_server/completion_item_kinds.rb
|
|
625
623
|
- lib/solargraph/language_server/error_codes.rb
|
|
@@ -684,6 +682,7 @@ files:
|
|
|
684
682
|
- lib/solargraph/library.rb
|
|
685
683
|
- lib/solargraph/location.rb
|
|
686
684
|
- lib/solargraph/logging.rb
|
|
685
|
+
- lib/solargraph/metagem.rb
|
|
687
686
|
- lib/solargraph/page.rb
|
|
688
687
|
- lib/solargraph/parser.rb
|
|
689
688
|
- lib/solargraph/parser/comment_ripper.rb
|
|
@@ -702,7 +701,12 @@ files:
|
|
|
702
701
|
- lib/solargraph/parser/parser_gem/node_processors/begin_node.rb
|
|
703
702
|
- lib/solargraph/parser/parser_gem/node_processors/block_node.rb
|
|
704
703
|
- lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb
|
|
704
|
+
- lib/solargraph/parser/parser_gem/node_processors/class_definition.rb
|
|
705
|
+
- lib/solargraph/parser/parser_gem/node_processors/class_definition/class_assignment_node.rb
|
|
705
706
|
- lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb
|
|
707
|
+
- lib/solargraph/parser/parser_gem/node_processors/data_definition.rb
|
|
708
|
+
- lib/solargraph/parser/parser_gem/node_processors/data_definition/data_assignment_node.rb
|
|
709
|
+
- lib/solargraph/parser/parser_gem/node_processors/data_definition/data_definition_node.rb
|
|
706
710
|
- lib/solargraph/parser/parser_gem/node_processors/def_node.rb
|
|
707
711
|
- lib/solargraph/parser/parser_gem/node_processors/defs_node.rb
|
|
708
712
|
- lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb
|
|
@@ -717,6 +721,9 @@ files:
|
|
|
717
721
|
- lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb
|
|
718
722
|
- lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb
|
|
719
723
|
- lib/solargraph/parser/parser_gem/node_processors/send_node.rb
|
|
724
|
+
- lib/solargraph/parser/parser_gem/node_processors/struct_definition.rb
|
|
725
|
+
- lib/solargraph/parser/parser_gem/node_processors/struct_definition/struct_assignment_node.rb
|
|
726
|
+
- lib/solargraph/parser/parser_gem/node_processors/struct_definition/struct_definition_node.rb
|
|
720
727
|
- lib/solargraph/parser/parser_gem/node_processors/sym_node.rb
|
|
721
728
|
- lib/solargraph/parser/parser_gem/node_processors/until_node.rb
|
|
722
729
|
- lib/solargraph/parser/parser_gem/node_processors/when_node.rb
|
|
@@ -738,6 +745,7 @@ files:
|
|
|
738
745
|
- lib/solargraph/pin/delegated_method.rb
|
|
739
746
|
- lib/solargraph/pin/documenting.rb
|
|
740
747
|
- lib/solargraph/pin/duck_method.rb
|
|
748
|
+
- lib/solargraph/pin/factory_parameter.rb
|
|
741
749
|
- lib/solargraph/pin/global_variable.rb
|
|
742
750
|
- lib/solargraph/pin/instance_variable.rb
|
|
743
751
|
- lib/solargraph/pin/keyword.rb
|
|
@@ -751,6 +759,7 @@ files:
|
|
|
751
759
|
- lib/solargraph/pin/reference.rb
|
|
752
760
|
- lib/solargraph/pin/reference/extend.rb
|
|
753
761
|
- lib/solargraph/pin/reference/include.rb
|
|
762
|
+
- lib/solargraph/pin/reference/included_mixin.rb
|
|
754
763
|
- lib/solargraph/pin/reference/override.rb
|
|
755
764
|
- lib/solargraph/pin/reference/prepend.rb
|
|
756
765
|
- lib/solargraph/pin/reference/require.rb
|
|
@@ -762,15 +771,25 @@ files:
|
|
|
762
771
|
- lib/solargraph/pin/symbol.rb
|
|
763
772
|
- lib/solargraph/pin/until.rb
|
|
764
773
|
- lib/solargraph/pin/while.rb
|
|
765
|
-
- lib/solargraph/
|
|
774
|
+
- lib/solargraph/plugin.rb
|
|
775
|
+
- lib/solargraph/plugin/active_support.rb
|
|
776
|
+
- lib/solargraph/plugin/addon.rb
|
|
777
|
+
- lib/solargraph/plugin/base.rb
|
|
778
|
+
- lib/solargraph/plugin/panel.rb
|
|
766
779
|
- lib/solargraph/position.rb
|
|
767
780
|
- lib/solargraph/range.rb
|
|
781
|
+
- lib/solargraph/rbs_collection.rb
|
|
768
782
|
- lib/solargraph/rbs_map.rb
|
|
783
|
+
- lib/solargraph/rbs_map/base.rb
|
|
769
784
|
- lib/solargraph/rbs_map/conversions.rb
|
|
785
|
+
- lib/solargraph/rbs_map/core.rb
|
|
770
786
|
- lib/solargraph/rbs_map/core_fills.rb
|
|
771
|
-
- lib/solargraph/rbs_map/
|
|
772
|
-
- lib/solargraph/rbs_map/
|
|
787
|
+
- lib/solargraph/rbs_map/gem.rb
|
|
788
|
+
- lib/solargraph/rbs_map/helpers.rb
|
|
789
|
+
- lib/solargraph/rbs_map/path.rb
|
|
790
|
+
- lib/solargraph/rbs_map/stdlib.rb
|
|
773
791
|
- lib/solargraph/rbs_translator.rb
|
|
792
|
+
- lib/solargraph/repo.rb
|
|
774
793
|
- lib/solargraph/server_methods.rb
|
|
775
794
|
- lib/solargraph/shell.rb
|
|
776
795
|
- lib/solargraph/source.rb
|
|
@@ -789,15 +808,18 @@ files:
|
|
|
789
808
|
- lib/solargraph/source/chain/link.rb
|
|
790
809
|
- lib/solargraph/source/chain/literal.rb
|
|
791
810
|
- lib/solargraph/source/chain/or.rb
|
|
811
|
+
- lib/solargraph/source/chain/parameter.rb
|
|
792
812
|
- lib/solargraph/source/chain/q_call.rb
|
|
793
813
|
- lib/solargraph/source/chain/variable.rb
|
|
794
814
|
- lib/solargraph/source/chain/z_super.rb
|
|
795
815
|
- lib/solargraph/source/change.rb
|
|
796
816
|
- lib/solargraph/source/cursor.rb
|
|
797
817
|
- lib/solargraph/source/encoding_fixes.rb
|
|
818
|
+
- lib/solargraph/source/node_map.rb
|
|
798
819
|
- lib/solargraph/source/source_chainer.rb
|
|
799
820
|
- lib/solargraph/source/updater.rb
|
|
800
821
|
- lib/solargraph/source_map.rb
|
|
822
|
+
- lib/solargraph/source_map/call.rb
|
|
801
823
|
- lib/solargraph/source_map/clip.rb
|
|
802
824
|
- lib/solargraph/source_map/completion.rb
|
|
803
825
|
- lib/solargraph/source_map/data.rb
|
|
@@ -815,7 +837,6 @@ files:
|
|
|
815
837
|
- lib/solargraph/views/search.erb
|
|
816
838
|
- lib/solargraph/workspace.rb
|
|
817
839
|
- lib/solargraph/workspace/config.rb
|
|
818
|
-
- lib/solargraph/workspace/gemspecs.rb
|
|
819
840
|
- lib/solargraph/workspace/require_paths.rb
|
|
820
841
|
- lib/solargraph/yard_map.rb
|
|
821
842
|
- lib/solargraph/yard_map/cache.rb
|
|
@@ -825,6 +846,7 @@ files:
|
|
|
825
846
|
- lib/solargraph/yard_map/directives/method_directive.rb
|
|
826
847
|
- lib/solargraph/yard_map/directives/override_directive.rb
|
|
827
848
|
- lib/solargraph/yard_map/directives/parse_directive.rb
|
|
849
|
+
- lib/solargraph/yard_map/directives/scope_directive.rb
|
|
828
850
|
- lib/solargraph/yard_map/directives/visibility_directive.rb
|
|
829
851
|
- lib/solargraph/yard_map/helpers.rb
|
|
830
852
|
- lib/solargraph/yard_map/macro.rb
|
|
@@ -834,6 +856,7 @@ files:
|
|
|
834
856
|
- lib/solargraph/yard_map/mapper/to_namespace.rb
|
|
835
857
|
- lib/solargraph/yard_tags.rb
|
|
836
858
|
- lib/solargraph/yardoc.rb
|
|
859
|
+
- rbs/fills/boolean/0/boolean.rbs
|
|
837
860
|
- rbs/fills/bundler/0/bundler.rbs
|
|
838
861
|
- rbs/fills/open3/0/open3.rbs
|
|
839
862
|
- rbs/fills/rubygems/0/basic_specification.rbs
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
# ActiveSupport::Concern is syntactic sugar for a common
|
|
6
|
-
# pattern to include class methods while mixing-in a Module
|
|
7
|
-
# See https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
|
|
8
|
-
class ActiveSupportConcern < Base
|
|
9
|
-
include Logging
|
|
10
|
-
|
|
11
|
-
# @return [Array<Pin::Base>]
|
|
12
|
-
attr_reader :pins
|
|
13
|
-
|
|
14
|
-
# @param api_map [ApiMap]
|
|
15
|
-
# @param rooted_tag [String]
|
|
16
|
-
# @param scope [Symbol] :class or :instance
|
|
17
|
-
# @param visibility [Array<Symbol>] :public, :protected, and/or :private
|
|
18
|
-
# @param deep [Boolean] whether to include methods from included modules
|
|
19
|
-
# @param skip [Set<String>]
|
|
20
|
-
# @param _no_core [Boolean]n whether to skip core methods
|
|
21
|
-
def object api_map, rooted_tag, scope, visibility, deep, skip, _no_core
|
|
22
|
-
moo = ObjectProcessor.new(api_map, rooted_tag, scope, visibility, deep, skip)
|
|
23
|
-
moo.environ
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# yard-activesupport-concern pulls methods inside
|
|
27
|
-
# 'class_methods' blocks into main class visible from YARD
|
|
28
|
-
#
|
|
29
|
-
# @param _doc_map [DocMap]
|
|
30
|
-
def global _doc_map
|
|
31
|
-
Environ.new(yard_plugins: ['activesupport-concern'])
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Process an object to add any class methods brought in via
|
|
35
|
-
# ActiveSupport::Concern
|
|
36
|
-
class ObjectProcessor
|
|
37
|
-
include Logging
|
|
38
|
-
|
|
39
|
-
attr_reader :environ
|
|
40
|
-
|
|
41
|
-
# @param api_map [ApiMap]
|
|
42
|
-
# @param rooted_tag [String] the tag of the class or module being processed
|
|
43
|
-
# @param scope [Symbol] :class or :instance
|
|
44
|
-
# @param visibility [Array<Symbol>] :public, :protected, and/or :private
|
|
45
|
-
# @param deep [Boolean] whether to include methods from included modules
|
|
46
|
-
# @param skip [Set<String>] a set of tags to skip
|
|
47
|
-
def initialize api_map, rooted_tag, scope, visibility, deep, skip
|
|
48
|
-
@api_map = api_map
|
|
49
|
-
@rooted_tag = rooted_tag
|
|
50
|
-
@scope = scope
|
|
51
|
-
@visibility = visibility
|
|
52
|
-
@deep = deep
|
|
53
|
-
@skip = skip
|
|
54
|
-
|
|
55
|
-
@environ = Environ.new
|
|
56
|
-
return unless scope == :class
|
|
57
|
-
|
|
58
|
-
@rooted_type = ComplexType.parse(rooted_tag).force_rooted
|
|
59
|
-
@fqns = rooted_type.namespace
|
|
60
|
-
@namespace_pin = api_map.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
|
|
61
|
-
|
|
62
|
-
api_map.get_includes(fqns).reverse.each do |include_tag|
|
|
63
|
-
process_include include_tag
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
private
|
|
68
|
-
|
|
69
|
-
attr_reader :api_map, :rooted_tag, :rooted_type, :scope,
|
|
70
|
-
:visibility, :deep, :skip, :namespace_pin,
|
|
71
|
-
:fqns
|
|
72
|
-
|
|
73
|
-
# @param include_tag [Pin::Reference::Include] the include reference pin
|
|
74
|
-
#
|
|
75
|
-
# @return [void]
|
|
76
|
-
def process_include include_tag
|
|
77
|
-
rooted_include_tag = api_map.dereference(include_tag)
|
|
78
|
-
return if rooted_include_tag.nil?
|
|
79
|
-
logger.debug do
|
|
80
|
-
"ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
|
|
81
|
-
"Handling class include include_tag=#{include_tag}"
|
|
82
|
-
end
|
|
83
|
-
module_extends = api_map.get_extends(rooted_include_tag).map(&:type).map(&:to_s)
|
|
84
|
-
logger.debug do
|
|
85
|
-
"ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
|
|
86
|
-
"found module extends of #{rooted_include_tag}: #{module_extends}"
|
|
87
|
-
end
|
|
88
|
-
return unless module_extends.include? 'ActiveSupport::Concern'
|
|
89
|
-
included_class_pins = api_map.inner_get_methods_from_reference(rooted_include_tag, namespace_pin, rooted_type,
|
|
90
|
-
:class, visibility, deep, skip, true)
|
|
91
|
-
logger.debug do
|
|
92
|
-
"ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
|
|
93
|
-
"Found #{included_class_pins.length} inluded class methods for #{rooted_include_tag}"
|
|
94
|
-
end
|
|
95
|
-
environ.pins.concat included_class_pins
|
|
96
|
-
# another pattern is to put class methods inside a submodule
|
|
97
|
-
classmethods_include_tag = "#{rooted_include_tag}::ClassMethods"
|
|
98
|
-
included_classmethods_pins =
|
|
99
|
-
api_map.inner_get_methods_from_reference(classmethods_include_tag, namespace_pin, rooted_type,
|
|
100
|
-
:instance, visibility, deep, skip, true)
|
|
101
|
-
logger.debug do
|
|
102
|
-
"ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
|
|
103
|
-
"Found #{included_classmethods_pins.length} included classmethod " \
|
|
104
|
-
"class methods for #{classmethods_include_tag}"
|
|
105
|
-
end
|
|
106
|
-
environ.pins.concat included_classmethods_pins
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
module DataDefinition
|
|
6
|
-
# A node wrapper for a Data definition via const assignment.
|
|
7
|
-
# @example
|
|
8
|
-
# MyData = Data.new(:bar, :baz) do
|
|
9
|
-
# def foo
|
|
10
|
-
# end
|
|
11
|
-
# end
|
|
12
|
-
class DataAssignmentNode < DataDefintionNode
|
|
13
|
-
class << self
|
|
14
|
-
# @example
|
|
15
|
-
# s(:casgn, nil, :Foo,
|
|
16
|
-
# s(:block,
|
|
17
|
-
# s(:send,
|
|
18
|
-
# s(:const, nil, :Data), :define,
|
|
19
|
-
# s(:sym, :bar),
|
|
20
|
-
# s(:sym, :baz)),
|
|
21
|
-
# s(:args),
|
|
22
|
-
# s(:def, :foo,
|
|
23
|
-
# s(:args),
|
|
24
|
-
# s(:send, nil, :bar))))
|
|
25
|
-
# @param node [::Parser::AST::Node]
|
|
26
|
-
def match? node
|
|
27
|
-
return false unless node&.type == :casgn
|
|
28
|
-
return false if node.children[2].nil?
|
|
29
|
-
|
|
30
|
-
data_node = if node.children[2].type == :block
|
|
31
|
-
node.children[2].children[0]
|
|
32
|
-
else
|
|
33
|
-
node.children[2]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
data_definition_node?(data_node)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def class_name
|
|
41
|
-
if node.children[0]
|
|
42
|
-
Parser::NodeMethods.unpack_name(node.children[0]) + "::#{node.children[1]}"
|
|
43
|
-
else
|
|
44
|
-
node.children[1].to_s
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
# @return [Parser::AST::Node]
|
|
51
|
-
def data_node
|
|
52
|
-
if node.children[2].type == :block
|
|
53
|
-
node.children[2].children[0]
|
|
54
|
-
else
|
|
55
|
-
node.children[2]
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
module DataDefinition
|
|
6
|
-
# A node wrapper for a Data definition via inheritance.
|
|
7
|
-
# @example
|
|
8
|
-
# class MyData < Data.new(:bar, :baz)
|
|
9
|
-
# def foo
|
|
10
|
-
# end
|
|
11
|
-
# end
|
|
12
|
-
class DataDefintionNode
|
|
13
|
-
class << self
|
|
14
|
-
# @example
|
|
15
|
-
# s(:class,
|
|
16
|
-
# s(:const, nil, :Foo),
|
|
17
|
-
# s(:send,
|
|
18
|
-
# s(:const, nil, :Data), :define,
|
|
19
|
-
# s(:sym, :bar),
|
|
20
|
-
# s(:sym, :baz)),
|
|
21
|
-
# s(:hash,
|
|
22
|
-
# s(:pair,
|
|
23
|
-
# s(:sym, :keyword_init),
|
|
24
|
-
# s(:true)))),
|
|
25
|
-
# s(:def, :foo,
|
|
26
|
-
# s(:args),
|
|
27
|
-
# s(:send, nil, :bar)))
|
|
28
|
-
#
|
|
29
|
-
# @param node [Parser::AST::Node]
|
|
30
|
-
def match? node
|
|
31
|
-
return false unless node&.type == :class
|
|
32
|
-
|
|
33
|
-
data_definition_node?(node.children[1])
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
# @param data_node [Parser::AST::Node]
|
|
39
|
-
# @return [Boolean]
|
|
40
|
-
def data_definition_node? data_node
|
|
41
|
-
return false unless data_node.is_a?(::Parser::AST::Node)
|
|
42
|
-
return false unless data_node&.type == :send
|
|
43
|
-
return false unless data_node.children[0]&.type == :const
|
|
44
|
-
return false unless data_node.children[0].children[1] == :Data
|
|
45
|
-
return false unless data_node.children[1] == :define
|
|
46
|
-
|
|
47
|
-
true
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# @param node [Parser::AST::Node]
|
|
52
|
-
def initialize node
|
|
53
|
-
@node = node
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# @return [String]
|
|
57
|
-
def class_name
|
|
58
|
-
Parser::NodeMethods.unpack_name(node)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# @return [Array<Array(Parser::AST::Node, String)>]
|
|
62
|
-
def attributes
|
|
63
|
-
data_attribute_nodes.map do |data_def_param|
|
|
64
|
-
next unless data_def_param.type == :sym
|
|
65
|
-
[data_def_param, data_def_param.children[0].to_s]
|
|
66
|
-
end.compact
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# @return [Parser::AST::Node, nil]
|
|
70
|
-
def body_node
|
|
71
|
-
node.children[2]
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
private
|
|
75
|
-
|
|
76
|
-
# @return [Parser::AST::Node]
|
|
77
|
-
attr_reader :node
|
|
78
|
-
|
|
79
|
-
# @return [Parser::AST::Node, nil]
|
|
80
|
-
def data_node
|
|
81
|
-
node.children[1]
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# @sg-ignore Need to add nil check here
|
|
85
|
-
# @return [Array<Parser::AST::Node>]
|
|
86
|
-
def data_attribute_nodes
|
|
87
|
-
# @sg-ignore Need to add nil check here
|
|
88
|
-
data_node.children[2..]
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|