solargraph 0.57.0 → 0.58.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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +4 -2
  3. data/.github/workflows/plugins.yml +61 -27
  4. data/.github/workflows/rspec.yml +19 -4
  5. data/.github/workflows/typecheck.yml +2 -2
  6. data/.rubocop.yml +1 -1
  7. data/.rubocop_todo.yml +90 -1438
  8. data/CHANGELOG.md +27 -0
  9. data/Rakefile +1 -1
  10. data/bin/solargraph +8 -5
  11. data/lib/solargraph/api_map/constants.rb +107 -46
  12. data/lib/solargraph/api_map/index.rb +32 -8
  13. data/lib/solargraph/api_map/source_to_yard.rb +5 -2
  14. data/lib/solargraph/api_map/store.rb +22 -12
  15. data/lib/solargraph/api_map.rb +27 -33
  16. data/lib/solargraph/complex_type/type_methods.rb +5 -0
  17. data/lib/solargraph/complex_type/unique_type.rb +12 -5
  18. data/lib/solargraph/complex_type.rb +19 -2
  19. data/lib/solargraph/convention/active_support_concern.rb +1 -1
  20. data/lib/solargraph/convention/data_definition/data_definition_node.rb +1 -1
  21. data/lib/solargraph/diagnostics/rubocop_helpers.rb +4 -2
  22. data/lib/solargraph/doc_map.rb +9 -6
  23. data/lib/solargraph/environ.rb +1 -1
  24. data/lib/solargraph/equality.rb +1 -0
  25. data/lib/solargraph/gem_pins.rb +4 -0
  26. data/lib/solargraph/language_server/host.rb +10 -4
  27. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -2
  28. data/lib/solargraph/language_server/message/text_document/formatting.rb +4 -1
  29. data/lib/solargraph/language_server/message/text_document/type_definition.rb +1 -1
  30. data/lib/solargraph/language_server/progress.rb +1 -1
  31. data/lib/solargraph/language_server/request.rb +3 -1
  32. data/lib/solargraph/library.rb +3 -3
  33. data/lib/solargraph/location.rb +1 -0
  34. data/lib/solargraph/page.rb +0 -1
  35. data/lib/solargraph/parser/flow_sensitive_typing.rb +1 -1
  36. data/lib/solargraph/parser/parser_gem/class_methods.rb +2 -12
  37. data/lib/solargraph/parser/parser_gem/node_methods.rb +1 -14
  38. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +1 -0
  39. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +64 -8
  40. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +12 -3
  41. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +4 -5
  42. data/lib/solargraph/pin/base.rb +29 -8
  43. data/lib/solargraph/pin/base_variable.rb +5 -3
  44. data/lib/solargraph/pin/block.rb +3 -2
  45. data/lib/solargraph/pin/callable.rb +6 -2
  46. data/lib/solargraph/pin/closure.rb +3 -7
  47. data/lib/solargraph/pin/delegated_method.rb +0 -1
  48. data/lib/solargraph/pin/local_variable.rb +0 -4
  49. data/lib/solargraph/pin/method.rb +20 -4
  50. data/lib/solargraph/pin/parameter.rb +6 -2
  51. data/lib/solargraph/pin/proxy_type.rb +4 -1
  52. data/lib/solargraph/pin/reference.rb +2 -11
  53. data/lib/solargraph/pin/search.rb +3 -0
  54. data/lib/solargraph/pin_cache.rb +5 -5
  55. data/lib/solargraph/position.rb +1 -0
  56. data/lib/solargraph/range.rb +4 -0
  57. data/lib/solargraph/rbs_map/conversions.rb +22 -1
  58. data/lib/solargraph/rbs_map/core_fills.rb +18 -0
  59. data/lib/solargraph/rbs_map/core_map.rb +11 -7
  60. data/lib/solargraph/rbs_map.rb +2 -2
  61. data/lib/solargraph/shell.rb +82 -1
  62. data/lib/solargraph/source/chain/call.rb +7 -3
  63. data/lib/solargraph/source/chain/constant.rb +3 -66
  64. data/lib/solargraph/source/chain/if.rb +1 -1
  65. data/lib/solargraph/source/chain/link.rb +1 -1
  66. data/lib/solargraph/source/chain/or.rb +1 -1
  67. data/lib/solargraph/source/chain.rb +2 -0
  68. data/lib/solargraph/source.rb +1 -1
  69. data/lib/solargraph/source_map/clip.rb +17 -25
  70. data/lib/solargraph/source_map/mapper.rb +0 -2
  71. data/lib/solargraph/source_map.rb +8 -3
  72. data/lib/solargraph/type_checker/rules.rb +23 -9
  73. data/lib/solargraph/type_checker.rb +133 -71
  74. data/lib/solargraph/version.rb +1 -1
  75. data/lib/solargraph/workspace/config.rb +21 -3
  76. data/lib/solargraph/workspace/require_paths.rb +0 -1
  77. data/lib/solargraph/workspace.rb +14 -19
  78. data/lib/solargraph/yard_map/mapper/to_method.rb +2 -1
  79. data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -0
  80. data/lib/solargraph/yard_map/to_method.rb +2 -1
  81. data/lib/solargraph/yardoc.rb +27 -4
  82. data/rbs/fills/bundler/0/bundler.rbs +4271 -0
  83. data/rbs/fills/open3/0/open3.rbs +172 -0
  84. data/rbs/fills/rubygems/0/basic_specification.rbs +326 -0
  85. data/rbs/fills/rubygems/0/errors.rbs +364 -0
  86. data/rbs/fills/rubygems/0/spec_fetcher.rbs +107 -0
  87. data/rbs/fills/rubygems/0/specification.rbs +1753 -0
  88. data/rbs_collection.yaml +4 -4
  89. data/sig/shims/ast/0/node.rbs +5 -0
  90. data/sig/shims/ast/2.4/.rbs_meta.yaml +9 -0
  91. data/sig/shims/ast/2.4/ast.rbs +73 -0
  92. data/sig/shims/parser/3.2.0.1/manifest.yaml +7 -0
  93. data/sig/shims/parser/3.2.0.1/parser.rbs +201 -0
  94. data/sig/shims/parser/3.2.0.1/polyfill.rbs +4 -0
  95. data/solargraph.gemspec +15 -4
  96. metadata +66 -12
  97. data/lib/solargraph/parser/node_methods.rb +0 -97
  98. /data/rbs/fills/{tuple.rbs → tuple/tuple.rbs} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 808ec792a7de32df74b885ebf3785cac0b2d09d9c469696e53215423e28f0ede
