( beforeAfterdiff: BeforeAfterDiff, cursorPosBeforeEdit: Position, cursorPosAfterPrevEdit: Position, configHandler: ConfigHandler, getDefsFromLspFunction: GetLspDefinitionsFunction, ide: IDE, )
| 8 | import { processNextEditData } from "./processNextEditData"; |
| 9 | |
| 10 | export const processSmallEdit = async ( |
| 11 | beforeAfterdiff: BeforeAfterDiff, |
| 12 | cursorPosBeforeEdit: Position, |
| 13 | cursorPosAfterPrevEdit: Position, |
| 14 | configHandler: ConfigHandler, |
| 15 | getDefsFromLspFunction: GetLspDefinitionsFunction, |
| 16 | ide: IDE, |
| 17 | ) => { |
| 18 | // Get the current context data from the most recent message |
| 19 | const currentData = (EditAggregator.getInstance() as any) |
| 20 | .latestContextData || { |
| 21 | configHandler: configHandler, |
| 22 | getDefsFromLspFunction: getDefsFromLspFunction, |
| 23 | recentlyEditedRanges: [], |
| 24 | recentlyVisitedRanges: [], |
| 25 | }; |
| 26 | |
| 27 | if (!isSecurityConcern(beforeAfterdiff.filePath)) { |
| 28 | NextEditProvider.getInstance().addDiffToContext( |
| 29 | createDiff({ |
| 30 | beforeContent: beforeAfterdiff.beforeContent, |
| 31 | afterContent: beforeAfterdiff.afterContent, |
| 32 | filePath: beforeAfterdiff.filePath, |
| 33 | diffType: DiffFormatType.Unified, |
| 34 | contextLines: 3, // NOTE: This can change depending on experiments! |
| 35 | workspaceDir: currentData.workspaceDir, |
| 36 | }), |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | void processNextEditData({ |
| 41 | filePath: beforeAfterdiff.filePath, |
| 42 | beforeContent: beforeAfterdiff.beforeContent, |
| 43 | afterContent: beforeAfterdiff.afterContent, |
| 44 | cursorPosBeforeEdit: cursorPosBeforeEdit, |
| 45 | cursorPosAfterPrevEdit: cursorPosAfterPrevEdit, |
| 46 | ide: ide, |
| 47 | configHandler: currentData.configHandler, |
| 48 | getDefinitionsFromLsp: currentData.getDefsFromLspFunction, |
| 49 | recentlyEditedRanges: currentData.recentlyEditedRanges, |
| 50 | recentlyVisitedRanges: currentData.recentlyVisitedRanges, |
| 51 | workspaceDir: currentData.workspaceDir, |
| 52 | }); |
| 53 | }; |
no test coverage detected