Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
452 commits
Select commit Hold shift + click to select a range
c6f5206
Restore removed code
apiology Jul 26, 2025
c2807b1
Fix reference
apiology Jul 28, 2025
3a43053
Fix Ruby 3.0+RBS 3.6.1 yaml issue
apiology Jul 28, 2025
a481c80
Test Thor.desc lookup, fix rbs_collection_pins_path issue
apiology Jul 28, 2025
c03266e
Work around an overcommit glitch
apiology Jul 28, 2025
ed5381f
Drop offense counts for easier mitigation
apiology Jul 28, 2025
2004d99
Merge branch 'linting' into improve_pin_caching
apiology Jul 28, 2025
0eeef79
Deal with a potential nil case from CI
apiology Jul 28, 2025
624ffa1
Deal with a potential nil case from CI
apiology Jul 28, 2025
53c8354
Look for external requires before cataloging bench
apiology Jul 28, 2025
581cc02
Ensure backport is pre-cached
apiology Jul 28, 2025
9bef39f
Merge branch 'catalog_issue' into improve_pin_caching
apiology Jul 28, 2025
200d198
Only cache combined pins in memory
apiology Jul 28, 2025
cd1306d
More specs
apiology Jul 28, 2025
d730fad
Revert accidental formatting change
apiology Jul 28, 2025
0deb8cf
Drop unused method
apiology Jul 28, 2025
a812069
Add RBS collection types during tests
apiology Jul 28, 2025
09958f4
More specs
apiology Jul 28, 2025
df609a6
Revert double quote changes for another PR
apiology Jul 28, 2025
cda38ed
Revert double quote changes for another PR
apiology Jul 28, 2025
da927a6
Revert double quote changes for another PR
apiology Jul 28, 2025
c8aa61f
Revert double quote changes for another PR
apiology Jul 28, 2025
e1665fe
Revert double quote changes for another PR
apiology Jul 28, 2025
edcfc69
Revert double quote changes for another PR
apiology Jul 28, 2025
b7af775
Revert double quote changes for another PR
apiology Jul 28, 2025
027c774
Revert double quote changes for another PR
apiology Jul 28, 2025
9c3f0b4
Revert double quote changes for another PR
apiology Jul 28, 2025
bf74041
More specs
apiology Jul 29, 2025
bbce86b
Add spec
apiology Jul 29, 2025
81d91ed
Try to reproduce CI issue
apiology Jul 29, 2025
4a6ef4f
Disable testing against head
apiology Jul 29, 2025
0268ef1
Drop dead code
apiology Jul 29, 2025
73821ee
Drop unintended change
apiology Jul 29, 2025
8564aec
Drop no-longer-needed line
apiology Jul 29, 2025
fb988a2
Try abbrev instead of cgi in spec
apiology Jul 29, 2025
2ea23a6
Drop unneeded error handling
apiology Jul 29, 2025
594bd26
More specs
apiology Jul 29, 2025
d381ba7
More specs
apiology Jul 29, 2025
b534c02
Fix pin caching
apiology Jul 29, 2025
17fe05f
Rebaseline rubocop todo
apiology Jul 29, 2025
af0e537
Try again with logger, which is formally in the gemspec as a
apiology Jul 29, 2025
05b6867
Drop un-needed new code
apiology Jul 29, 2025
715274f
Rebaseline rubocop todo
apiology Jul 29, 2025
373063b
Another spec
apiology Jul 29, 2025
79ffb59
Improve coverage
apiology Jul 29, 2025
70d6365
Another spec
apiology Jul 29, 2025
17be263
Another spec
apiology Jul 29, 2025
e286fa5
More specs
apiology Jul 29, 2025
4e76133
Fix spec
apiology Jul 29, 2025
84ca5a3
Fix example in spec
apiology Jul 30, 2025
2a8f62a
Document gems command
apiology Jul 31, 2025
834e5d9
Improve test speed
apiology Aug 3, 2025
4558a10
Fix up .rubocop_todo.yml
apiology Aug 3, 2025
1bf5a44
Add mocking to spec for reliability
apiology Aug 4, 2025
990cf2f
Revert kwarg change on method used by (specs in) solargraph-rails
apiology Aug 4, 2025
daec55a
Revert kwarg change on method used by (specs in) solargraph-rails
apiology Aug 4, 2025
24cd253
More specs
apiology Aug 4, 2025
bf430f0
Catch potential bad-path issue
apiology Aug 4, 2025
67d3f94
Drop bad line
apiology Aug 4, 2025
17883a2
Fix call to ApiMap
apiology Aug 4, 2025
0cf4006
Test error andler
apiology Aug 4, 2025
8a045e2
Drop blank line
apiology Aug 4, 2025
dc4f82f
Tweak timeout in spec
apiology Aug 5, 2025
2bf7f31
Move away from Set due to Ruby 3.0 failure
apiology Aug 5, 2025
5c83d0f
Add new RuboCop failure from new RuboCop
apiology Aug 5, 2025
03f2e87
Merge remote-tracking branch 'castwide/master' into improve_pin_caching
apiology Aug 19, 2025
9d3800b
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Aug 19, 2025
cf532b6
Ratchet rubocop todo file
apiology Aug 19, 2025
07e8fde
Bump pin caching
apiology Aug 19, 2025
30c2831
Drop .pryrc from file
apiology Aug 19, 2025
c208f5c
Drop dead code
apiology Aug 19, 2025
eb25912
Debug
apiology Aug 19, 2025
81f6b1c
Ensure rbs collection update is run in rspec tests
apiology Aug 19, 2025
dbacbe5
Exclude a test combination
apiology Aug 19, 2025
09062ce
Update excluded scenarios
apiology Aug 19, 2025
35ff86b
Fix missing coverage
apiology Aug 19, 2025
542bcb7
Fix spec
apiology Aug 19, 2025
b0f0517
Debug
apiology Aug 19, 2025
68b294a
Debug
apiology Aug 19, 2025
c268973
Fix rspec integration
apiology Aug 20, 2025
6abaefc
Another solargraph-rspec fix
apiology Aug 20, 2025
98ec2eb
Handle BundleNotFoundError
apiology Aug 20, 2025
2e3b867
Use rspec-time-guard to debug slow specs
apiology Aug 20, 2025
d20e1d9
Fix spec glitches
apiology Aug 20, 2025
629ee5b
Bump timeout on spec
apiology Aug 20, 2025
2671de5
Avoid using operator- on Gem::Specification
apiology Aug 20, 2025
d118208
Fix typechecking issue
apiology Aug 20, 2025
d167731
Debug specs
apiology Aug 20, 2025
0dc01e4
Fix issue with not being in directory workspace
apiology Aug 20, 2025
c615ce9
Fix linting issue
apiology Aug 20, 2025
62e00ea
Fix invalid spec
apiology Aug 20, 2025
8672a5e
Fix time limit
apiology Aug 20, 2025
5d27b40
Fix expectations in face of solargraph-rspec requires
apiology Aug 20, 2025
8e3c148
Ratchet rubocop todo file
apiology Aug 20, 2025
f505318
Fix spec bug
apiology Aug 20, 2025
65843fd
Debug spec failure
apiology Aug 20, 2025
cb0178b
Reproduce bug with spec
apiology Aug 20, 2025
5844b75
Restore test command
apiology Aug 20, 2025
585f914
Add explicit reset_pins! method
apiology Aug 21, 2025
ddca860
Revert formatting
apiology Aug 21, 2025
0082b43
Revert run tests command
apiology Aug 21, 2025
40bdb5a
Fix annotation
apiology Aug 21, 2025
390aed2
Cache global environ pins
apiology Aug 21, 2025
4ee8c00
Add convention-based requires more lazily
apiology Aug 21, 2025
a66e738
Merge branch 'master' into improve_pin_caching
apiology Aug 21, 2025
c2d1674
Rely on workspace to own global environ
apiology Aug 21, 2025
25624dc
Rely on workspace to own global environ
apiology Aug 21, 2025
14bdb8c
Ratchet .rubocop_todo.yml
apiology Aug 21, 2025
a16fcc1
Fix specs
apiology Aug 21, 2025
247c139
Time rspec and rails plugins separately
apiology Aug 21, 2025
bd8e64d
Fix syntax
apiology Aug 21, 2025
fdf9c7d
Add to unprovided solargraph-rspec requires
apiology Aug 21, 2025
0e3db3c
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Aug 25, 2025
767d3d2
Debug CI failure
apiology Aug 25, 2025
8772f06
Fix syntax
apiology Aug 25, 2025
3f363e5
RuboCop fixes
apiology Aug 25, 2025
11ec2dd
Spec timeout adjustment
apiology Aug 25, 2025
5996f75
Fix crash while generating activesupport pins
apiology Aug 28, 2025
00e50b2
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Aug 29, 2025
10e3a48
Lengthen timeout on spec
apiology Aug 29, 2025
07793d7
Fix merge
apiology Aug 29, 2025
826c2eb
Fix merge
apiology Aug 29, 2025
3ba525a
Fix merge
apiology Aug 29, 2025
ea4a3c9
Fix type issue
apiology Aug 29, 2025
e1dbd8f
Merge remote-tracking branch 'origin/master' into invalid_types_as_su…
apiology Aug 29, 2025
e87c8e6
Fix merge issue
apiology Aug 29, 2025
e41023d
Fix merge issue
apiology Aug 29, 2025
e2b0acb
Merge branch 'invalid_types_as_superclass_cases' into improve_pin_cac…
apiology Aug 29, 2025
d0caf44
Rebaseline .rubocop_todo.yml
apiology Aug 29, 2025
6acfa0c
RuboCop todo file stability
apiology Aug 30, 2025
14be6bf
Merge remote-tracking branch 'origin/master' into rubocop_stability
apiology Aug 30, 2025
61260f3
Fix merge issue
apiology Aug 30, 2025
8cca178
Fix comment skew
apiology Aug 30, 2025
7fc5fcd
Annotation fixes for strong typechecking
apiology Aug 31, 2025
b3f3910
Expand time limit on slow spec
apiology Aug 31, 2025
f623a73
Pull in overcommit fix
apiology Sep 1, 2025
a8b678b
Add spec
apiology Sep 1, 2025
56546f5
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Sep 1, 2025
8a25804
Tweak some time limits
apiology Sep 1, 2025
8e51c1a
Merge branch 'overcommit_yardoc_bundle_fix' into improve_pin_caching
apiology Sep 1, 2025
e4e4091
Another set of @sg-ignores
apiology Sep 1, 2025
d574026
Type fixes
apiology Sep 1, 2025
d927212
Revert
apiology Sep 1, 2025
79038e5
Fix missing method
apiology Sep 2, 2025
5658f30
Understand "Parser::AST::Node < AST::Node" in RBS
apiology Sep 2, 2025
e8672b0
Fix spec expectation
apiology Sep 2, 2025
8a8f20c
Mark spec as pending
apiology Sep 2, 2025
fe5a35f
Fix merge
apiology Sep 2, 2025
ed5d2de
Drop @sg-ignores
apiology Sep 2, 2025
d58720a
Merge branch 'type_annotation_fixes_2025' into improve_pin_caching
apiology Sep 2, 2025
83dfd67
Improve more annotations
apiology Sep 2, 2025
857dff3
Add @sg-ignore
apiology Sep 2, 2025
866bd38
More annotation cleanups / fixes
apiology Sep 2, 2025
ae56366
Fix typo
apiology Sep 2, 2025
e27fa19
Merge branch 'type_annotation_fixes_2025' into improve_pin_caching
apiology Sep 2, 2025
1bfe80e
Merge branch 'node' into improve_pin_caching
apiology Sep 2, 2025
d16301d
Revert workaround
apiology Sep 2, 2025
43e1752
Drop alias lookup code
apiology Sep 2, 2025
cd0a23c
Fix merge
apiology Sep 2, 2025
5c90bbc
Fix long line
apiology Sep 2, 2025
bbff724
Merge branch 'type_annotation_fixes_2025' into improve_pin_caching
apiology Sep 2, 2025
06e0c07
Lint fixes
apiology Sep 2, 2025
383605f
Drop unneeded change
apiology Sep 2, 2025
eafa965
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Sep 3, 2025
14c1fe7
Fix comment
apiology Sep 4, 2025
efbe6ed
Fix merge issue
apiology Sep 4, 2025
8edc773
Merge remote-tracking branch 'origin/master' into rubocop_stability
apiology Sep 6, 2025
bb0f607
Rerun rubocop todo
apiology Sep 6, 2025
8bf9628
Merge branch 'rubocop_stability' into improve_pin_caching
apiology Sep 7, 2025
66f44dc
Fix RuboCop issues
apiology Sep 7, 2025
7c60506
Resolve merge issue
apiology Sep 7, 2025
1241c17
Resolve merge issue
apiology Sep 7, 2025
184f2e6
Resolve merge issue
apiology Sep 7, 2025
04dd24d
Resolve merge issue
apiology Sep 7, 2025
837d7f6
Force build
apiology Sep 7, 2025
a4208e7
Restore
apiology Sep 7, 2025
f08b76a
Merge remote-tracking branch 'origin/master' into fix_solargraph_rspe…
apiology Sep 7, 2025
b66f2ac
install -> update with rbs collection
apiology Sep 7, 2025
a09a9af
Try Ruby 3.2
apiology Sep 7, 2025
6fc8feb
Update solargraph
apiology Sep 7, 2025
388c170
Re-add bundle install
apiology Sep 7, 2025
f80b73a
Drop MATRIX_SOLARGRAPH_VERSION
apiology Sep 7, 2025
ce2bee6
Drop debugging changes
apiology Sep 7, 2025
c261704
Merge remote-tracking branch 'origin/master' into rubocop_stability
apiology Sep 7, 2025
dbe9a3e
Update expectations from master branch
apiology Sep 7, 2025
620fa00
Merge branch 'fix_solargraph_rspec_check' into rubocop_stability
apiology Sep 7, 2025
f2fa512
Merge branch 'rubocop_stability' into improve_pin_caching
apiology Sep 7, 2025
50c8e0a
Drop clutter from diff
apiology Sep 8, 2025
2b02f98
Fix bug
apiology Sep 8, 2025
925b259
Reduce small diffs
apiology Sep 8, 2025
451998f
Fix merge mistake
apiology Sep 8, 2025
60404b2
Drop small diff
apiology Sep 8, 2025
deefea7
Drop small diff
apiology Sep 8, 2025
462d836
Revert unrelated small changes
apiology Sep 8, 2025
098424d
Revert unrelated small changes
apiology Sep 8, 2025
f08f8ff
Fix combined gem cache implementation
apiology Sep 9, 2025
802bccc
Fix quoting in shell_spec.rb
apiology Sep 9, 2025
db71d61
Fix solargraph scan issue
apiology Sep 9, 2025
bf7335d
rubocop todo fixes
apiology Sep 9, 2025
dba134d
Update time limits
apiology Sep 9, 2025
f22f21a
Handle Ruby 3.0 issue
apiology Sep 9, 2025
80c5fcc
Drop unbundled environment
apiology Sep 9, 2025
ca488e2
Drop unbundled environment
apiology Sep 9, 2025
10a1574
Revert marginal changes
apiology Sep 9, 2025
5f7df18
Remove unrelated changes
apiology Sep 9, 2025
14772df
Revert not-actually-needed Location change
apiology Sep 10, 2025
03443a4
Revert spec change
apiology Sep 11, 2025
78d630d
Revert spec change
apiology Sep 11, 2025
5ac0a89
Reduce diff
apiology Sep 11, 2025
65a6911
Reduce diff
apiology Sep 11, 2025
844e1b6
Merge branch 'master' into improve_pin_caching
apiology Sep 14, 2025
de438dd
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Sep 30, 2025
a971609
Fix merge issues
apiology Sep 30, 2025
988f9f6
Test fixups now that we get more gems installed for types
apiology Sep 30, 2025
17578db
Adjust TODO
apiology Oct 7, 2025
95ed300
Avoid rbs pollution (#1146)
apiology Jan 13, 2026
ce12a5f
Fix 'solargraph pin --references ClassName' private method call (#1150)
apiology Jan 13, 2026
5ae5558
Improve memory efficiency of Position class (#1054)
lekemula Jan 14, 2026
4c05f28
Raise InvalidOffsetError for offsets > text (#1155)
castwide Jan 14, 2026
676da4c
Release 0.58.2
castwide Jan 19, 2026
f83cb32
Quick fix
apiology Jan 27, 2026
2e8140c
Merge in master branch
apiology Jan 27, 2026
9e228a6
Merge in master branch
apiology Jan 27, 2026
4050fbd
Merge remote-tracking branch 'origin/master' into improve_pin_caching
apiology Jan 27, 2026
317ca56
Fix merge
apiology Jan 27, 2026
d395c5f
Fix merge
apiology Jan 27, 2026
f9b6e1a
Add annotatins
apiology Jan 27, 2026
321193a
Add @sg-ignores
apiology Jan 27, 2026
86cf428
Add @sg-ignores
apiology Jan 27, 2026
b941021
Bring in plugin fixes from v0.59
apiology Jan 27, 2026
aa8a153
Bring in typecheck fixes from v0.59
apiology Jan 27, 2026
9156036
Drop sg-ignores
apiology Jan 27, 2026
12e17e5
Bring in plugins from dev branch
apiology Jan 27, 2026
a4bf04e
Drop sg-ignore
apiology Jan 27, 2026
675a1c0
Fix annotation
apiology Jan 27, 2026
5e341df
Merge branch 'v0.59' into improve_pin_caching
apiology Jan 27, 2026
880057b
Fix tag
apiology Jan 28, 2026
16c56be
Cleanups
apiology Jan 28, 2026
20a5195
Revert
apiology Jan 28, 2026
065b186
Drop code based on spec
apiology Jan 28, 2026
4267b03
Fix spec
apiology Jan 28, 2026
524c627
Add prism require back
apiology Jan 28, 2026
3f60d96
Restore annotation
apiology Jan 28, 2026
6726e73
Drop @type
apiology Jan 28, 2026
499f382
Drop annotation
apiology Jan 28, 2026
d6bc633
Drop @todo
apiology Jan 28, 2026
d567e08
Add @sg-ignore
apiology Jan 28, 2026
e20039a
Fix spec
apiology Jan 28, 2026
f07771a
Merge remote-tracking branch 'castwide/v0.59' into improve_pin_caching
apiology Mar 2, 2026
364c6b2
Add rspec-time-guard dep
apiology Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lib/solargraph/doc_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class DocMap
# @return [Workspace]
attr_reader :workspace

# @return [Environ]
attr_reader :environ

# @param requires [Array<String>]
# @param workspace [Workspace, nil]
# @param out [IO, nil] output stream for logging
Expand Down
6 changes: 3 additions & 3 deletions lib/solargraph/gem_pins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def self.combine_method_pins(*pins)
out
end

# @param yard_pins [Array<Pin::Base>]
# @param rbs_pins [Array<Pin::Base>]
# @param yard_pins [Array<Pin::Method>]
# @param rbs_pins [Array<Pin::Method>]
#
# @return [Array<Pin::Base>]
# @return [Array<Pin::Method>]
def self.combine yard_pins, rbs_pins
in_yard = Set.new
rbs_store = Solargraph::ApiMap::Store.new(rbs_pins)
Expand Down
2 changes: 1 addition & 1 deletion lib/solargraph/pin/parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def full_name
end

def reset_generated!
@return_type = nil if param_tag
@return_type = nil if param_tag && @return_type&.undefined?
super
end

Expand Down
5 changes: 3 additions & 2 deletions lib/solargraph/pin_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def lookup_rbs_version_cache_key gemspec

# @param gemspec [Gem::Specification, Bundler::LazySpecification]
# @param rbs_version_cache_key [String, nil]
# @param yard_pins [Array<Pin::Base>]
# @param rbs_collection_pins [Array<Pin::Base>]
# @param yard_pins [Array<Pin::Method>]
# @param rbs_collection_pins [Array<Pin::Method>]
# @return [void]
def cache_combined_pins gemspec, rbs_version_cache_key, yard_pins, rbs_collection_pins
combined_pins = GemPins.combine(yard_pins, rbs_collection_pins)
Expand Down Expand Up @@ -231,6 +231,7 @@ def log_cache_info gemspec,

# @param gemspec [Gem::Specification]
# @param out [StringIO, IO, nil]
#
# @return [Array<Pin::Base>]
def cache_yard_pins gemspec, out
gem_yardoc_path = yardoc_path(gemspec)
Expand Down
10 changes: 7 additions & 3 deletions lib/solargraph/rbs_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ def self.from_gemspec gemspec, rbs_collection_path, rbs_collection_config_path
return rbs_map if rbs_map.resolved?

# try any version of the gem in the collection
RbsMap.new(gemspec.name, nil,
rbs_collection_paths: [rbs_collection_path].compact,
rbs_collection_config_path: rbs_collection_config_path)
rbs_map = RbsMap.new(gemspec.name, nil,
rbs_collection_paths: [rbs_collection_path].compact,
rbs_collection_config_path: rbs_collection_config_path)

return rbs_map if rbs_map.resolved?

StdlibMap.new(gemspec.name)
end

# @param out [IO, nil] where to log messages
Expand Down
6 changes: 1 addition & 5 deletions lib/solargraph/workspace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ class Workspace
# @return [String]
attr_reader :directory

# @return [Array<String>]
attr_reader :gemnames
alias source_gems gemnames

# @todo Remove '' and '*' special cases
# @param directory [String]
# @param config [Config, nil]
Expand All @@ -38,7 +34,6 @@ def initialize directory = '', config = nil, server = {}
@config = config
@server = server
load_sources
@gemnames = []
require_plugins
end

Expand Down Expand Up @@ -70,6 +65,7 @@ def fetch_dependencies gemspec, out: $stderr
end

# @param require [String] The string sent to 'require' in the code to resolve, e.g. 'rails', 'bundler/require'
#
# @return [Array<Gem::Specification>, nil]
def resolve_require require
gemspecs.resolve_require(require)
Expand Down
16 changes: 15 additions & 1 deletion lib/solargraph/workspace/gemspecs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def resolve_require require
"Require path #{require} could not be resolved to a gem via find_by_path or guess of #{gem_name}"
end
end

# look ourselves just in case this is hanging out somewhere
# that find_by_path doesn't index
gemspec = all_gemspecs.find do |spec|
Expand All @@ -79,6 +78,7 @@ def resolve_require require
# @sg-ignore Translate to something flow sensitive typing understands
spec&.files&.any? { |gemspec_file| file == gemspec_file }
end

# @sg-ignore flow sensitive typing should be able to handle redefinition
return [gemspec_or_preference(gemspec)] if gemspec
end
Expand Down Expand Up @@ -125,7 +125,15 @@ def fetch_dependencies gemspec, out: $stderr
# @param runtime_dep [Gem::Dependency]
# @param deps [Hash{String => Gem::Specification}]
gem_dep_gemspecs = only_runtime_dependencies(gemspec).each_with_object(deps_so_far) do |runtime_dep, deps|
next if deps[runtime_dep.name]

Solargraph.logger.info "Adding #{runtime_dep.name} dependency for #{gemspec.name}"

dep = find_gem(runtime_dep.name, runtime_dep.requirement)
dep ||= Gem::Specification.find_by_name(runtime_dep.name, runtime_dep.requirement)
rescue Gem::MissingSpecError
dep = resolve_gem_ignoring_local_bundle runtime_dep.name, out: out
ensure
next unless dep

fetch_dependencies(dep, out: out).each { |sub_dep| deps[sub_dep.name] ||= sub_dep }
Expand Down Expand Up @@ -170,6 +178,7 @@ def to_gem_specification specish
# print time including milliseconds
self.class.gem_specification_cache[specish] ||= case specish
when Gem::Specification
# yay!
specish
when Bundler::LazySpecification
# materializing didn't work. Let's look in the local
Expand All @@ -186,6 +195,11 @@ def to_gem_specification specish
# A Bundler::StubSpecification is a Bundler::
# RemoteSpecification which ought to proxy a Gem::
# Specification
@@warned_on_gem_type ||= false
unless @@warned_on_gem_type
logger.warn "Unexpected type while resolving gem: #{specish.class}"
@@warned_on_gem_type = true
end
specish
end
# @sg-ignore Unresolved constant Gem::StubSpecification
Expand Down
1 change: 1 addition & 0 deletions solargraph.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'public_suffix', '~> 3.1'
s.add_development_dependency 'rake', '~> 13.2'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'rspec-time-guard', '~>0.2.0'
#
# very specific development-time RuboCop version patterns for CI
# stability - feel free to update in an isolated PR
Expand Down
6 changes: 3 additions & 3 deletions spec/api_map_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ class B
end
end

describe '#get_method_stack' do
describe '#get_method_stack', time_limit_seconds: 240 do
let(:out) { StringIO.new }
let(:api_map) { described_class.load_with_cache(Dir.pwd, out) }

context 'with stdlib that has vital dependencies' do
context 'with stdlib that has vital dependencies', time_limit_seconds: 240 do
let(:external_requires) { ['yaml'] }
let(:method_stack) { api_map.get_method_stack('YAML', 'safe_load', scope: :class) }

it 'handles the YAML gem aliased to Psych' do
it 'handles the YAML gem aliased to Psych', time_limit_seconds: 240 do
expect(method_stack).not_to be_empty
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/api_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@api_map = described_class.new
end

it 'returns core methods' do
it 'returns core methods', time_limit_seconds: 120 do
pins = @api_map.get_methods('String')
expect(pins.map(&:path)).to include('String#upcase')
end
Expand Down
8 changes: 0 additions & 8 deletions spec/doc_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
end
end

it 'does not warn for redundant requires' do
# Requiring 'set' is unnecessary because it's already included in core. It
# might make sense to log redundant requires, but a warning is overkill.
allow(Solargraph.logger).to receive(:warn).and_call_original
described_class.new(['set'], workspace)
expect(Solargraph.logger).not_to have_received(:warn).with(/path set/)
end

context 'when deserialization takes a while' do
let(:pre_cache) { false }
let(:requires) { ['backport'] }
Expand Down
2 changes: 1 addition & 1 deletion spec/language_server/host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def initialize(foo); end
expect(symbols).not_to be_empty
end

it 'opens a file outside of prepared libraries' do
it 'opens a file outside of prepared libraries', time_limit_seconds: 120 do
@host.prepare(File.absolute_path(File.join('spec', 'fixtures', 'workspace')))
@host.open('file:///file.rb', 'class Foo; end', 1)
symbols = @host.document_symbols('file:///file.rb')
Expand Down
2 changes: 1 addition & 1 deletion spec/language_server/protocol_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def bar baz
expect(response['result']['available']).to be_a(String)
end

it 'handles $/solargraph/documentGems' do
it 'handles $/solargraph/documentGems', time_limit_seconds: 120 do
@protocol.request '$/solargraph/documentGems', {}
response = @protocol.response
expect(response['error']).to be_nil
Expand Down
8 changes: 7 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

require 'bundler/setup'
require 'webmock/rspec'
require 'rspec_time_guard'
WebMock.disable_net_connect!(allow_localhost: true)
unless ENV['SIMPLECOV_DISABLED']
# set up lcov reporting for undercover
require 'simplecov'
require 'undercover/simplecov_formatter'

SimpleCov.start do
cname = ENV.fetch('TEST_COVERAGE_COMMAND_NAME', 'ad-hoc')
command_name cname
Expand All @@ -27,6 +27,12 @@
# Allow use of --only-failures with rspec, handy for local development
c.example_status_persistence_file_path = 'rspec-examples.txt'
end
RspecTimeGuard.setup
RspecTimeGuard.configure do |config|
config.global_time_limit_seconds = 60
config.continue_on_timeout = false
end

require 'solargraph'
# execute any logging blocks to make sure they don't blow up
Solargraph::Logging.logger.sev_threshold = Logger::DEBUG
Expand Down
4 changes: 2 additions & 2 deletions spec/workspace/gemspecs_fetch_dependencies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@
context 'with gem that exists in our bundle' do
let(:gem_name) { 'undercover' }

it 'finds dependencies' do
it 'finds dependencies', time_limit_seconds: 120 do
expect(deps.map(&:name)).to include('ast')
end
end

context 'with gem does not exist in our bundle' do
let(:gem_name) { 'activerecord' }

it 'gives a useful message' do
it 'gives a useful message', time_limit_seconds: 120 do
dep_names = nil
output = capture_both { dep_names = deps.map(&:name) }
expect(output).to include('Please install the gem activerecord')
Expand Down
17 changes: 17 additions & 0 deletions spec/workspace_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,17 @@

describe '#cache_all_for_workspace!' do
let(:pin_cache) { instance_double(Solargraph::PinCache) }
let(:gemspecs) { instance_double(Solargraph::Workspace::Gemspecs) }

before do
allow(Solargraph::PinCache).to receive(:cache_core)
allow(Solargraph::PinCache).to receive(:possible_stdlibs)
allow(Solargraph::PinCache).to receive(:new).and_return(pin_cache)
allow(pin_cache).to receive_messages(cache_gem: nil, possible_stdlibs: [])
allow(Solargraph::PinCache).to receive(:cache_all_stdlibs)
allow(Solargraph::Workspace::Gemspecs).to receive(:new).and_return(gemspecs)
gemspec = instance_double(Gem::Specification, name: 'test_gem', version: '1.0.0')
allow(gemspecs).to receive(:all_gemspecs_from_bundle).and_return([gemspec])
end

it 'caches core pins' do
Expand All @@ -166,5 +170,18 @@

expect(Solargraph::PinCache).to have_received(:cache_core).with(out: nil)
end

it 'caches gems' do
allow(pin_cache).to receive(:cached?).and_return(false)

allow(pin_cache).to receive(:cache_all_stdlibs).with(out: nil, rebuild: false)

allow(Solargraph::PinCache).to receive_messages(core?: true,
possible_stdlibs: [])

workspace.cache_all_for_workspace!(nil, rebuild: false)

expect(pin_cache).to have_received(:cache_gem)
end
end
end
Loading