1- import { defineExtension , useDisposable } from 'reactive-vscode'
1+ import { defineExtension , useDisposable , useCommand } from 'reactive-vscode'
22import { extensions , window } from 'vscode'
3- import { registerCommands } from './commands'
3+ // import { registerCommands } from './commands'
4+ import { currentMode } from "./neovimModeManager"
45import { setupNeovimModeManager } from './neovimModeManager'
56import { setupThemeManager } from './themeManager'
67import { logger } from './utils'
@@ -29,6 +30,8 @@ const { activate, deactivate } = defineExtension(async () => {
2930 return
3031 }
3132 }
33+
34+
3235 // Set up the mode manager
3336 const modeManager = setupNeovimModeManager ( )
3437 useDisposable ( { dispose : modeManager } )
@@ -38,7 +41,24 @@ const { activate, deactivate } = defineExtension(async () => {
3841 useDisposable ( { dispose : themeManager } )
3942
4043 // Register command to update mode from Neovim
41- registerCommands ( )
44+ // registerCommands()
45+ //
46+ // Register a command to receive mode updates from Neovim
47+ useCommand ( 'nvim-ui-plus.setMode' , ( args : { mode : string } ) => {
48+ if ( ! args || typeof args . mode !== 'string' ) {
49+ logger . warn ( `Received invalid args:` , args )
50+ return false
51+ }
52+
53+ logger . info ( `Mode changed to: ${ args . mode } (via Neovim autocommand)` )
54+ currentMode . value = args . mode
55+ return true
56+ } )
57+
58+ // Add a command to check the current mode
59+ useCommand ( 'nvim-ui-plus.showCurrentMode' , ( ) => {
60+ window . showInformationMessage ( `Current Neovim mode: ${ currentMode . value } ` )
61+ } )
4262} )
4363
4464export { activate , deactivate }
0 commit comments