@@ -7,23 +7,21 @@ import * as notifications from "./notifications";
77let D_PARAM :vscode . TextEditorDecorationType ;
88let D_GLOBAL :vscode . TextEditorDecorationType ;
99let D_DOC_TYPE :vscode . TextEditorDecorationType ;
10+ let D_UPVALUE :vscode . TextEditorDecorationType ;
1011
11- function createDecoration ( key : string ) : vscode . TextEditorDecorationType {
12+ function createDecoration ( key : string , config : vscode . DecorationRenderOptions | undefined = undefined ) : vscode . TextEditorDecorationType {
1213 let color = vscode . workspace . getConfiguration ( "emmylua" ) . get ( key ) ;
13- return vscode . window . createTextEditorDecorationType ( {
14- light : {
15- color : color
16- } ,
17- dark : {
18- color : color
19- }
20- } ) ;
14+ config = config || { } ;
15+ config . light = { color : color } ;
16+ config . dark = { color : color } ;
17+ return vscode . window . createTextEditorDecorationType ( config ) ;
2118}
2219
2320function updateDecorations ( ) {
2421 D_PARAM = createDecoration ( "colors.parameter" ) ;
2522 D_GLOBAL = createDecoration ( "colors.global" ) ;
2623 D_DOC_TYPE = createDecoration ( "colors.doc_type" ) ;
24+ D_UPVALUE = createDecoration ( "" , { textDecoration : "underline" } ) ;
2725}
2826
2927export function onDidChangeConfiguration ( client : LanguageClient ) {
@@ -50,6 +48,7 @@ function requestAnnotatorsImpl(editor: vscode.TextEditor, client: LanguageClient
5048 map . set ( AnnotatorType . DocType , [ ] ) ;
5149 map . set ( AnnotatorType . Param , [ ] ) ;
5250 map . set ( AnnotatorType . Global , [ ] ) ;
51+ map . set ( AnnotatorType . Upvalue , [ ] ) ;
5352
5453 list . forEach ( data => {
5554 let uri = vscode . Uri . parse ( data . uri ) ;
@@ -83,5 +82,8 @@ function updateAnnotators(editor: vscode.TextEditor, type: AnnotatorType, ranges
8382 case AnnotatorType . DocType :
8483 editor . setDecorations ( D_DOC_TYPE , ranges ) ;
8584 break ;
85+ case AnnotatorType . Upvalue :
86+ editor . setDecorations ( D_UPVALUE , ranges ) ;
87+ break ;
8688 }
8789}
0 commit comments