@@ -15,7 +15,9 @@ use crate::actions::{AnalysisProgressKind, AnalysisWaitKind,
1515 ContextDefinition , InitActionContext ,
1616 rpc_error_code} ;
1717use crate :: actions:: notifications:: ContextDefinitionKindParam ;
18- use crate :: analysis:: { ZeroSpan , ZeroFilePosition , SymbolRef } ;
18+ use crate :: analysis:: { Named , DeclarationSpan , LocationSpan , DLSLimitation ,
19+ SymbolRef , ZeroFilePosition , ZeroSpan ,
20+ isolated_template_limitation} ;
1921use crate :: analysis:: reference:: ReferenceKind ;
2022use crate :: analysis:: symbols:: SimpleSymbol ;
2123use crate :: config:: Config ;
@@ -43,8 +45,7 @@ pub use crate::lsp_data::request::{
4345} ;
4446
4547pub use crate :: lsp_data:: { self as lsp_data, * } ;
46- use crate :: analysis:: { Named , DeclarationSpan , LocationSpan ,
47- DLSLimitation , ISOLATED_TEMPLATE_LIMITATION } ;
48+
4849use crate :: analysis:: structure:: objects:: CompObjectKind ;
4950
5051use crate :: analysis:: scope:: { SymbolContext , SubSymbol , ContextKey , Scope } ;
@@ -127,11 +128,13 @@ where
127128}
128129
129130
130- pub const TYPE_SEMANTIC_LIMITATION : DLSLimitation = DLSLimitation {
131- issue_num : 65 ,
132- description : "The DLS does not currently support semantic analysis of \
133- types, including reference finding",
134- } ;
131+ pub fn type_semantic_limitation ( ) -> DLSLimitation {
132+ DLSLimitation {
133+ issue_num : 65 ,
134+ description : "The DLS does not currently support semantic analysis of \
135+ types, including reference finding". to_string ( ) ,
136+ }
137+ }
135138
136139// TODO: This function is getting bloated, refactor into several smaller ones
137140fn fp_to_symbol_refs < O : Output >
@@ -185,7 +188,7 @@ fn fp_to_symbol_refs<O: Output>
185188 // Should be guaranteed by the context reference lookup above
186189 // (isolated analysis does exist)
187190 if refr. reference_kind ( ) == ReferenceKind :: Type {
188- relevant_limitations. insert ( TYPE_SEMANTIC_LIMITATION ) ;
191+ relevant_limitations. insert ( type_semantic_limitation ( ) ) ;
189192 }
190193
191194 let first_context = analysis. first_context_at_pos ( fp) . unwrap ( ) ;
@@ -210,9 +213,11 @@ fn fp_to_symbol_refs<O: Output>
210213 definitions. append (
211214 & mut device. symbols_of_ref ( * refr. loc_span ( ) ) ) ;
212215 }
213- if let Some ( ContextKey :: Template ( _ ) ) = first_context {
216+ if let Some ( ContextKey :: Template ( templ ) ) = first_context {
214217 if !any_template_used {
215- relevant_limitations. insert ( ISOLATED_TEMPLATE_LIMITATION ) ;
218+ relevant_limitations. insert (
219+ isolated_template_limitation ( templ. name . as_str ( ) )
220+ ) ;
216221 }
217222 }
218223 } ,
0 commit comments