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

Fixed Uri length #751

Merged
merged 2 commits into from
Apr 7, 2025
Merged

Fixed Uri length #751

merged 2 commits into from
Apr 7, 2025

Conversation

armanio123
Copy link
Member

documentUriToFileName was returning an incorrect when the Uri contained a drive letter. ie::

file:///C:/Folder1/file.ts --> C:/lder1/file.ts

@Copilot Copilot bot review requested due to automatic review settings April 4, 2025 23:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the issue where documentUriToFileName mis-calculates the file name when the URI contains a drive letter. The change adjusts the offset calculation to correctly handle drive-letter URIs.

  • Adjusted the substring offset from len(possibleDrive)+3 to len(possibleDrive)+1.
Comments suppressed due to low confidence (1)

internal/lsp/converters.go:156

  • Consider adding unit tests for documentUriToFileName to cover various drive letter scenarios, ensuring the offset computation works correctly for all expected URI formats.
return possibleDrive + path[len(possibleDrive)+1:]

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@jakebailey
Copy link
Member

We should really add some tests for these converters 😄

Copy link

@Mustafiz04 Mustafiz04 left a comment

Choose a reason for hiding this comment

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

Agree with @jakebailey to have a test for this.

@jakebailey jakebailey requested a review from andrewbranch April 7, 2025 17:30
@armanio123 armanio123 added this pull request to the merge queue Apr 7, 2025
@armanio123
Copy link
Member Author

@jakebailey Agree, I'll see to adding some tests.

Merged via the queue into microsoft:main with commit a31f47e Apr 7, 2025
23 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.

4 participants