@@ -33,6 +33,7 @@ import { PackageInfo, TypesGenerationResult } from "./service/datamapper/types";
3333import { URI } from "vscode-uri" ;
3434import { getAllDataMapperSource } from "./service/datamapper/datamapper" ;
3535import { StateMachine } from "../../stateMachine" ;
36+ import { CopilotEventHandler } from "./service/event" ;
3637
3738// Set to false to include mappings with default values
3839const OMIT_DEFAULT_MAPPINGS_ENABLED = true ;
@@ -473,13 +474,15 @@ export async function createTempFileAndGenerateMetadata(params: CreateTempFileRe
473474
474475export async function generateMappings (
475476 metadataWithAttachments : MetadataWithAttachments ,
476- context : any
477+ context : any ,
478+ eventHandler : CopilotEventHandler
477479) : Promise < AllDataMapperSourceRequest > {
478480 const targetFilePath = metadataWithAttachments . metadata . codeData . lineRange . fileName || context . documentUri ;
479481
480482 const generatedMappings = await generateMappingExpressionsFromModel (
481483 metadataWithAttachments . metadata . mappingsModel as DMModel ,
482- metadataWithAttachments . attachments || [ ]
484+ metadataWithAttachments . attachments || [ ] ,
485+ eventHandler
483486 ) ;
484487
485488 const customFunctionMappings = generatedMappings . filter ( mapping => mapping . isFunctionCall ) ;
@@ -1060,6 +1063,7 @@ export async function generateInlineMappingsSource(
10601063 inlineMappingRequest : MetadataWithAttachments ,
10611064 langClient : ExtendedLangClient ,
10621065 context : any ,
1066+ eventHandler : CopilotEventHandler
10631067) : Promise < InlineMappingsSourceResult > {
10641068 if ( ! inlineMappingRequest ) {
10651069 throw new Error ( "Inline mapping request is required" ) ;
@@ -1096,16 +1100,18 @@ export async function generateInlineMappingsSource(
10961100
10971101 // Prepare mapping request payload
10981102 const mappingRequestPayload : MetadataWithAttachments = {
1099- metadata : tempFileMetadata
1103+ metadata : tempFileMetadata ,
1104+ attachments : [ ]
11001105 } ;
1101- if ( inlineMappingRequest . attachments && inlineMappingRequest . attachments . length > 0 ) {
1106+ if ( inlineMappingRequest . attachments . length > 0 ) {
11021107 mappingRequestPayload . attachments = inlineMappingRequest . attachments ;
11031108 }
11041109
11051110 // Generate mappings and source code
11061111 const allMappingsRequest = await generateMappings (
11071112 mappingRequestPayload ,
1108- context
1113+ context ,
1114+ eventHandler
11091115 ) ;
11101116
11111117 const generatedSourceResponse = await getAllDataMapperSource ( allMappingsRequest ) ;
0 commit comments