@@ -4,7 +4,7 @@ import type { Document } from 'bson';
4
4
5
5
import type ActiveConnectionCodeLensProvider from './activeConnectionCodeLensProvider' ;
6
6
import type ExportToLanguageCodeLensProvider from './exportToLanguageCodeLensProvider' ;
7
- import PlaygroundSelectedCodeActionProvider from './playgroundSelectedCodeActionProvider ' ;
7
+ import PlaygroundSelectionCodeActionProvider from './playgroundSelectionCodeActionProvider ' ;
8
8
import PlaygroundDiagnosticsCodeActionProvider from './playgroundDiagnosticsCodeActionProvider' ;
9
9
import type ConnectionController from '../connectionController' ;
10
10
import CollectionDocumentsCodeLensProvider from './collectionDocumentsCodeLensProvider' ;
@@ -38,7 +38,7 @@ const log = createLogger('editors controller');
38
38
export function getFileDisplayNameForDocument (
39
39
documentId : any ,
40
40
namespace : string
41
- ) {
41
+ ) : string {
42
42
let displayName = `${ namespace } :${ EJSON . stringify ( documentId ) } ` ;
43
43
44
44
// Encode special file uri characters to ensure VSCode handles
@@ -84,7 +84,7 @@ export function getViewCollectionDocumentsUri(
84
84
* new editors and the data they need. It also manages active editors.
85
85
*/
86
86
export default class EditorsController {
87
- _playgroundSelectedCodeActionProvider : PlaygroundSelectedCodeActionProvider ;
87
+ _playgroundSelectionCodeActionProvider : PlaygroundSelectionCodeActionProvider ;
88
88
_playgroundDiagnosticsCodeActionProvider : PlaygroundDiagnosticsCodeActionProvider ;
89
89
_connectionController : ConnectionController ;
90
90
_playgroundController : PlaygroundController ;
@@ -97,7 +97,7 @@ export default class EditorsController {
97
97
_documentIdStore : DocumentIdStore ;
98
98
_mongoDBDocumentService : MongoDBDocumentService ;
99
99
_telemetryService : TelemetryService ;
100
- _playgroundResultViewProvider : PlaygroundResultProvider ;
100
+ _playgroundResultProvider : PlaygroundResultProvider ;
101
101
_activeConnectionCodeLensProvider : ActiveConnectionCodeLensProvider ;
102
102
_exportToLanguageCodeLensProvider : ExportToLanguageCodeLensProvider ;
103
103
_editDocumentCodeLensProvider : EditDocumentCodeLensProvider ;
@@ -109,10 +109,10 @@ export default class EditorsController {
109
109
playgroundController,
110
110
statusView,
111
111
telemetryService,
112
- playgroundResultViewProvider ,
112
+ playgroundResultProvider ,
113
113
activeConnectionCodeLensProvider,
114
114
exportToLanguageCodeLensProvider,
115
- playgroundSelectedCodeActionProvider ,
115
+ playgroundSelectionCodeActionProvider ,
116
116
playgroundDiagnosticsCodeActionProvider,
117
117
editDocumentCodeLensProvider,
118
118
} : {
@@ -121,10 +121,10 @@ export default class EditorsController {
121
121
playgroundController : PlaygroundController ;
122
122
statusView : StatusView ;
123
123
telemetryService : TelemetryService ;
124
- playgroundResultViewProvider : PlaygroundResultProvider ;
124
+ playgroundResultProvider : PlaygroundResultProvider ;
125
125
activeConnectionCodeLensProvider : ActiveConnectionCodeLensProvider ;
126
126
exportToLanguageCodeLensProvider : ExportToLanguageCodeLensProvider ;
127
- playgroundSelectedCodeActionProvider : PlaygroundSelectedCodeActionProvider ;
127
+ playgroundSelectionCodeActionProvider : PlaygroundSelectionCodeActionProvider ;
128
128
playgroundDiagnosticsCodeActionProvider : PlaygroundDiagnosticsCodeActionProvider ;
129
129
editDocumentCodeLensProvider : EditDocumentCodeLensProvider ;
130
130
} ) {
@@ -149,15 +149,15 @@ export default class EditorsController {
149
149
statusView : new StatusView ( context ) ,
150
150
editDocumentCodeLensProvider : this . _editDocumentCodeLensProvider ,
151
151
} ) ;
152
- this . _playgroundResultViewProvider = playgroundResultViewProvider ;
152
+ this . _playgroundResultProvider = playgroundResultProvider ;
153
153
this . _activeConnectionCodeLensProvider = activeConnectionCodeLensProvider ;
154
154
this . _exportToLanguageCodeLensProvider = exportToLanguageCodeLensProvider ;
155
155
this . _collectionDocumentsCodeLensProvider =
156
156
new CollectionDocumentsCodeLensProvider (
157
157
this . _collectionDocumentsOperationsStore
158
158
) ;
159
- this . _playgroundSelectedCodeActionProvider =
160
- playgroundSelectedCodeActionProvider ;
159
+ this . _playgroundSelectionCodeActionProvider =
160
+ playgroundSelectionCodeActionProvider ;
161
161
this . _playgroundDiagnosticsCodeActionProvider =
162
162
playgroundDiagnosticsCodeActionProvider ;
163
163
@@ -218,15 +218,14 @@ export default class EditorsController {
218
218
}
219
219
220
220
async saveMongoDBDocument ( ) : Promise < boolean > {
221
- const activeEditor = vscode . window . activeTextEditor ;
221
+ const editor = vscode . window . activeTextEditor ;
222
222
223
- if ( ! activeEditor ) {
223
+ if ( ! editor ) {
224
224
await vscode . commands . executeCommand ( 'workbench.action.files.save' ) ;
225
-
226
225
return false ;
227
226
}
228
227
229
- const uriParams = new URLSearchParams ( activeEditor . document . uri . query ) ;
228
+ const uriParams = new URLSearchParams ( editor . document . uri . query ) ;
230
229
const namespace = uriParams . get ( NAMESPACE_URI_IDENTIFIER ) ;
231
230
const connectionId = uriParams . get ( CONNECTION_ID_URI_IDENTIFIER ) ;
232
231
const documentIdReference = uriParams . get ( DOCUMENT_ID_URI_IDENTIFIER ) || '' ;
@@ -236,21 +235,21 @@ export default class EditorsController {
236
235
) as DocumentSource ;
237
236
238
237
if (
239
- activeEditor . document . uri . scheme !== 'VIEW_DOCUMENT_SCHEME' ||
238
+ editor . document . uri . scheme !== 'VIEW_DOCUMENT_SCHEME' ||
240
239
! namespace ||
241
240
! connectionId ||
242
241
// A valid documentId can be false.
243
242
documentId === null ||
244
243
documentId === undefined
245
244
) {
246
245
void vscode . window . showErrorMessage (
247
- `The current file can not be saved as a MongoDB document. Invalid URL: ${ activeEditor . document . uri . toString ( ) } `
246
+ `The current file can not be saved as a MongoDB document. Invalid URL: ${ editor . document . uri . toString ( ) } `
248
247
) ;
249
248
return false ;
250
249
}
251
250
252
251
try {
253
- const newDocument = EJSON . parse ( activeEditor . document . getText ( ) || '' ) ;
252
+ const newDocument = EJSON . parse ( editor . document . getText ( ) || '' ) ;
254
253
255
254
await this . _mongoDBDocumentService . replaceDocument ( {
256
255
namespace,
@@ -261,7 +260,7 @@ export default class EditorsController {
261
260
} ) ;
262
261
263
262
// Save document changes to active editor.
264
- await activeEditor ?. document . save ( ) ;
263
+ await editor ?. document . save ( ) ;
265
264
266
265
void vscode . window . showInformationMessage (
267
266
`The document was saved successfully to '${ namespace } '`
@@ -317,7 +316,6 @@ export default class EditorsController {
317
316
. isCurrentlyFetchingMoreDocuments
318
317
) {
319
318
void vscode . window . showErrorMessage ( 'Already fetching more documents...' ) ;
320
-
321
319
return Promise . resolve ( false ) ;
322
320
}
323
321
@@ -330,7 +328,6 @@ export default class EditorsController {
330
328
void vscode . window . showErrorMessage (
331
329
`Unable to view more documents: no longer connected to ${ oldConnectionName } `
332
330
) ;
333
-
334
331
return Promise . resolve ( false ) ;
335
332
}
336
333
@@ -399,7 +396,7 @@ export default class EditorsController {
399
396
this . _context . subscriptions . push (
400
397
vscode . workspace . registerTextDocumentContentProvider (
401
398
PLAYGROUND_RESULT_SCHEME ,
402
- this . _playgroundResultViewProvider
399
+ this . _playgroundResultProvider
403
400
)
404
401
) ;
405
402
// REGISTER CODE LENSES PROVIDERS.
@@ -447,10 +444,10 @@ export default class EditorsController {
447
444
this . _context . subscriptions . push (
448
445
vscode . languages . registerCodeActionsProvider (
449
446
'javascript' ,
450
- this . _playgroundSelectedCodeActionProvider ,
447
+ this . _playgroundSelectionCodeActionProvider ,
451
448
{
452
449
providedCodeActionKinds :
453
- PlaygroundSelectedCodeActionProvider . providedCodeActionKinds ,
450
+ PlaygroundSelectionCodeActionProvider . providedCodeActionKinds ,
454
451
}
455
452
)
456
453
) ;
0 commit comments