File tree Expand file tree Collapse file tree 2 files changed +459
-51
lines changed Expand file tree Collapse file tree 2 files changed +459
-51
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,21 @@ const countAggregationStagesInString = (str: string) => {
9797 . length ;
9898} ;
9999
100+ enum TranspilerExportMode {
101+ PIPELINE = 'Pipeline' ,
102+ QUERY = 'Query' ,
103+ DELETE_QUERY = 'Delete Query' ,
104+ UPDATE_QUERY = 'Update Query' ,
105+ }
106+ const exportModeMapping : Record <
107+ ExportToLanguageMode ,
108+ TranspilerExportMode | undefined
109+ > = {
110+ [ ExportToLanguageMode . AGGREGATION ] : TranspilerExportMode . PIPELINE ,
111+ [ ExportToLanguageMode . QUERY ] : TranspilerExportMode . QUERY ,
112+ [ ExportToLanguageMode . OTHER ] : undefined ,
113+ } ;
114+
100115/**
101116 * This controller manages playground.
102117 */
@@ -807,7 +822,13 @@ export default class PlaygroundController {
807822 let imports = '' ;
808823
809824 if ( importStatements ) {
810- imports = transpiler . shell [ language ] . getImports ( driverSyntax ) ;
825+ const exportMode = this . _playgroundSelectedCodeActionProvider . mode
826+ ? exportModeMapping [ this . _playgroundSelectedCodeActionProvider . mode ]
827+ : undefined ;
828+ imports = transpiler . shell [ language ] . getImports (
829+ exportMode ,
830+ driverSyntax
831+ ) ;
811832 }
812833
813834 this . _playgroundResult = {
You can’t perform that action at this time.
0 commit comments