8000 Re-enable support for .gem_rbs_collection directories by apiology · Pull Request #942 · castwide/solargraph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Re-enable support for .gem_rbs_collection directories #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jun 28, 2025

Conversation

apiology
Copy link
Contributor
@apiology apiology commented May 19, 2025

This is probably best released after or alongside #946 to make sure that RBS collection types don't make current pin results any worse.

@apiology
Copy link
Contributor Author

This is going to be needed to modernize solargraph-rails to use the RBS collection types, as well as to include shims needed to typecheck solargraph at strict level.

I have another PR incoming which tries harder to pick the best types between multiple method pins on the same path - will leave this as draft until that one's open, at which point it becomes a prereq.

@castwide, is that the nature of the issue you had with the collection support originally?

@apiology apiology marked this pull request as ready for review May 26, 2025 16:45
@apiology apiology marked this pull request as draft June 8, 2025 11:23
@@ -34,6 +34,8 @@ jobs:
bundle exec solargraph config
yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
- name: Install gem types
run: bundle exec rbs collection install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's exercise the functionality in our own build

@@ -47,7 +47,7 @@ class InvalidRubocopVersionError < RuntimeError; end
autoload :Parser, 'solargraph/parser'
autoload :RbsMap, 'solargraph/rbs_map'
autoload :GemPins, 'solargraph/gem_pins'
autoload :Cache, 'solargraph/cache'
autoload :PinCache, 'solargraph/pin_cache'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fantastic name ("GemCache?"), but it helped me keep this distinct in my head from ApiMap::Cache

@@ -178,15 +209,14 @@ def self.load directory
# @param directory [String]
# @param out [IO] The output stream for messages
# @return [ApiMap]
def self.load_with_cache directory, out = IO::NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IO::NULL resolved to "/dev/null", not an object which accepted puts()

def deserialize_combined_pin_cache(gemspec)
unless combined_pins_in_memory[[gemspec.name, gemspec.version]].nil?
return combined_pins_in_memory[[gemspec.name, gemspec.version]]
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now cache the combined pins to disk. No perf effect with this PR, but I strongly suspect it matters with #946 where the combination logic is more complex.

@apiology apiology marked this pull request as ready for review June 11, 2025 11:10
if lockfile_path.exist?
collection_config = RBS::Collection::Config.from_path lockfile_path
gem_config = collection_config.gem(library)
data = gem_config&.to_s
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key to cache invalidation when a user updates their RBS collection.

@castwide
Copy link
Owner

@castwide, is that the nature of the issue you had with the collection support originally?

Yep! This is precisely how I hoped to leverage RBS collections instead of implementing our own mechanism for custom sig extensions. I appreciate your work consolidating variable source definitions, too.

@castwide castwide merged commit 9cd77c8 into castwide:master Jun 28, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0