Skip to content

Commit 9af8193

Browse files
committed
fix(vscode): further simplify path handling
1 parent e24c9da commit 9af8193

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

sqlmesh/lsp/uri.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ def to_path(self) -> Path:
2929
@staticmethod
3030
def from_path(path: t.Union[str, Path]) -> "URI":
3131
if isinstance(path, Path):
32-
path = path.as_posix()
33-
return URI(from_fs_path(path))
32+
path = str(path)
33+
encoded_path = path.replace(":", "%3A")
34+
return URI(from_fs_path(encoded_path))

tests/lsp/test_context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ def test_lsp_context():
2020
# Check that the value is a ModelInfo with the expected model name
2121
assert isinstance(lsp_context.map[active_customers_key], ModelTarget)
2222
assert "sushi.active_customers" in lsp_context.map[active_customers_key].names
23+
24+
# Check that all the values in the map are normalised
25+
keys = lsp_context.map.keys()
26+
for key in keys:
27+
stripped_key_from_prefix = str(key).split("file://")[1]
28+
assert ":" not in stripped_key_from_prefix
29+
assert "\\" not in stripped_key_from_prefix

0 commit comments

Comments
 (0)