File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
statusbar/src/lib/components Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ interface AIStatusProps {
14
14
export default function AIStatus ( props : AIStatusProps ) {
15
15
const [ copilotActive , setCopilotActive ] = useState ( false )
16
16
const appContext = useContext ( AppContext )
17
+
17
18
useEffect ( ( ) => {
18
-
19
19
const run = async ( ) => {
20
20
const aiActivate = await props . plugin . call ( 'settings' , 'get' , 'settings/copilot/suggest/activate' )
21
21
setCopilotActive ( aiActivate )
@@ -33,7 +33,7 @@ export default function AIStatus(props: AIStatusProps) {
33
33
} , 5000 ) ;
34
34
35
35
return ( ) => clearTimeout ( timer ) ;
36
- } , [ ] ) ;
36
+ } , [ ] )
37
37
38
38
useEffect ( ( ) => {
39
39
const run = async ( ) => {
@@ -43,7 +43,7 @@ export default function AIStatus(props: AIStatusProps) {
43
43
} )
44
44
}
45
45
run ( )
46
- } , [ props . plugin . isAiActive , props . plugin . isAiActive ] )
46
+ } , [ props . plugin . isAiActive , props . isAiActive ] )
47
47
48
48
return (
49
49
< div >
Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ export const TabsUI = (props: TabsUIProps) => {
86
86
} )
87
87
}
88
88
} , [ tabsState . selectedIndex ] )
89
+ // Toggle the copilot in editor when clicked to update in status bar
90
+ useEffect ( ( ) => {
91
+ const run = async ( ) => {
92
+ props . plugin . on ( 'settings' , 'copilotChoiceUpdated' , async ( isChecked ) => {
93
+ setAI_switch ( isChecked )
94
+ } )
95
+ }
96
+ if ( tabsState . currentExt === 'sol' ) run ( )
97
+ } , [ tabsState . currentExt ] )
89
98
90
99
const getAI = async ( ) => {
91
100
try {
You can’t perform that action at this time.
0 commit comments