@@ -77,6 +77,10 @@ pub struct Graph {
7777 /// Used during invalidation to efficiently find affected entities without scanning the full graph.
7878 name_dependents : IdentityHashMap < NameId , Vec < NameDependent > > ,
7979
80+ /// When true, work items from update/delete are discarded instead of accumulated.
81+ /// Use for tools that only need definitions without resolution.
82+ without_resolution : bool ,
83+
8084 /// Accumulated work items from update/delete operations.
8185 /// Drained by `take_pending_work()` before resolution.
8286 pending_work : Vec < Unit > ,
@@ -96,6 +100,7 @@ impl Graph {
96100 position_encoding : Encoding :: default ( ) ,
97101 declaration_to_names : IdentityHashMap :: default ( ) ,
98102 name_dependents : IdentityHashMap :: default ( ) ,
103+ without_resolution : false ,
99104 pending_work : Vec :: default ( ) ,
100105 }
101106 }
@@ -718,7 +723,9 @@ impl Graph {
718723 let mut work = Vec :: new ( ) ;
719724 self . invalidate ( Some ( & document) , None , & mut work) ;
720725 self . remove_document_data ( & document) ;
721- self . pending_work . extend ( work) ;
726+ if !self . without_resolution {
727+ self . pending_work . extend ( work) ;
728+ }
722729 Some ( uri_id)
723730 }
724731
@@ -811,7 +818,9 @@ impl Graph {
811818 }
812819
813820 self . extend ( other, & mut work) ;
814- self . pending_work . extend ( work) ;
821+ if !self . without_resolution {
822+ self . pending_work . extend ( work) ;
823+ }
815824 }
816825
817826 /// Detaches old definitions from declarations, identifies declarations touched by the
@@ -1140,6 +1149,17 @@ impl Graph {
11401149 false
11411150 }
11421151
1152+ /// Configures the graph to skip accumulating resolution work items. Use for tools that only
1153+ /// need definitions and don't intend to call `resolve()`.
1154+ pub fn set_without_resolution ( & mut self , without_resolution : bool ) {
1155+ self . without_resolution = without_resolution;
1156+ }
1157+
1158+ #[ must_use]
1159+ pub fn without_resolution ( & self ) -> bool {
1160+ self . without_resolution
1161+ }
1162+
11431163 /// Sets the encoding that should be used for transforming byte offsets into LSP code unit line/column positions
11441164 pub fn set_encoding ( & mut self , encoding : Encoding ) {
11451165 self . position_encoding = encoding;
0 commit comments