File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ pub struct Config {
4747 pub call_info_full : bool ,
4848 pub lens : LensConfig ,
4949 pub hover : HoverConfig ,
50+ pub semantic_tokens_refresh : bool ,
5051
5152 pub with_sysroot : bool ,
5253 pub linked_projects : Vec < LinkedProject > ,
@@ -193,6 +194,7 @@ impl Config {
193194 call_info_full : true ,
194195 lens : LensConfig :: default ( ) ,
195196 hover : HoverConfig :: default ( ) ,
197+ semantic_tokens_refresh : false ,
196198 linked_projects : Vec :: new ( ) ,
197199 root_path,
198200 }
@@ -402,6 +404,14 @@ impl Config {
402404 self . client_caps . hover_actions = get_bool ( "hoverActions" ) ;
403405 self . client_caps . status_notification = get_bool ( "statusNotification" ) ;
404406 }
407+
408+ if let Some ( workspace_caps) = caps. workspace . as_ref ( ) {
409+ if let Some ( refresh_support) =
410+ workspace_caps. semantic_tokens . as_ref ( ) . and_then ( |it| it. refresh_support )
411+ {
412+ self . semantic_tokens_refresh = refresh_support;
413+ }
414+ }
405415 }
406416}
407417
Original file line number Diff line number Diff line change @@ -330,6 +330,12 @@ impl GlobalState {
330330 . collect :: < Vec < _ > > ( ) ;
331331
332332 self . update_file_notifications_on_threadpool ( subscriptions) ;
333+
334+ // Refresh semantic tokens if the client supports it.
335+ if self . config . semantic_tokens_refresh {
336+ self . semantic_tokens_cache . lock ( ) . clear ( ) ;
337+ self . send_request :: < lsp_types:: request:: SemanticTokensRefesh > ( ( ) , |_, _| ( ) ) ;
338+ }
333339 }
334340
335341 if let Some ( diagnostic_changes) = self . diagnostics . take_changes ( ) {
You can’t perform that action at this time.
0 commit comments