@@ -29,7 +29,7 @@ class LSPModelReference(PydanticModel):
2929 """A LSP reference to a model, excluding external models."""
3030
3131 type : t .Literal ["model" ] = "model"
32- uri : str
32+ path : Path
3333 range : Range
3434 markdown_description : t .Optional [str ] = None
3535
@@ -40,9 +40,9 @@ class LSPExternalModelReference(PydanticModel):
4040 type : t .Literal ["external_model" ] = "external_model"
4141 range : Range
4242 target_range : t .Optional [Range ] = None
43- uri : t .Optional [str ] = None
44- """The URI of the external model, typically a YAML file, it is optional because
45- external models can be unregistered and so they URI is not available."""
43+ path : t .Optional [Path ] = None
44+ """The path of the external model, typically a YAML file, it is optional because
45+ external models can be unregistered and so the path is not available."""
4646
4747 markdown_description : t .Optional [str ] = None
4848
@@ -51,7 +51,7 @@ class LSPCteReference(PydanticModel):
5151 """A LSP reference to a CTE."""
5252
5353 type : t .Literal ["cte" ] = "cte"
54- uri : str
54+ path : Path
5555 range : Range
5656 target_range : Range
5757
@@ -60,7 +60,7 @@ class LSPMacroReference(PydanticModel):
6060 """A LSP reference to a macro."""
6161
6262 type : t .Literal ["macro" ] = "macro"
63- uri : str
63+ path : Path
6464 range : Range
6565 target_range : Range
6666 markdown_description : t .Optional [str ] = None
@@ -209,7 +209,7 @@ def get_model_definitions_for_a_path(
209209
210210 references .append (
211211 LSPCteReference (
212- uri = document_uri .value , # Same file
212+ path = document_uri .to_path () , # Same file
213213 range = table_range ,
214214 target_range = target_range ,
215215 )
@@ -219,7 +219,7 @@ def get_model_definitions_for_a_path(
219219 scope = scope ,
220220 reference_name = table .name ,
221221 read_file = read_file ,
222- referenced_model_uri = document_uri ,
222+ referenced_model_path = document_uri . to_path () ,
223223 description = "" ,
224224 reference_type = "cte" ,
225225 cte_target_range = target_range ,
@@ -270,7 +270,6 @@ def get_model_definitions_for_a_path(
270270 # Check whether the path exists
271271 if not referenced_model_path .is_file ():
272272 continue
273- referenced_model_uri = URI .from_path (referenced_model_path )
274273
275274 # Extract metadata for positioning
276275 table_meta = TokenPositionDetails .from_meta (table .this .meta )
@@ -299,7 +298,7 @@ def get_model_definitions_for_a_path(
299298 )
300299 references .append (
301300 LSPExternalModelReference (
302- uri = referenced_model_uri . value ,
301+ path = referenced_model_path ,
303302 range = Range (
304303 start = to_lsp_position (start_pos_sqlmesh ),
305304 end = to_lsp_position (end_pos_sqlmesh ),
@@ -313,7 +312,7 @@ def get_model_definitions_for_a_path(
313312 scope = scope ,
314313 reference_name = normalized_reference_name ,
315314 read_file = read_file ,
316- referenced_model_uri = referenced_model_uri ,
315+ referenced_model_path = referenced_model_path ,
317316 description = description ,
318317 yaml_target_range = yaml_target_range ,
319318 reference_type = "external_model" ,
@@ -324,7 +323,7 @@ def get_model_definitions_for_a_path(
324323 else :
325324 references .append (
326325 LSPModelReference (
327- uri = referenced_model_uri . value ,
326+ path = referenced_model_path ,
328327 range = Range (
329328 start = to_lsp_position (start_pos_sqlmesh ),
330329 end = to_lsp_position (end_pos_sqlmesh ),
@@ -337,7 +336,7 @@ def get_model_definitions_for_a_path(
337336 scope = scope ,
338337 reference_name = normalized_reference_name ,
339338 read_file = read_file ,
340- referenced_model_uri = referenced_model_uri ,
339+ referenced_model_path = referenced_model_path ,
341340 description = description ,
342341 reference_type = "model" ,
343342 default_catalog = lint_context .context .default_catalog ,
@@ -481,10 +480,9 @@ def get_macro_reference(
481480 return None
482481
483482 # Create a reference to the macro definition
484- macro_uri = URI .from_path (path )
485483
486484 return LSPMacroReference (
487- uri = macro_uri . value ,
485+ path = path ,
488486 range = to_lsp_range (macro_range ),
489487 target_range = Range (
490488 start = Position (line = start_line - 1 , character = 0 ),
@@ -517,7 +515,7 @@ def get_built_in_macro_reference(macro_name: str, macro_range: Range) -> t.Optio
517515 end_line_number = line_number + len (source_lines ) - 1
518516
519517 return LSPMacroReference (
520- uri = URI . from_path ( Path (filename )). value ,
518+ path = Path (filename ),
521519 range = macro_range ,
522520 target_range = Range (
523521 start = Position (line = line_number - 1 , character = 0 ),
@@ -559,12 +557,12 @@ def get_model_find_all_references(
559557
560558 assert isinstance (model_at_position , LSPModelReference ) # for mypy
561559
562- target_model_uri = model_at_position .uri
560+ target_model_path = model_at_position .path
563561
564562 # Start with the model definition
565563 all_references : t .List [LSPModelReference ] = [
566564 LSPModelReference (
567- uri = model_at_position .uri ,
565+ path = model_at_position .path ,
568566 range = Range (
569567 start = Position (line = 0 , character = 0 ),
570568 end = Position (line = 0 , character = 0 ),
@@ -575,7 +573,7 @@ def get_model_find_all_references(
575573
576574 # Then add references from the current file
577575 current_file_refs = filter (
578- lambda ref : isinstance (ref , LSPModelReference ) and ref .uri == target_model_uri ,
576+ lambda ref : isinstance (ref , LSPModelReference ) and ref .path == target_model_path ,
579577 get_model_definitions_for_a_path (lint_context , document_uri ),
580578 )
581579
@@ -584,7 +582,7 @@ def get_model_find_all_references(
584582
585583 all_references .append (
586584 LSPModelReference (
587- uri = document_uri .value ,
585+ path = document_uri .to_path () ,
588586 range = ref .range ,
589587 markdown_description = ref .markdown_description ,
590588 )
@@ -600,7 +598,7 @@ def get_model_find_all_references(
600598
601599 # Get model references that point to the target model
602600 matching_refs = filter (
603- lambda ref : isinstance (ref , LSPModelReference ) and ref .uri == target_model_uri ,
601+ lambda ref : isinstance (ref , LSPModelReference ) and ref .path == target_model_path ,
604602 get_model_definitions_for_a_path (lint_context , file_uri ),
605603 )
606604
@@ -609,7 +607,7 @@ def get_model_find_all_references(
609607
610608 all_references .append (
611609 LSPModelReference (
612- uri = file_uri . value ,
610+ path = path ,
613611 range = ref .range ,
614612 markdown_description = ref .markdown_description ,
615613 )
@@ -662,7 +660,7 @@ def get_cte_references(
662660 # Add the CTE definition
663661 matching_references = [
664662 LSPCteReference (
665- uri = document_uri .value ,
663+ path = document_uri .to_path () ,
666664 range = target_cte_definition_range ,
667665 target_range = target_cte_definition_range ,
668666 )
@@ -673,7 +671,7 @@ def get_cte_references(
673671 if ref .target_range == target_cte_definition_range :
674672 matching_references .append (
675673 LSPCteReference (
676- uri = document_uri .value ,
674+ path = document_uri .to_path () ,
677675 range = ref .range ,
678676 target_range = ref .target_range ,
679677 )
@@ -713,13 +711,13 @@ def get_macro_find_all_references(
713711
714712 assert isinstance (macro_at_position , LSPMacroReference ) # for mypy
715713
716- target_macro_uri = macro_at_position .uri
714+ target_macro_path = macro_at_position .path
717715 target_macro_target_range = macro_at_position .target_range
718716
719717 # Start with the macro definition
720718 all_references : t .List [LSPMacroReference ] = [
721719 LSPMacroReference (
722- uri = target_macro_uri ,
720+ path = target_macro_path ,
723721 range = target_macro_target_range ,
724722 target_range = target_macro_target_range ,
725723 markdown_description = None ,
@@ -733,7 +731,7 @@ def get_macro_find_all_references(
733731 # Get macro references that point to the same macro definition
734732 matching_refs = filter (
735733 lambda ref : isinstance (ref , LSPMacroReference )
736- and ref .uri == target_macro_uri
734+ and ref .path == target_macro_path
737735 and ref .target_range == target_macro_target_range ,
738736 get_macro_definitions_for_a_path (lsp_context , file_uri ),
739737 )
@@ -742,7 +740,7 @@ def get_macro_find_all_references(
742740 assert isinstance (ref , LSPMacroReference ) # for mypy
743741 all_references .append (
744742 LSPMacroReference (
745- uri = file_uri . value ,
743+ path = path ,
746744 range = ref .range ,
747745 target_range = ref .target_range ,
748746 markdown_description = ref .markdown_description ,
@@ -822,7 +820,7 @@ def _process_column_references(
822820 scope : t .Any ,
823821 reference_name : str ,
824822 read_file : t .List [str ],
825- referenced_model_uri : URI ,
823+ referenced_model_path : Path ,
826824 description : t .Optional [str ] = None ,
827825 yaml_target_range : t .Optional [Range ] = None ,
828826 reference_type : t .Literal ["model" , "external_model" , "cte" ] = "model" ,
@@ -837,7 +835,7 @@ def _process_column_references(
837835 scope: The SQL scope to search for columns
838836 reference_name: The full reference name (may include database/catalog)
839837 read_file: The file content as list of lines
840- referenced_model_uri: URI of the referenced model
838+ referenced_model_path: Path of the referenced model
841839 description: Markdown description for the reference
842840 yaml_target_range: Target range for external models (YAML files)
843841 reference_type: Type of reference - "model", "external_model", or "cte"
@@ -857,7 +855,7 @@ def _process_column_references(
857855 table_range = _get_column_table_range (column , read_file )
858856 references .append (
859857 LSPCteReference (
860- uri = referenced_model_uri . value ,
858+ path = referenced_model_path ,
861859 range = table_range ,
862860 target_range = cte_target_range ,
863861 )
@@ -875,7 +873,7 @@ def _process_column_references(
875873 if reference_type == "external_model" :
876874 references .append (
877875 LSPExternalModelReference (
878- uri = referenced_model_uri . value ,
876+ path = referenced_model_path ,
879877 range = table_range ,
880878 markdown_description = description ,
881879 target_range = yaml_target_range ,
@@ -884,7 +882,7 @@ def _process_column_references(
884882 else :
885883 references .append (
886884 LSPModelReference (
887- uri = referenced_model_uri . value ,
885+ path = referenced_model_path ,
888886 range = table_range ,
889887 markdown_description = description ,
890888 )
0 commit comments