@@ -4,7 +4,7 @@ import type { Document } from 'bson';
44
55import type ActiveConnectionCodeLensProvider from './activeConnectionCodeLensProvider' ;
66import type ExportToLanguageCodeLensProvider from './exportToLanguageCodeLensProvider' ;
7- import PlaygroundSelectedCodeActionProvider from './playgroundSelectedCodeActionProvider ' ;
7+ import PlaygroundSelectionCodeActionProvider from './playgroundSelectionCodeActionProvider ' ;
88import PlaygroundDiagnosticsCodeActionProvider from './playgroundDiagnosticsCodeActionProvider' ;
99import type ConnectionController from '../connectionController' ;
1010import CollectionDocumentsCodeLensProvider from './collectionDocumentsCodeLensProvider' ;
@@ -38,7 +38,7 @@ const log = createLogger('editors controller');
3838export function getFileDisplayNameForDocument (
3939 documentId : any ,
4040 namespace : string
41- ) {
41+ ) : string {
4242 let displayName = `${ namespace } :${ EJSON . stringify ( documentId ) } ` ;
4343
4444 // Encode special file uri characters to ensure VSCode handles
@@ -84,7 +84,7 @@ export function getViewCollectionDocumentsUri(
8484 * new editors and the data they need. It also manages active editors.
8585 */
8686export default class EditorsController {
87- _playgroundSelectedCodeActionProvider : PlaygroundSelectedCodeActionProvider ;
87+ _playgroundSelectionCodeActionProvider : PlaygroundSelectionCodeActionProvider ;
8888 _playgroundDiagnosticsCodeActionProvider : PlaygroundDiagnosticsCodeActionProvider ;
8989 _connectionController : ConnectionController ;
9090 _playgroundController : PlaygroundController ;
@@ -97,7 +97,7 @@ export default class EditorsController {
9797 _documentIdStore : DocumentIdStore ;
9898 _mongoDBDocumentService : MongoDBDocumentService ;
9999 _telemetryService : TelemetryService ;
100- _playgroundResultViewProvider : PlaygroundResultProvider ;
100+ _playgroundResultProvider : PlaygroundResultProvider ;
101101 _activeConnectionCodeLensProvider : ActiveConnectionCodeLensProvider ;
102102 _exportToLanguageCodeLensProvider : ExportToLanguageCodeLensProvider ;
103103 _editDocumentCodeLensProvider : EditDocumentCodeLensProvider ;
@@ -109,10 +109,10 @@ export default class EditorsController {
109109 playgroundController,
110110 statusView,
111111 telemetryService,
112- playgroundResultViewProvider ,
112+ playgroundResultProvider ,
113113 activeConnectionCodeLensProvider,
114114 exportToLanguageCodeLensProvider,
115- playgroundSelectedCodeActionProvider ,
115+ playgroundSelectionCodeActionProvider ,
116116 playgroundDiagnosticsCodeActionProvider,
117117 editDocumentCodeLensProvider,
118118 } : {
@@ -121,10 +121,10 @@ export default class EditorsController {
121121 playgroundController : PlaygroundController ;
122122 statusView : StatusView ;
123123 telemetryService : TelemetryService ;
124- playgroundResultViewProvider : PlaygroundResultProvider ;
124+ playgroundResultProvider : PlaygroundResultProvider ;
125125 activeConnectionCodeLensProvider : ActiveConnectionCodeLensProvider ;
126126 exportToLanguageCodeLensProvider : ExportToLanguageCodeLensProvider ;
127- playgroundSelectedCodeActionProvider : PlaygroundSelectedCodeActionProvider ;
127+ playgroundSelectionCodeActionProvider : PlaygroundSelectionCodeActionProvider ;
128128 playgroundDiagnosticsCodeActionProvider : PlaygroundDiagnosticsCodeActionProvider ;
129129 editDocumentCodeLensProvider : EditDocumentCodeLensProvider ;
130130 } ) {
@@ -149,15 +149,15 @@ export default class EditorsController {
149149 statusView : new StatusView ( context ) ,
150150 editDocumentCodeLensProvider : this . _editDocumentCodeLensProvider ,
151151 } ) ;
152- this . _playgroundResultViewProvider = playgroundResultViewProvider ;
152+ this . _playgroundResultProvider = playgroundResultProvider ;
153153 this . _activeConnectionCodeLensProvider = activeConnectionCodeLensProvider ;
154154 this . _exportToLanguageCodeLensProvider = exportToLanguageCodeLensProvider ;
155155 this . _collectionDocumentsCodeLensProvider =
156156 new CollectionDocumentsCodeLensProvider (
157157 this . _collectionDocumentsOperationsStore
158158 ) ;
159- this . _playgroundSelectedCodeActionProvider =
160- playgroundSelectedCodeActionProvider ;
159+ this . _playgroundSelectionCodeActionProvider =
160+ playgroundSelectionCodeActionProvider ;
161161 this . _playgroundDiagnosticsCodeActionProvider =
162162 playgroundDiagnosticsCodeActionProvider ;
163163
@@ -218,15 +218,14 @@ export default class EditorsController {
218218 }
219219
220220 async saveMongoDBDocument ( ) : Promise < boolean > {
221- const activeEditor = vscode . window . activeTextEditor ;
221+ const editor = vscode . window . activeTextEditor ;
222222
223- if ( ! activeEditor ) {
223+ if ( ! editor ) {
224224 await vscode . commands . executeCommand ( 'workbench.action.files.save' ) ;
225-
226225 return false ;
227226 }
228227
229- const uriParams = new URLSearchParams ( activeEditor . document . uri . query ) ;
228+ const uriParams = new URLSearchParams ( editor . document . uri . query ) ;
230229 const namespace = uriParams . get ( NAMESPACE_URI_IDENTIFIER ) ;
231230 const connectionId = uriParams . get ( CONNECTION_ID_URI_IDENTIFIER ) ;
232231 const documentIdReference = uriParams . get ( DOCUMENT_ID_URI_IDENTIFIER ) || '' ;
@@ -236,21 +235,21 @@ export default class EditorsController {
236235 ) as DocumentSource ;
237236
238237 if (
239- activeEditor . document . uri . scheme !== 'VIEW_DOCUMENT_SCHEME' ||
238+ editor . document . uri . scheme !== 'VIEW_DOCUMENT_SCHEME' ||
240239 ! namespace ||
241240 ! connectionId ||
242241 // A valid documentId can be false.
243242 documentId === null ||
244243 documentId === undefined
245244 ) {
246245 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 ( ) } `
248247 ) ;
249248 return false ;
250249 }
251250
252251 try {
253- const newDocument = EJSON . parse ( activeEditor . document . getText ( ) || '' ) ;
252+ const newDocument = EJSON . parse ( editor . document . getText ( ) || '' ) ;
254253
255254 await this . _mongoDBDocumentService . replaceDocument ( {
256255 namespace,
@@ -261,7 +260,7 @@ export default class EditorsController {
261260 } ) ;
262261
263262 // Save document changes to active editor.
264- await activeEditor ?. document . save ( ) ;
263+ await editor ?. document . save ( ) ;
265264
266265 void vscode . window . showInformationMessage (
267266 `The document was saved successfully to '${ namespace } '`
@@ -317,7 +316,6 @@ export default class EditorsController {
317316 . isCurrentlyFetchingMoreDocuments
318317 ) {
319318 void vscode . window . showErrorMessage ( 'Already fetching more documents...' ) ;
320-
321319 return Promise . resolve ( false ) ;
322320 }
323321
@@ -330,7 +328,6 @@ export default class EditorsController {
330328 void vscode . window . showErrorMessage (
331329 `Unable to view more documents: no longer connected to ${ oldConnectionName } `
332330 ) ;
333-
334331 return Promise . resolve ( false ) ;
335332 }
336333
@@ -399,7 +396,7 @@ export default class EditorsController {
399396 this . _context . subscriptions . push (
400397 vscode . workspace . registerTextDocumentContentProvider (
401398 PLAYGROUND_RESULT_SCHEME ,
402- this . _playgroundResultViewProvider
399+ this . _playgroundResultProvider
403400 )
404401 ) ;
405402 // REGISTER CODE LENSES PROVIDERS.
@@ -447,10 +444,10 @@ export default class EditorsController {
447444 this . _context . subscriptions . push (
448445 vscode . languages . registerCodeActionsProvider (
449446 'javascript' ,
450- this . _playgroundSelectedCodeActionProvider ,
447+ this . _playgroundSelectionCodeActionProvider ,
451448 {
452449 providedCodeActionKinds :
453- PlaygroundSelectedCodeActionProvider . providedCodeActionKinds ,
450+ PlaygroundSelectionCodeActionProvider . providedCodeActionKinds ,
454451 }
455452 )
456453 ) ;
0 commit comments