44// Import the module and reference it with the alias vscode in your code below
55import * as vscode from 'vscode' ;
66import { FileExplorerProvider , checkedItems as checkedItemsMap , FileItem } from './fileExplorer' ;
7- import { generatePrompt as generatePromptFromGenerator , copyToClipboard } from './promptGenerator' ;
7+ import { generatePrompt , copyToClipboard } from './promptGenerator' ;
88import { PromptCodeWebViewProvider } from './webviewProvider' ;
9- import { countTokensInFile , countTokensWithCache , countTokensWithCacheDetailed , clearTokenCache , initializeTokenCounter , tokenCache , countTokens , buildPrompt } from '@promptcode/core' ;
9+ import { countTokensInFile , countTokensWithCache , countTokensWithCacheDetailed , clearTokenCache , initializeTokenCounter , tokenCache , countTokens } from '@promptcode/core' ;
1010import * as path from 'path' ;
1111import * as fs from 'fs' ;
1212import * as os from 'os' ;
@@ -1677,59 +1677,6 @@ function isValidIncludeOptions(options: any): options is { files: boolean; instr
16771677 typeof options . instructions === 'boolean' ;
16781678}
16791679
1680- // Helper function to generate prompt using core's buildPrompt
1681- async function generatePrompt (
1682- selectedFiles : {
1683- path : string ;
1684- tokenCount : number ;
1685- workspaceFolderRootPath ?: string ;
1686- absolutePath ?: string ;
1687- workspaceFolderName ?: string ;
1688- } [ ] ,
1689- instructions : string ,
1690- includeOptions : { files : boolean ; instructions : boolean }
1691- ) : Promise < string > {
1692- const startTime = performance . now ( ) ;
1693-
1694- // Early returns for edge cases (per O3-pro recommendation)
1695- if ( ! includeOptions . files && ( ! instructions || ! includeOptions . instructions ) ) {
1696- const endTime = performance . now ( ) ;
1697- console . log ( `Prompt generation took ${ endTime - startTime } ms for ${ selectedFiles . length } files` ) ;
1698- return '' ;
1699- }
1700-
1701- // Early return if no files selected but files are required
1702- if ( selectedFiles . length === 0 && includeOptions . files ) {
1703- const endTime = performance . now ( ) ;
1704- console . log ( `Prompt generation took ${ endTime - startTime } ms - no files selected` ) ;
1705- return includeOptions . instructions ? instructions : '' ;
1706- }
1707-
1708- // Convert to SelectedFile format expected by core
1709- const coreSelectedFiles : SelectedFile [ ] = selectedFiles . map ( file => ( {
1710- path : file . path ,
1711- absolutePath : file . absolutePath || path . join ( file . workspaceFolderRootPath || '' , file . path ) ,
1712- tokenCount : file . tokenCount ,
1713- workspaceFolderRootPath : file . workspaceFolderRootPath || '' ,
1714- workspaceFolderName : file . workspaceFolderName || ''
1715- } ) ) ;
1716-
1717- // Use core's buildPrompt
1718- const result = await buildPrompt ( coreSelectedFiles , instructions , {
1719- includeFiles : includeOptions . files ,
1720- includeInstructions : includeOptions . instructions ,
1721- includeFileContents : includeOptions . files
1722- } ) ;
1723-
1724- // No transformation needed - core now uses standard tags
1725- const prompt = result . prompt ;
1726-
1727- const endTime = performance . now ( ) ;
1728- console . log ( `Prompt generation took ${ endTime - startTime } ms for ${ selectedFiles . length } files` ) ;
1729-
1730- return prompt ;
1731- }
1732-
17331680// Helper function to get selected files with content
17341681async function getSelectedFilesWithContent ( ) : Promise < SelectedFile [ ] > {
17351682 if ( ! vscode . workspace . workspaceFolders || vscode . workspace . workspaceFolders . length === 0 ) {
@@ -1857,4 +1804,4 @@ export async function savePromptToFile(prompt: string, context?: vscode.Extensio
18571804 // ... error telemetry code ...
18581805 }
18591806}
1860- // --- End Save to file feature ---
1807+ // --- End Save to file feature ---
0 commit comments