4
- data.tar.gz: e01f07f0524fc59c05f4dbc1fe59126000b22ac7870d356291ebb53bf1de10af
3
+ metadata.gz: e56c80fcd3d09dfa44076f993bc9b9109499f5aca4453b2bec161257161791d6
4
+ data.tar.gz: e1063c87d37ac58f04cf790e40e6e01b5044d74ab2fa102b1a80a133ad47111b
5
5
  SHA512:
6
- metadata.gz: 450a8f89225f836bc720f0a79ff87a099c3a1ae141b683d60415fc9634a064decfdb187a21e9587043df4c598bb57608103d470b465103914152022d3833b8e9
7
- data.tar.gz: efa9b1ee5b59c2b42ca9bd3a33b709422720111dac01a9073929c247a390f861997fa507d4fc03567ab3df386eca82c8931cb0c7a59fa6d7be33720d9e5e4188
6
+ metadata.gz: c4bf24a5265c55ce29e24ae70fd5504250aec4f684b7f2aa220ed96292feda346ad0d0ad9116399a59a57ae69e6846b8cca6b5ee7946690fa49a34b90777b913
7
+ data.tar.gz: d4c04335686f8d5af07fa7b0a581e96c197ad605bdd4b5a5eeb5fd41fe4ddca8c14a89b19c4b0acf5257909d2e45864929aacaf98d19c6459109f815a383c5b1
@@ -115,11 +115,13 @@ jobs:
115
115
  - name: Run RuboCop against todo file
116
116
  continue-on-error: true
117
117
  run: |
118
- bundle exec rubocop --auto-gen-config --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp
118
+ cmd="bundle exec rubocop --auto-gen-config --exclude-limit=5 --no-offense-counts --no-auto-gen-timestamp"
119
+ ${cmd:?}
120
+ set +e
119
121
  if [ -n "$(git status --porcelain)" ]
120
122
  then
121
123
  git status --porcelain
122
124
  git diff -u .
123
- >&2 echo "Please fix deltas if bad or run 'bundle exec rubocop --auto-gen-config --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp' and push up changes if good"
125
+ >&2 echo "Please address any new issues, then run '${cmd:?}' and push up any improvements"
124
126
  exit 1
