Skip to content

Conversation

@pkondzior
Copy link
Contributor

Motivation

Related to #2660

Makes URI parsing and normalization platform-aware, by splitting code paths into separate methods.

Overall on macos this brings following speedups:

  • textDocument/diagnostic faster by 3.784 %
  • workspace/symbol faster by 38.197 %

Implementation

  1. Split path handling into:
  • from_win_path (Windows)
  • from_unix_path (Unix)
  • from_path now auto-selects based on platform.
  1. Added platform-specific methods:
  • to_standardized_win_path (Windows)
  • to_standardized_unix_path (Unix)
  • to_standardized_path now auto-selects based on platform.
  1. Centralized unsafe regex UNSAFE_REGEX , previously it was always instantiated on from_path method call
  2. Improved escaping/unescaping and handling of Windows long paths (//?/).
  3. Extended Sorbet RBI with from_path, to_standardized_path, and full_path signatures.

Automated Tests

  • Updated tests to cover both platforms and renamed method calls.

@graphite-app
Copy link

graphite-app bot commented Oct 28, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@pkondzior pkondzior marked this pull request as ready for review October 28, 2025 20:38
@pkondzior pkondzior requested a review from a team as a code owner October 28, 2025 20:38
@pkondzior pkondzior force-pushed the platform-related-uri-optimisations branch from 179b2b7 to e87f701 Compare October 28, 2025 20:40
@vinistock vinistock added server This pull request should be included in the server gem's release notes other Changes that aren't bugfixes, enhancements or breaking changes labels Nov 6, 2025
Comment on lines +77 to +78
# we can bail out parsing if there is nothing to unescape
return parsed_path unless parsed_path.match?(/%[0-9A-Fa-f]{2}/)
Copy link
Member

Choose a reason for hiding this comment

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

Why can we avoid unescaping here?

Comment on lines +94 to +95
# we can bail out parsing if there is nothing to be unescaped
return unescaped_path unless unescaped_path.match?(/%[0-9A-Fa-f]{2}/)
Copy link
Member

Choose a reason for hiding this comment

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

Same question, why does this not need to be escaped?

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

Labels

other Changes that aren't bugfixes, enhancements or breaking changes server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants