@@ -21,22 +21,17 @@ export function Container () {
21
21
}
22
22
}
23
23
24
- // const handleOpenErrorLocation = async (location: string, startRange: string) => {
25
- // if (location) {
26
- // const fullPathLocation = await circuitApp.plugin.resolveReportPath(location)
24
+ const handleOpenErrorLocation = async ( location : string , startRange : string ) => {
25
+ if ( location ) {
26
+ const fullPathLocation = await circuitApp . plugin . resolveReportPath ( location )
27
27
28
- // await circuitApp.plugin.call('fileManager', 'open', fullPathLocation)
29
- // // @ts -ignore
30
- // const startPosition: { lineNumber: number; column: number } = await circuitApp.plugin.call('editor', 'getPositionAt', startRange)
31
- // // @ts -ignore
32
- // await circuitApp.plugin.call('editor', 'gotoLine', startPosition.lineNumber - 1, startPosition.column)
33
- // }
34
- // }
35
-
36
- // const handlePrimeChange = (value: PrimeValue) => {
37
- // circuitApp.plugin.compilerPrime = value
38
- // circuitApp.dispatch({ type: 'SET_PRIME_VALUE', payload: value as PrimeValue })
39
- // }
28
+ await circuitApp . plugin . call ( 'fileManager' , 'open' , fullPathLocation )
29
+ // @ts -ignore
30
+ const startPosition : { lineNumber : number ; column : number } = await circuitApp . plugin . call ( 'editor' , 'getPositionAt' , startRange )
31
+ // @ts -ignore
32
+ await circuitApp . plugin . call ( 'editor' , 'gotoLine' , startPosition . lineNumber - 1 , startPosition . column )
33
+ }
34
+ }
40
35
41
36
const handleCircuitAutoCompile = ( value : boolean ) => {
42
37
noirApp . dispatch ( { type : 'SET_AUTO_COMPILE' , payload : value } )
@@ -46,48 +41,48 @@ export function Container () {
46
41
noirApp . dispatch ( { type : 'SET_HIDE_WARNINGS' , payload : value } )
47
42
}
48
43
49
- // const askGPT = async (report: CompilerReport) => {
50
- // if (report.labels.length > 0) {
51
- // const location = circuitApp.appState.filePathToId[report.labels[0].file_id]
52
- // const error = report.labels[0].message
44
+ const askGPT = async ( report : CompilerReport ) => {
45
+ if ( report . labels . length > 0 ) {
46
+ const location = circuitApp . appState . filePathToId [ report . labels [ 0 ] . file_id ]
47
+ const error = report . labels [ 0 ] . message
53
48
54
- // if (location) {
55
- // const fullPathLocation = await circuitApp.plugin.resolveReportPath(location)
56
- // const content = await circuitApp.plugin.call('fileManager', 'readFile', fullPathLocation)
57
- // const message = `
58
- // circom code: ${content}
59
- // error message: ${error}
60
- // full circom error: ${JSON.stringify(report, null, 2)}
61
- // explain why the error occurred and how to fix it.
62
- // `
63
- // await circuitApp.plugin.call('popupPanel' as any, 'showPopupPanel', true)
64
- // setTimeout(async () => {
65
- // await circuitApp.plugin.call('remixAI' as any, 'chatPipe', 'error_explaining', message)
66
- // }, 500)
67
- // } else {
68
- // const message = `
69
- // error message: ${error}
70
- // full circom error: ${JSON.stringify(report, null, 2)}
71
- // explain why the error occurred and how to fix it.
72
- // `
73
- // await circuitApp.plugin.call('popupPanel' as any, 'showPopupPanel', true)
74
- // setTimeout(async () => {
75
- // await circuitApp.plugin.call('remixAI' as any, 'chatPipe', 'error_explaining', message)
76
- // }, 500)
77
- // }
78
- // } else {
79
- // const error = report.message
80
- // const message = `
81
- // error message: ${error}
82
- // full circom error: ${JSON.stringify(report, null, 2)}
83
- // explain why the error occurred and how to fix it.
84
- // `
85
- // await circuitApp.plugin.call('popupPanel' as any, 'showPopupPanel', true)
86
- // setTimeout(async () => {
87
- // await circuitApp.plugin.call('remixAI' as any, 'chatPipe', 'error_explaining', message)
88
- // }, 500)
89
- // }
90
- // }
49
+ if ( location ) {
50
+ const fullPathLocation = await circuitApp . plugin . resolveReportPath ( location )
51
+ const content = await circuitApp . plugin . call ( 'fileManager' , 'readFile' , fullPathLocation )
52
+ const message = `
53
+ circom code: ${ content }
54
+ error message: ${ error }
55
+ full circom error: ${ JSON . stringify ( report , null , 2 ) }
56
+ explain why the error occurred and how to fix it.
57
+ `
58
+ await circuitApp . plugin . call ( 'popupPanel' as any , 'showPopupPanel' , true )
59
+ setTimeout ( async ( ) => {
60
+ await circuitApp . plugin . call ( 'remixAI' as any , 'chatPipe' , 'error_explaining' , message )
61
+ } , 500 )
62
+ } else {
63
+ const message = `
64
+ error message: ${ error }
65
+ full circom error: ${ JSON . stringify ( report , null , 2 ) }
66
+ explain why the error occurred and how to fix it.
67
+ `
68
+ await circuitApp . plugin . call ( 'popupPanel' as any , 'showPopupPanel' , true )
69
+ setTimeout ( async ( ) => {
70
+ await circuitApp . plugin . call ( 'remixAI' as any , 'chatPipe' , 'error_explaining' , message )
71
+ } , 500 )
72
+ }
73
+ } else {
74
+ const error = report . message
75
+ const message = `
76
+ error message: ${ error }
77
+ full circom error: ${ JSON . stringify ( report , null , 2 ) }
78
+ explain why the error occurred and how to fix it.
79
+ `
80
+ await circuitApp . plugin . call ( 'popupPanel' as any , 'showPopupPanel' , true )
81
+ setTimeout ( async ( ) => {
82
+ await circuitApp . plugin . call ( 'remixAI' as any , 'chatPipe' , 'error_explaining' , message )
83
+ } , 500 )
84
+ }
85
+ }
91
86
92
87
const handleCompileClick = ( ) => {
93
88
compileNoirCircuit ( noirApp . plugin , noirApp . appState )
@@ -113,9 +108,9 @@ export function Container () {
113
108
< div className = "pb-2" >
114
109
< CompileBtn id = "noir" plugin = { noirApp . plugin } appState = { noirApp . appState } compileAction = { handleCompileClick } />
115
110
</ div >
116
- { /* <RenderIf condition={circuitApp .appState.status !== 'compiling'}>
117
- <CompilerFeedback feedback={circuitApp .appState.compilerFeedback} filePathToId={circuitApp .appState.filePathToId} openErrorLocation={handleOpenErrorLocation} hideWarnings={circuitApp .appState.hideWarnings} askGPT={askGPT} />
118
- </RenderIf> */ }
111
+ < RenderIf condition = { noirApp . appState . status !== 'compiling' } >
112
+ < CompilerFeedback feedback = { noirApp . appState . compilerFeedback } filePathToId = { noirApp . appState . filePathToId } openErrorLocation = { handleOpenErrorLocation } hideWarnings = { noirApp . appState . hideWarnings } askGPT = { askGPT } />
113
+ </ RenderIf >
119
114
</ div >
120
115
</ div >
121
116
</ article >
0 commit comments