Skip to content
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

Use URI objects instead of strings #848

Merged
merged 1 commit into from
Aug 3, 2023
Merged

Use URI objects instead of strings #848

merged 1 commit into from
Aug 3, 2023

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Aug 2, 2023

Motivation

Closes #709
Closes #781

Representing URIs with strings is incorrect. We should always rely on URI to get the correct file paths and further we delay this change, the more entangled it might become.

There are already two issues related to this: not handling spaces properly and being unable to support unsaved files (#633).

Implementation

The most important changes are in Store and Executor. Everything else is pretty much just adapting the types from String to URI::Generic.

One thing to note is that for unsaved files the URI is untitled:Untitled-1, which has path as nil an opaque as the filename (Untitled-1).

This is a breaking change because extensions will no longer receive a URI string, but a URI object instead.

Automated Tests

Adapted all tests to use URI objects.

@vinistock vinistock added the breaking-change Non-backward compatible change label Aug 2, 2023
@vinistock vinistock added this to the 2023-Q3 milestone Aug 2, 2023
@vinistock vinistock requested a review from a team as a code owner August 2, 2023 16:27
@vinistock vinistock self-assigned this Aug 2, 2023
@vinistock vinistock force-pushed the vs/use_uri_objects branch 2 times, most recently from 2683c8a to 7944c78 Compare August 2, 2023 17:03
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Benchmark results in seconds (slowest at top)

          textDocument/completion average: 0.268928 std_dev: 0.005051
          textDocument/diagnostic average: 0.040546 std_dev: 0.010137
          textDocument/definition average: 0.005457 std_dev: 0.003142
      textDocument/selectionRange average: 0.004094 std_dev: 0.000524
   textDocument/documentHighlight average: 0.002514 std_dev: 0.000209
        textDocument/documentLink average: 0.002479 std_dev: 0.000184
            textDocument/codeLens average: 0.002477 std_dev: 0.000166
 textDocument/semanticTokens/full average: 0.002469 std_dev: 0.000315
      textDocument/documentSymbol average: 0.002449 std_dev: 0.000183
        textDocument/foldingRange average: 0.002257 std_dev: 0.000173
textDocument/semanticTokens/range average: 0.001646 std_dev: 0.000128
               codeAction/resolve average: 0.0014 std_dev: 9.4e-05
           textDocument/inlayHint average: 0.001396 std_dev: 0.000101
               textDocument/hover average: 0.00136 std_dev: 9.9e-05
    textDocument/onTypeFormatting average: 0.000838 std_dev: 9.3e-05
          textDocument/formatting average: 0.000827 std_dev: 0.000299
          textDocument/codeAction average: 0.000817 std_dev: 7.1e-05


================================================================================
Comparison with main branch:

 textDocument/semanticTokens/full unchanged
textDocument/semanticTokens/range unchanged
      textDocument/documentSymbol unchanged
        textDocument/foldingRange unchanged
          textDocument/formatting unchanged
          textDocument/diagnostic unchanged
        textDocument/documentLink unchanged
           textDocument/inlayHint unchanged
      textDocument/selectionRange unchanged
   textDocument/documentHighlight unchanged
               textDocument/hover unchanged
          textDocument/codeAction unchanged
    textDocument/onTypeFormatting unchanged
               codeAction/resolve unchanged
          textDocument/completion unchanged
            textDocument/codeLens unchanged
          textDocument/definition unchanged


================================================================================
Missing benchmarks:

RubyLsp::Requests::ShowSyntaxTree

@Shopify Shopify deleted a comment from github-actions bot Aug 2, 2023
@Shopify Shopify deleted a comment from github-actions bot Aug 2, 2023
Copy link
Contributor

@bitwise-aiden bitwise-aiden left a comment

Choose a reason for hiding this comment

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

Agreed that it is better to do this now than to push it off. Especially if we feel like more extensions will onboard down the path.

@vinistock vinistock merged commit bd9edca into main Aug 3, 2023
25 of 31 checks passed
@vinistock vinistock deleted the vs/use_uri_objects branch August 3, 2023 13:58
@shopify-shipit shopify-shipit bot temporarily deployed to production August 8, 2023 20:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Non-backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error running ruby-lsp in path with spaces
3 participants