This repository was archived by the owner on Feb 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
crates/cursor-core/src/project Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ enum Task {
2424 Append ( String ) ,
2525}
2626
27+ impl Task {
28+ fn title ( & self ) -> & str {
29+ match self {
30+ Task :: Step ( title) => title,
31+ Task :: Create ( title) => title,
32+ Task :: Append ( title) => title,
33+ }
34+ }
35+ }
36+
2737#[ wasm_bindgen( js_name = generateProject) ]
2838pub async fn generate_project ( prompt : & str ) -> Result < JsValue , JsValue > {
2939 let prompt = prompt. to_owned ( ) ;
@@ -67,9 +77,16 @@ pub async fn generate_project(prompt: &str) -> Result<JsValue, JsValue> {
6777
6878 // The message sent by the report will automatically disappear after a short period of time.
6979 // In order to keep the text displayed on the dialog box, report the title every time data is returned.
80+ if current_task. is_some( ) {
81+ progress. report( current_task. as_ref( ) . unwrap( ) . title( ) ) ;
82+ continue ;
83+ }
7084 match & current_task {
71- Some ( Task :: Step ( title) | Task :: Create ( title) | Task :: Append ( title) ) => {
72- progress. report( & title) ;
85+ Some ( Task :: Create ( _) ) => {
86+ todo!( )
87+ }
88+ Some ( Task :: Append ( _) ) => {
89+ todo!( )
7390 }
7491 _ => { }
7592 }
Original file line number Diff line number Diff line change @@ -5,13 +5,9 @@ import { GenerateSession, getScratchpadManager } from "./generate";
55import { getGlobalState } from "./globalState" ;
66import { ChatPanelProvider } from "./chat/chatPanelProvider" ;
77import { sharedChatServiceImpl } from "./chat/chatServiceImpl" ;
8- import {
9- generateProject ,
10- setExtensionContext ,
11- signIn ,
12- signOut ,
13- } from "@crates/cursor-core" ;
8+ import { setExtensionContext , signIn , signOut } from "@crates/cursor-core" ;
149import { ExtensionContext } from "./context" ;
10+ import { handleGenerateProjectCommand } from "./project" ;
1511
1612function setHasActiveGenerateSessionContext ( value : boolean ) {
1713 vscode . commands . executeCommand (
@@ -95,7 +91,7 @@ export function activate(context: vscode.ExtensionContext) {
9591 ) ;
9692 } ) ,
9793 vscode . commands . registerCommand ( "aicursor.generateProject" , ( ) => {
98- generateProject ( "a new Unity project" ) ;
94+ handleGenerateProjectCommand ( ) ;
9995 } ) ,
10096 getScratchpadManager ( ) . registerTextDocumentContentProvider ( ) ,
10197 vscode . window . registerWebviewViewProvider (
Original file line number Diff line number Diff line change 1+ import * as vscode from "vscode" ;
2+ import { generateProject } from "@crates/cursor-core" ;
3+
4+ export async function handleGenerateProjectCommand ( ) {
5+ const input = await vscode . window . showInputBox ( {
6+ title : "Generate A New Project" ,
7+ placeHolder : "Instructions for project to generate..." ,
8+ } ) ;
9+ if ( ! input ) {
10+ return ;
11+ }
12+ await generateProject ( input ) ;
13+ }
You can’t perform that action at this time.
0 commit comments