@@ -32,11 +32,6 @@ export function activate(context: ExtensionContext) {
3232 // 获取初始配置
3333 updateFeatureStatus ( ) ;
3434
35- context . subscriptions . push ( vscode . languages . registerCodeLensProvider (
36- [ { pattern : '**/*.sql' } , { pattern : '**/*.fql' } ] ,
37- new FqlCodeLensProvider ( )
38- ) ) ;
39-
4035 context . subscriptions . push ( vscode . languages . registerReferenceProvider (
4136 [ { pattern : '**/*.sql' } , { pattern : '**/*.fql' } ] ,
4237 new FqlReferenceProvider ( )
@@ -149,55 +144,6 @@ class FqlRenameProvider implements vscode.RenameProvider {
149144}
150145
151146
152-
153- class FqlCodeLensProvider implements vscode . CodeLensProvider {
154-
155-
156- provideCodeLenses ( document : vscode . TextDocument , token : vscode . CancellationToken ) : vscode . ProviderResult < vscode . CodeLens [ ] > {
157- const codeLenses = [ ] ;
158- for ( let line = 0 ; line < document . lineCount ; line ++ ) {
159- const lineOfCode = document . lineAt ( line ) ;
160- // 添加你的SQL语法检测逻辑
161- if ( / C R E A T E T E M P O R A R Y | C R E A T E T A B L E / i. test ( lineOfCode . text ) ) {
162- codeLenses . push ( new vscode . CodeLens ( lineOfCode . range ) ) ;
163- }
164- }
165- return codeLenses ;
166- }
167- resolveCodeLens ?( codeLens : vscode . CodeLens , token : vscode . CancellationToken ) : vscode . ProviderResult < vscode . CodeLens > {
168- const editor = vscode . window . activeTextEditor ;
169- if ( ! editor ) {
170- return ;
171- }
172-
173- const document = editor . document ;
174- const tableName = document . getText ( codeLens . range ) ;
175- const references = this . findReferences ( document , tableName ) ;
176-
177- if ( references . length > 0 ) {
178- codeLens . command = {
179- title : `${ references . length } reference(s) to ${ tableName } ` ,
180- command : "extension.showReferences" ,
181- arguments : [ document . uri , codeLens . range . start , references ]
182- } ;
183- }
184- return codeLens ;
185- }
186-
187- findReferences ( document : vscode . TextDocument | undefined , tableName : string | undefined ) : vscode . Range [ ] {
188- const references = [ ] ;
189- if ( document && tableName ) {
190- for ( let line = 0 ; line < document . lineCount ; line ++ ) {
191- const lineOfCode = document . lineAt ( line ) ;
192- if ( lineOfCode . text . includes ( tableName ) ) {
193- references . push ( lineOfCode . range ) ;
194- }
195- }
196- }
197- return references ;
198- }
199- }
200-
201147class FqlReferenceProvider implements vscode . ReferenceProvider {
202148 provideReferences ( document : vscode . TextDocument , position : vscode . Position , options : { includeDeclaration : boolean } , token : vscode . CancellationToken ) : vscode . ProviderResult < vscode . Location [ ] > {
203149 const wordRange = document . getWordRangeAtPosition ( position ) ;
0 commit comments