@@ -19,6 +19,8 @@ import type {
19
19
DocumentLink ,
20
20
InitializeResult ,
21
21
WorkspaceFolder ,
22
+ CodeLensParams ,
23
+ CodeLens ,
22
24
} from 'vscode-languageserver/node'
23
25
import {
24
26
CompletionRequest ,
@@ -30,6 +32,7 @@ import {
30
32
FileChangeType ,
31
33
DocumentLinkRequest ,
32
34
TextDocumentSyncKind ,
35
+ CodeLensRequest ,
33
36
} from 'vscode-languageserver/node'
34
37
import { URI } from 'vscode-uri'
35
38
import normalizePath from 'normalize-path'
@@ -757,6 +760,7 @@ export class TW {
757
760
this . connection . onDocumentColor ( this . onDocumentColor . bind ( this ) )
758
761
this . connection . onColorPresentation ( this . onColorPresentation . bind ( this ) )
759
762
this . connection . onCodeAction ( this . onCodeAction . bind ( this ) )
763
+ this . connection . onCodeLens ( this . onCodeLens . bind ( this ) )
760
764
this . connection . onDocumentLinks ( this . onDocumentLinks . bind ( this ) )
761
765
this . connection . onRequest ( this . onRequest . bind ( this ) )
762
766
}
@@ -809,6 +813,7 @@ export class TW {
809
813
capabilities . add ( HoverRequest . type , { documentSelector : null } )
810
814
capabilities . add ( DocumentColorRequest . type , { documentSelector : null } )
811
815
capabilities . add ( CodeActionRequest . type , { documentSelector : null } )
816
+ capabilities . add ( CodeLensRequest . type , { documentSelector : null } )
812
817
capabilities . add ( DocumentLinkRequest . type , { documentSelector : null } )
813
818
814
819
capabilities . add ( CompletionRequest . type , {
@@ -931,6 +936,11 @@ export class TW {
931
936
return this . getProject ( params . textDocument ) ?. onCodeAction ( params ) ?? null
932
937
}
933
938
939
+ async onCodeLens ( params : CodeLensParams ) : Promise < CodeLens [ ] > {
940
+ await this . init ( )
941
+ return this . getProject ( params . textDocument ) ?. onCodeLens ( params ) ?? null
942
+ }
943
+
934
944
async onDocumentLinks ( params : DocumentLinkParams ) : Promise < DocumentLink [ ] > {
935
945
await this . init ( )
936
946
return this . getProject ( params . textDocument ) ?. onDocumentLinks ( params ) ?? null
@@ -961,6 +971,9 @@ export class TW {
961
971
hoverProvider : true ,
962
972
colorProvider : true ,
963
973
codeActionProvider : true ,
974
+ codeLensProvider : {
975
+ resolveProvider : false ,
976
+ } ,
964
977
documentLinkProvider : { } ,
965
978
completionProvider : {
966
979
resolveProvider : true ,
0 commit comments