@@ -123,32 +123,30 @@ export class OperationCodeLensProvider extends ComputedCodeLensProvider {
123
123
}
124
124
}
125
125
126
- if ( projectId ) {
127
- const comments = findCommentsBlocks ( documentText ) ;
128
- for ( let i = 0 ; i < comments . length ; i ++ ) {
129
- const c = comments [ i ] ;
130
- const range = new vscode . Range ( c . startLine , 0 , c . startLine , 0 ) ;
131
- const queryDoc = documentNode . definitions . find ( ( d ) =>
132
- d . kind === Kind . OPERATION_DEFINITION &&
133
- // startToken.line is 1-indexed, endLine is 0-indexed
134
- d . loc ?. startToken . line === c . endLine + 2
135
- ) ;
136
- const arg : GenerateOperationInput = {
137
- projectId,
138
- document : document ,
139
- description : c . text ,
140
- insertPosition : c . endIndex + 1 ,
141
- existingQuery : queryDoc ?. loc ? documentText . substring ( c . endIndex + 1 , queryDoc . loc . endToken . end ) : '' ,
142
- } ;
143
- codeLenses . push (
144
- new vscode . CodeLens ( range , {
145
- title : queryDoc ? `$(sparkle) Refine Operation` : `$(sparkle) Generate Operation` ,
146
- command : "firebase.dataConnect.generateOperation" ,
147
- tooltip : "Generate the operation (⌘+enter or Ctrl+Enter)" ,
148
- arguments : [ arg ] ,
149
- } ) ,
150
- ) ;
151
- }
126
+ const comments = findCommentsBlocks ( documentText ) ;
127
+ for ( let i = 0 ; i < comments . length ; i ++ ) {
128
+ const c = comments [ i ] ;
129
+ const range = new vscode . Range ( c . startLine , 0 , c . startLine , 0 ) ;
130
+ const queryDoc = documentNode . definitions . find ( ( d ) =>
131
+ d . kind === Kind . OPERATION_DEFINITION &&
132
+ // startToken.line is 1-indexed, endLine is 0-indexed
133
+ d . loc ?. startToken . line === c . endLine + 2
134
+ ) ;
135
+ const arg : GenerateOperationInput = {
136
+ projectId,
137
+ document : document ,
138
+ description : c . text ,
139
+ insertPosition : c . endIndex + 1 ,
140
+ existingQuery : queryDoc ?. loc ? documentText . substring ( c . endIndex + 1 , queryDoc . loc . endToken . end ) : '' ,
141
+ } ;
142
+ codeLenses . push (
143
+ new vscode . CodeLens ( range , {
144
+ title : queryDoc ? `$(sparkle) Refine Operation` : `$(sparkle) Generate Operation` ,
145
+ command : "firebase.dataConnect.generateOperation" ,
146
+ tooltip : "Generate the operation (⌘+enter or Ctrl+Enter)" ,
147
+ arguments : [ arg ] ,
148
+ } ) ,
149
+ ) ;
152
150
}
153
151
return codeLenses ;
154
152
}
0 commit comments