@@ -71,26 +71,36 @@ public HoverHandler(Workspace workspace)
7171 break ;
7272
7373 case YarnSymbolType . Variable :
74- var variableDefinitions = project . FindVariables ( token . Text ) ;
75- if ( variableDefinitions . Any ( ) )
74+ var variableDeclarations = project . FindVariables ( token . Text ) ;
75+ if ( variableDeclarations . Any ( ) )
7676 {
77- var definition = variableDefinitions
77+ var declaration = variableDeclarations
7878 . OrderBy ( v =>
7979 v . SourceFileName == request . TextDocument . Uri ? // definitions in the current file get priority
8080 Math . Abs ( token . Line - v . Range . Start . Line ) // within a file, closest definition wins
8181 : 100_000 ) // don't care what order out of current file definitions come in
8282 . First ( ) ;
8383
84- DeclarationHelper . GetDeclarationInfo ( definition , out var type , out var defaultValue ) ;
84+ DeclarationHelper . GetDeclarationInfo ( declaration , out var type , out var defaultValue ) ;
8585
86- var description = new System . Text . StringBuilder ( )
87- . AppendFormat ( "`(variable) {0} : {1}`" , definition . Name ?? "(unknown)" , type )
88- . AppendLine ( )
89- . AppendLine ( )
90- . AppendLine ( definition . Description )
86+ bool isSmartVariable = declaration . IsInlineExpansion ;
87+
88+ var descriptionBuilder = new System . Text . StringBuilder ( )
89+ . AppendLine ( $ "{ ( isSmartVariable ? "Smart Variable" : "Variable" ) } : `{ declaration . Name ?? "(unknown)" } : { type } `")
9190 . AppendLine ( )
92- . AppendFormat ( $ "Initial value: { defaultValue } ")
93- . ToString ( ) ;
91+ . AppendLine ( declaration . Description )
92+ . AppendLine ( ) ;
93+
94+ if ( isSmartVariable && declaration . InitialValueParserContext != null )
95+ {
96+ descriptionBuilder . AppendFormat ( $ "Value: `{ declaration . InitialValueParserContext . GetTextWithWhitespace ( ) } `") ;
97+ }
98+ else
99+ {
100+ descriptionBuilder . Append ( $ "Initial value: `{ defaultValue } `") ;
101+ }
102+
103+ var description = descriptionBuilder . ToString ( ) ;
94104
95105 var result = new Hover
96106 {
0 commit comments