@@ -23,6 +23,7 @@ export default class CompletionService {
2323 return this . getDotCompletions ( ) ;
2424 }
2525
26+ completions = completions . concat ( this . getVarCompletions ( ) ) ;
2627 completions = completions . concat ( this . getConditionalCompletions ( ) ) ;
2728 completions = completions . concat ( this . getControlCompletions ( ) ) ;
2829 completions = completions . concat ( this . getGlobalFunctionCompletions ( ) ) ;
@@ -114,10 +115,23 @@ export default class CompletionService {
114115 return this . DOT_COMPLETIONS [ keyword ] ;
115116 }
116117
117-
118118 return [ ]
119119 }
120-
120+
121+ protected getVarCompletions ( ) :CompletionItem [ ] {
122+
123+ const re = / ( i n t | b o o l | s t r i n g | p u b k e y | s i g | d a t a s i g | b y t e s ) \s + ( \w + ) / g;
124+ const completions :CompletionItem [ ] = [ ] ;
125+ for ( const m of this . text . matchAll ( re ) ) {
126+ completions . push ( {
127+ label :m [ 2 ] ,
128+ kind :CompletionItemKind . Variable
129+ } ) ;
130+ }
131+
132+ return completions ;
133+ }
134+
121135 protected getConditionalCompletions ( ) :CompletionItem [ ] {
122136 const completions :CompletionItem [ ] = [ ] ;
123137 if ( ! this . text . includes ( "contract" ) ) {
@@ -296,7 +310,7 @@ export default class CompletionService {
296310 }
297311
298312 protected getTypesCompletions ( ) :CompletionItem [ ] {
299- const words = [ "int" , "bool" , "string" , "bytes" , "pubkey" , "sig" , "datasig" , "true" , "false" ]
313+ const words = [ "int" , "bool" , "string" , "bytes" , "pubkey" , "sig" , "datasig" , "true" , "false" , "date" ]
300314 const completions = [ ] ;
301315 for ( let i = 0 ; i < words . length ; i ++ ) {
302316 this . currentIndex += 1 ;
0 commit comments