File tree Expand file tree Collapse file tree 4 files changed +47
-8
lines changed
src/lsp_client/capability/request Expand file tree Collapse file tree 4 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,15 @@ async def request_declaration_locations(
8181 return [loc ]
8282 case locations if is_locations (locations ):
8383 return list (locations )
84+ case links if is_location_links (links ):
85+ return [
86+ lsp_type .Location (
87+ uri = link .target_uri , range = link .target_selection_range
88+ )
89+ for link in links
90+ ]
91+ case None :
92+ return None
8493 case other :
8594 logger .warning ("Declaration returned with unexpected result: {}" , other )
8695 return None
@@ -91,6 +100,8 @@ async def request_declaration_links(
91100 match await self .request_declaration (file_path , position ):
92101 case links if is_location_links (links ):
93102 return list (links )
103+ case None :
104+ return None
94105 case other :
95106 logger .warning ("Declaration returned with unexpected result: {}" , other )
96107 return None
Original file line number Diff line number Diff line change @@ -83,14 +83,21 @@ async def request_definition_locations(
8383 file_path : AnyPath ,
8484 position : Position ,
8585 ) -> Sequence [lsp_type .Location ] | None :
86- match await self .request_definition (
87- file_path ,
88- position ,
89- ):
86+ match await self .request_definition (file_path , position ):
9087 case lsp_type .Location () as loc :
9188 return [loc ]
9289 case locations if is_locations (locations ):
9390 return list (locations )
91+ case links if is_location_links (links ):
92+ return [
93+ lsp_type .Location (
94+ uri = link .target_uri ,
95+ range = link .target_selection_range ,
96+ )
97+ for link in links
98+ ]
99+ case None :
100+ return None
94101 case other :
95102 logger .warning ("Definition returned with unexpected result: {}" , other )
96103 return None
@@ -100,12 +107,11 @@ async def request_definition_links(
100107 file_path : AnyPath ,
101108 position : Position ,
102109 ) -> Sequence [lsp_type .LocationLink ] | None :
103- match await self .request_definition (
104- file_path ,
105- position ,
106- ):
110+ match await self .request_definition (file_path , position ):
107111 case links if is_location_links (links ):
108112 return list (links )
113+ case None :
114+ return None
109115 case other :
110116 logger .warning ("Definition returned with unexpected result: {}" , other )
111117 return None
Original file line number Diff line number Diff line change @@ -81,6 +81,15 @@ async def request_implementation_locations(
8181 return [loc ]
8282 case locations if is_locations (locations ):
8383 return list (locations )
84+ case links if is_location_links (links ):
85+ return [
86+ lsp_type .Location (
87+ uri = link .target_uri , range = link .target_selection_range
88+ )
89+ for link in links
90+ ]
91+ case None :
92+ return None
8493 case other :
8594 logger .warning (
8695 "Implementation returned with unexpected result: {}" , other
@@ -93,6 +102,8 @@ async def request_implementation_links(
93102 match await self .request_implementation (file_path , position ):
94103 case links if is_location_links (links ):
95104 return list (links )
105+ case None :
106+ return None
96107 case other :
97108 logger .warning (
98109 "Implementation returned with unexpected result: {}" , other
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ async def request_type_definition_locations(
8383 return [loc ]
8484 case locations if is_locations (locations ):
8585 return list (locations )
86+ case links if is_location_links (links ):
87+ return [
88+ lsp_type .Location (
89+ uri = link .target_uri , range = link .target_selection_range
90+ )
91+ for link in links
92+ ]
93+ case None :
94+ return None
8695 case other :
8796 logger .warning (
8897 "TypeDefinition returned with unexpected result: {}" , other
@@ -95,6 +104,8 @@ async def request_type_definition_links(
95104 match await self .request_type_definition (file_path , position ):
96105 case links if is_location_links (links ):
97106 return list (links )
107+ case None :
108+ return None
98109 case other :
99110 logger .warning (
100111 "TypeDefinition returned with unexpected result: {}" , other
You can’t perform that action at this time.
0 commit comments