125
127
  fi
@@ -23,7 +23,7 @@ jobs:
23
23
  - name: Set up Ruby
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
26
- ruby-version: '3.0'
26
+ ruby-version: 3.4
27
27
  bundler-cache: true
28
28
  - uses: awalsh128/cache-apt-pkgs-action@latest
29
29
  with:
@@ -54,7 +54,7 @@ jobs:
54
54
  - name: Set up Ruby
55
55
  uses: ruby/setup-ruby@v1
56
56
  with:
57
- ruby-version: '3.0'
57
+ ruby-version: 3.4
58
58
  bundler-cache: false
59
59
  - uses: awalsh128/cache-apt-pkgs-action@latest
60
60
  with:
@@ -83,7 +83,7 @@ jobs:
83
83
  - name: Set up Ruby
84
84
  uses: ruby/setup-ruby@v1
85
85
  with:
86
- ruby-version: '3.0'
86
+ ruby-version: 3.4
87
87
  bundler-cache: false
88
88
  - uses: awalsh128/cache-apt-pkgs-action@latest
89
89
  with:
@@ -105,30 +105,64 @@ jobs:
105
105
  - name: Ensure specs still run
106
106
  run: bundle exec rake spec
107
107
 
108
- # run_solargraph_rspec_specs:
109
- # # check out solargraph-rspec as well as this project, and point the former to use the latter as a local gem
110
- # runs-on: ubuntu-latest
111
- # steps:
112
- # - uses: actions/checkout@v3
113
- # - name: clone https://github.com/lekemula/solargraph-rspec/
114
- # run: |
115
- # cd ..
116
- # git clone https://github.com/lekemula/solargraph-rspec.git
117
- # cd solargraph-rspec
118
- # - name: Set up Ruby
119
- # uses: ruby/setup-ruby@v1
120
- # with:
121
- # ruby-version: '3.0'
122
- # bundler-cache: false
123
- # - name: Install gems
124
- # run: |
125
- # cd ../solargraph-rspec
126
- # echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
127
- # bundle install
128
- # - name: Run specs
129
- # run: |
130
- # cd ../solargraph-rspec
131
- # bundle exec rake spec
108
+ run_solargraph_rspec_specs:
109
+ # check out solargraph-rspec as well as this project, and point the former to use the latter as a local gem
110
+ runs-on: ubuntu-latest
111
+ env:
112
+ SOLARGRAPH_CACHE: ${{ github.workspace }}/../solargraph-rspec/vendor/solargraph/cache
113
+ BUNDLE_PATH: ${{ github.workspace }}/../solargraph-rspec/vendor/bundle
114
+ steps:
115
+ - uses: actions/checkout@v3
116
+ - name: clone https://github.com/lekemula/solargraph-rspec/
117
+ run: |
118
+ cd ..
119
+ # git clone https://github.com/lekemula/solargraph-rspec.git
120
+
121
+ # pending https://github.com/lekemula/solargraph-rspec/pull/30
122
+ git clone https://github.com/apiology/solargraph-rspec.git
123
+ cd solargraph-rspec
124
+ git checkout reset_closures
125
+ - name: Set up Ruby
126
+ uses: ruby/setup-ruby@v1
127
+ with:
128
+ ruby-version: '3.1'
129
+ rubygems: latest
130
+ bundler-cache: false
131
+ - name: Install gems
132
+ run: |
133
+ set -x
134
+
135
+ cd ../solargraph-rspec
136
+ echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
137
+ bundle config path ${{ env.BUNDLE_PATH }}
138
+ bundle install --jobs 4 --retry 3
139
+ bundle exec appraisal install
140
+ # @todo some kind of appraisal/bundle conflict?
141
+ # https://github.com/castwide/solargraph/actions/runs/19038710934/job/54369767122?pr=1116
142
+ # /home/runner/work/solargraph/solargraph-rspec/vendor/bundle/ruby/3.1.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:317:in
143
+ # `check_for_activated_spec!': You have already activated date
144
+ # 3.5.0, but your Gemfile requires date 3.4.1. Prepending
145
+ # `bundle exec` to your command may solve
146
+ # this. (Gem::LoadError)
147
+ bundle exec appraisal update date
148
+ # For some reason on ruby 3.1 it defaults to an old version: 1.3.2
149
+ # https://github.com/lekemula/solargraph-rspec/actions/runs/17814581205/job/50645370316?pr=22
150
+ # We update manually to the latest
151
+ bundle exec appraisal update rspec-rails
152
+ - name: Configure .solargraph.yml
153
+ run: |
154
+ cd ../solargraph-rspec
155
+ cp .solargraph.yml.example .solargraph.yml
156
+ - name: Solargraph generate RSpec gems YARD and RBS pins
157
+ run: |
158
+ cd ../solargraph-rspec
159
+ bundle exec appraisal rbs collection update
160
+ rspec_gems=$(bundle exec appraisal ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
161
+ bundle exec appraisal solargraph gems $rspec_gems
162
+ - name: Run specs
163
+ run: |
164
+ cd ../solargraph-rspec
165
+ bundle exec appraisal rspec --format progress
132
166
 
133
167
  run_solargraph_rails_specs:
134
168
  # check out solargraph-rails as well as this project, and point the former to use the latter as a local gem
@@ -21,20 +21,30 @@ jobs:
21
21
  runs-on: ubuntu-latest
22
22
  strategy:
23
23
  matrix:
24
- ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'head']
25
- rbs-version: ['3.6.1', '3.9.4', '4.0.0.dev.4']
24
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
25
+ rbs-version: ['3.6.1', '3.9.5', '4.0.0.dev.4']
26
26
  # Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
