@@ -13,7 +13,7 @@ use log::{error, info};
1313use lsp_server:: { Connection , ErrorCode , Message , RequestId } ;
1414use lsp_types:: { notification:: * , request:: * , * } ;
1515use once_cell:: sync:: Lazy ;
16- use rowan:: { ast:: AstNode , TextSize } ;
16+ use rowan:: { ast:: AstNode , TextLen , TextRange , TextSize } ;
1717use rustc_hash:: FxHashSet ;
1818use serde:: { Deserialize , Serialize } ;
1919use serde_repr:: { Deserialize_repr , Serialize_repr } ;
@@ -184,7 +184,7 @@ impl Server {
184184 work_done_progress_options : Default :: default ( ) ,
185185 legend : semantic_tokens:: legend ( ) ,
186186 range : Some ( true ) ,
187- full : Some ( SemanticTokensFullOptions :: Bool ( false ) ) ,
187+ full : Some ( SemanticTokensFullOptions :: Bool ( true ) ) ,
188188 } ) ,
189189 ) ,
190190 ..ServerCapabilities :: default ( )
@@ -814,6 +814,16 @@ impl Server {
814814 Ok ( ( ) )
815815 }
816816
817+ fn semantic_tokens_full ( & mut self , id : RequestId , params : SemanticTokensParams ) -> Result < ( ) > {
818+ self . run_with_db ( id, move |db| {
819+ let Some ( document) = Workspace :: get ( db) . lookup_uri ( db, & params. text_document . uri ) else { return None } ;
820+ let range = document. line_index ( db) . line_col_lsp_range ( TextRange :: new ( 0 . into ( ) , document. text ( db) . text_len ( ) ) ) ;
821+ semantic_tokens:: find_all ( db, & params. text_document . uri , range)
822+ } ) ;
823+
824+ Ok ( ( ) )
825+ }
826+
817827 fn semantic_tokens_range (
818828 & mut self ,
819829 id : RequestId ,
@@ -917,6 +927,9 @@ impl Server {
917927 . on:: <SemanticTokensRangeRequest , _>( |id, params| {
918928 self . semantic_tokens_range( id, params)
919929 } ) ?
930+ . on:: <SemanticTokensFullRequest , _>( |id, params| {
931+ self . semantic_tokens_full( id, params)
932+ } ) ?
920933 . on:: <InlayHintRequest , _>( |id, params| {
921934 self . inlay_hints( id, params)
922935 } ) ?
0 commit comments