1- import { window , workspace } from 'vscode'
1+ import { ProgressLocation , window , workspace } from 'vscode'
22
33import { DocumentInfo } from '../libs/DocumentInfo'
44import { stackManager } from '../libs/stackManager'
@@ -9,28 +9,37 @@ import { getCurrentWorkspaceInfo } from '../utils/getCurrentWorkspaceInfo'
99import type { WebSocket } from 'ws'
1010
1111export async function sendCurrentDocument ( webSocket : WebSocket ) {
12- const excludeProjectInfo = workspace . getConfiguration ( 'openai-forge' ) . get < boolean > ( 'promt.excludeProjectInfo' )
13-
14- const currentWorkspaceInfo = ! excludeProjectInfo ? await getCurrentWorkspaceInfo ( ) : undefined
15- const currentOrStackDocumentInfos = stackManager . documentInfos . length
16- ? stackManager . documentInfos
17- : [ new DocumentInfo ( ) ]
18-
19- const maybeUserMessage = await window . showInputBox ( {
20- placeHolder : 'Just press enter to skip' ,
21- prompt : 'Do you want to add a message to the prompt?' ,
22- } )
23- const userMessage = maybeUserMessage && maybeUserMessage . trim ( ) . length > 0 ? maybeUserMessage : undefined
24-
25- const message = await formatPrompt ( currentOrStackDocumentInfos , {
26- userMessage,
27- workspaceInfo : currentWorkspaceInfo ,
28- } )
29-
30- const webSocketData : WebSocketData = {
31- action : WebSocketDataAction . ASK ,
32- message,
33- }
34-
35- webSocket . send ( JSON . stringify ( webSocketData ) )
12+ await window . withProgress (
13+ {
14+ location : ProgressLocation . Notification ,
15+ } ,
16+ async progress => {
17+ progress . report ( { message : 'OpenAI Forge: Detecting current project Technology Stack...' } )
18+
19+ const excludeProjectInfo = workspace . getConfiguration ( 'openai-forge' ) . get < boolean > ( 'promt.excludeProjectInfo' )
20+ const currentWorkspaceInfo = ! excludeProjectInfo ? await getCurrentWorkspaceInfo ( ) : undefined
21+ const currentOrStackDocumentInfos = stackManager . documentInfos . length
22+ ? stackManager . documentInfos
23+ : [ new DocumentInfo ( ) ]
24+
25+ const maybeUserMessage = await window . showInputBox ( {
26+ placeHolder : 'Just press enter to skip' ,
27+ prompt : 'Do you want to add a message to the prompt?' ,
28+ } )
29+ const userMessage = maybeUserMessage && maybeUserMessage . trim ( ) . length > 0 ? maybeUserMessage : undefined
30+
31+ progress . report ( { message : 'OpenAI Forge: Sending source code & errors to ChatGPT...' } )
32+
33+ const message = await formatPrompt ( currentOrStackDocumentInfos , {
34+ userMessage,
35+ workspaceInfo : currentWorkspaceInfo ,
36+ } )
37+ const webSocketData : WebSocketData = {
38+ action : WebSocketDataAction . ASK ,
39+ message,
40+ }
41+
42+ webSocket . send ( JSON . stringify ( webSocketData ) )
43+ } ,
44+ )
3645}
0 commit comments