Skip to content

Commit

Permalink
[flow] Use File_url.create and File_url.parse for document paste …
Browse files Browse the repository at this point in the history
…protocol (#9248)

Summary:
Pull Request resolved: #9248

This is a followup of D68132119. The scheme doesn't work for windows paths. This diff replaces it with `File_url.create` and `File_url.parse` pair (which is the underlying uri to file_key conversion code used everywhere else) so that the test can also succeed on windows.

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D68233875

fbshipit-source-id: bf8397be9eb23f172fd1565ed98616e49c18d85f
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Jan 16, 2025
1 parent 28f5d98 commit 9823d65
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hack_forked/utils/lsp/lsp_fmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1762,8 +1762,8 @@ module DocumentPasteFmt = struct
let import_source = Jget.string_exn json "importSource" in
let import_source_is_resolved = Jget.bool_exn json "importSourceIsResolved" in
let import_source =
if import_source_is_resolved && String.starts_with ~prefix:"file://" import_source then
Base.String.chop_prefix_exn ~prefix:"file://" import_source
if import_source_is_resolved then
File_url.parse import_source
else
import_source
in
Expand All @@ -1787,7 +1787,7 @@ module DocumentPasteFmt = struct
in
let import_source =
if import_source_is_resolved then
"file://" ^ import_source
File_url.create import_source
else
import_source
in
Expand Down

0 comments on commit 9823d65

Please sign in to comment.