@@ -19,6 +19,8 @@ import type {
1919 DocumentLink ,
2020 InitializeResult ,
2121 WorkspaceFolder ,
22+ CodeLensParams ,
23+ CodeLens ,
2224} from 'vscode-languageserver/node'
2325import {
2426 CompletionRequest ,
@@ -30,6 +32,7 @@ import {
3032 FileChangeType ,
3133 DocumentLinkRequest ,
3234 TextDocumentSyncKind ,
35+ CodeLensRequest ,
3336} from 'vscode-languageserver/node'
3437import { URI } from 'vscode-uri'
3538import normalizePath from 'normalize-path'
@@ -757,6 +760,7 @@ export class TW {
757760 this . connection . onDocumentColor ( this . onDocumentColor . bind ( this ) )
758761 this . connection . onColorPresentation ( this . onColorPresentation . bind ( this ) )
759762 this . connection . onCodeAction ( this . onCodeAction . bind ( this ) )
763+ this . connection . onCodeLens ( this . onCodeLens . bind ( this ) )
760764 this . connection . onDocumentLinks ( this . onDocumentLinks . bind ( this ) )
761765 this . connection . onRequest ( this . onRequest . bind ( this ) )
762766 }
@@ -809,6 +813,7 @@ export class TW {
809813 capabilities . add ( HoverRequest . type , { documentSelector : null } )
810814 capabilities . add ( DocumentColorRequest . type , { documentSelector : null } )
811815 capabilities . add ( CodeActionRequest . type , { documentSelector : null } )
816+ capabilities . add ( CodeLensRequest . type , { documentSelector : null } )
812817 capabilities . add ( DocumentLinkRequest . type , { documentSelector : null } )
813818
814819 capabilities . add ( CompletionRequest . type , {
@@ -931,6 +936,11 @@ export class TW {
931936 return this . getProject ( params . textDocument ) ?. onCodeAction ( params ) ?? null
932937 }
933938
939+ async onCodeLens ( params : CodeLensParams ) : Promise < CodeLens [ ] > {
940+ await this . init ( )
941+ return this . getProject ( params . textDocument ) ?. onCodeLens ( params ) ?? null
942+ }
943+
934944 async onDocumentLinks ( params : DocumentLinkParams ) : Promise < DocumentLink [ ] > {
935945 await this . init ( )
936946 return this . getProject ( params . textDocument ) ?. onDocumentLinks ( params ) ?? null
@@ -961,6 +971,9 @@ export class TW {
961971 hoverProvider : true ,
962972 colorProvider : true ,
963973 codeActionProvider : true ,
974+ codeLensProvider : {
975+ resolveProvider : false ,
976+ } ,
964977 documentLinkProvider : { } ,
965978 completionProvider : {
966979 resolveProvider : true ,
0 commit comments