27
27
  exclude:
28
28
  - ruby-version: '3.0'
29
- rbs-version: '3.9.4'
29
+ rbs-version: '3.9.5'
30
30
  - ruby-version: '3.0'
31
31
  rbs-version: '4.0.0.dev.4'
32
+ # Missing require in 'rbs collection update' - hopefully
33
+ # fixed in next RBS release
34
+ - ruby-version: '4.0'
35
+ rbs-version: '3.6.1'
36
+ - ruby-version: '4.0'
37
+ rbs-version: '4.0.0.dev.4'
32
38
  steps:
33
39
  - uses: actions/checkout@v3
34
40
  - name: Set up Ruby
35
41
  uses: ruby/setup-ruby@v1
36
42
  with:
37
43
  ruby-version: ${{ matrix.ruby-version }}
44
+ # see https://github.com/castwide/solargraph/actions/runs/19391419903/job/55485410493?pr=1119
45
+ #
46
+ # match version in Gemfile.lock and use same version below
47
+ bundler: 2.5.23
38
48
  bundler-cache: false
39
49
  - name: Set rbs version
40
50
  run: echo "gem 'rbs', '${{ matrix.rbs-version }}'" >> .Gemfile
@@ -46,8 +56,13 @@ jobs:
46
56
  run: echo "gem 'tsort'" >> .Gemfile
47
57
  - name: Install gems
48
58
  run: |
49
- bundle install
59
+ bundle _2.5.23_ install
50
60
  bundle update rbs # use latest available for this Ruby version
61
+ bundle list
62
+ bundle exec solargraph pin 'Bundler::Dsl#source'
63
+ - name: Update types
64
+ run: |
65
+ bundle exec rbs collection update
51
66
  - name: Run tests
52
67
  run: bundle exec rake spec
53
68
  undercover:
@@ -18,7 +18,7 @@ permissions:
18
18
 
19
19
  jobs:
20
20
  solargraph_typed:
21
- name: Solargraph / typed
21
+ name: Solargraph / strong
22
22
 
23
23
  runs-on: ubuntu-latest
24
24
 
@@ -36,4 +36,4 @@ jobs:
36
36
  - name: Install gem types
37
37
  run: bundle exec rbs collection install
38
38
  - name: Typecheck self
39
- run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level typed
39
+ run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong
data/.rubocop.yml CHANGED
@@ -21,6 +21,7 @@ AllCops:
21
21
  - "vendor/**/.*"
22
22
  TargetRubyVersion: 3.0
23
23
 
24
+ # We don't use the spec/solargraph directory
24
25
  RSpec/SpecFilePathFormat:
25
26
  Enabled: false
26
27
 
@@ -37,7 +38,6 @@ Metrics/ParameterLists:
37
38
  Max: 7
38
39
  CountKeywordArgs: false
39
40
 
40
-
41
41
  # we tend to use @@ and the risk doesn't seem high
42
42
  Style/ClassVars:
43
43
  Enabled: false