brijeshb42 / monaco-vim

VIM keybindings for monaco editor
https://editor.bitwiser.in/
MIT License
291 stars 31 forks source link

It does not work in monaco-editor@0.51.0 #122

Open huiruo opened 2 months ago

huiruo commented 2 months ago

It is not effective in monaco-editor@0.51.0 (insert mode cannot be enabled), but it is effective in version 0.49.0 and can be used normally

caoccao commented 1 month ago

I'm having the same issue with monaco-editor@0.51.0.

brijeshb42 commented 4 days ago

I have deployed latest monaco-editor version 0.51.0 on the playground and it works there. Can you check ?

caoccao commented 4 days ago

Hi @brijeshb42 , thank you for the help. I just realized the issue might also be related to the react version. Here is the package.json for your reference.

  "dependencies": {
    "@emotion/react": "^11.13.3",
    "@emotion/styled": "^11.13.0",
    "@fontsource/roboto": "^5.1.0",
    "@monaco-editor/react": "^4.6.0",
    "@mui/icons-material": "^6.1.0",
    "@mui/material": "^6.1.0",
    "@tauri-apps/api": ">=2.0.0",
    "@tauri-apps/plugin-cli": "~2",
    "@tauri-apps/plugin-clipboard-manager": "^2.0.0",
    "@tauri-apps/plugin-dialog": "~2",
    "@tauri-apps/plugin-shell": ">=2.0.0",
    "monaco-editor": "0.49.0",
    "monaco-vim": "^0.4.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-draggable": "^4.4.6",
    "uuid": "^10.0.0"
  },
  "devDependencies": {
    "@tauri-apps/cli": ">=2.0.0",
    "@types/react": "^18.2.15",
    "@types/react-dom": "^18.2.7",
    "@types/uuid": "^10.0.0",
    "@vitejs/plugin-react": "^4.2.1",
    "typescript": "^5.6.3",
    "vite": "^5.4.8"
  }

I suspect the react version might be too high. Could you help verify that? The repo of my project using monaco-vim is here. It's a tauri app. You may run the following commands to build it, after setting up the tauri dev env.

pnpm install
pnpm tauri dev

You may also refer to the workflows for detail.

Thank you!

brijeshb42 commented 4 days ago

monaco-vim has nothing to do with React. If you think react is the issue, please provide a repo or codesandbox with minimal reproduction. Otherwise it seems to be an issue with your setup.

caoccao commented 3 days ago

I wonder as @monaco-editor/react is used, it might bring some side effects. The setup doesn't seem to be wrong to me because in the repo I provided "monaco-editor": "0.49.0" works with a minor defect (the cursor is not changed to a block in the normal mode), but "monaco-editor": "0.51.0" only works in the normal mode as @huiruo reported. The only change is as follows.

- "monaco-editor": "0.49.0"
+ "monaco-editor": "0.51.0"