Skip to content

Conversation

@amomchilov
Copy link
Contributor

@amomchilov amomchilov commented Jan 5, 2026

Motivation

Fixes #2471

  1. Fix incorrect shim for URI::Source#fragment
  2. Remove untyped call to alias_method
  3. Sync this file with its copy in RubyLSP (see also: Sync URI::Source with Tapioca ruby-lsp#3891)
    • Adding a missing delete_prefix("/") in the path parsing code
    • Add a missing / in the URI::Source#to_s output
  4. Prevent definition (and registration) of this URI class if RubyLSP has already done it.
    • This fixes the constant redefinition issue.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@amomchilov amomchilov changed the title Fix shim for URI::Source#fragment Sync URI::Source with RubyLSP Jan 5, 2026
@amomchilov amomchilov added the bugfix label Jan 5, 2026 — with Graphite App
@amomchilov amomchilov self-assigned this Jan 5, 2026
@amomchilov amomchilov requested a review from vinistock January 5, 2026 22:57
@amomchilov amomchilov requested a review from Morriar January 5, 2026 22:58
@amomchilov amomchilov marked this pull request as ready for review January 5, 2026 22:59
@amomchilov amomchilov requested a review from a team as a code owner January 5, 2026 22:59
@vinistock
Copy link
Member

The test failures are legit. In our source URIs, the gem version after the name is optional. When it's missing, it indicates whatever version is currently activated in a Bundle context.

# Explicit version
source://gem_name/1.2.3/lib/bar.rb#1

# Implicit
source://gem_name//lib/bar.rb#1


# We need to hide these aliased methods from Sorbet, because it would otherwise complain about these
# being redefinitions of the existing methods it knows about from RubyLSP.
self #: as untyped # rubocop:disable Style/RedundantSelf
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this since host and fragment are defined in the RBI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but for a different reason now. See the comment on lines 29-30

I renamed this class from Tapioca::SourceURI to URI::Source (same as what RubyLSP would define), so these are redefinitions of those methods now

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

Co-authored-by: Vinicius Stock <vinicius.stock@shopify.com>
vinistock
vinistock previously approved these changes Jan 6, 2026
@vinistock vinistock dismissed their stale review January 6, 2026 19:19

I approved the wrong PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning: already initialized constant URI::Schemes::SOURCE

3 participants