Skip to content

Commit 324555b

Browse files
committed
temp
1 parent 22ea863 commit 324555b

2 files changed

Lines changed: 8 additions & 59 deletions

File tree

sqlmesh/lsp/uri.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from pathlib import Path
2+
from pygls.uris import from_fs_path, to_fs_path
3+
import typing as t
24

35

46
class URI:
@@ -25,12 +27,11 @@ def __repr__(self) -> str:
2527
return f"URI({self.value})"
2628

2729
def to_path(self) -> Path:
28-
# Remove file:// prefix and handle Windows paths
29-
path_str = self.value.removeprefix("file://")
30-
# Handle both forward and backward slashes
31-
return Path(path_str)
30+
p = to_fs_path(self.value)
31+
return Path(p)
3232

3333
@staticmethod
34-
def from_path(path: Path) -> "URI":
35-
# Always use forward slashes in URIs
36-
return URI(f"file://{path.absolute().as_posix()}")
34+
def from_path(path: t.Union[str, Path]) -> "URI":
35+
if isinstance(path, Path):
36+
path = path.as_posix()
37+
return URI(from_fs_path(path))

tests/lsp/test_uri.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)