Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support vim mode #35

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kahosan
Copy link
Contributor

@kahosan kahosan commented Aug 31, 2023

No description provided.

@NWYLZW
Copy link
Member

NWYLZW commented Sep 1, 2023

image

Power Playground splits several hooks to handle logic.


Power Playground 拆分了几个钩子来处理逻辑。

  • use 用来自己在 editor zone 里面加 react hook。

    他会去消费一些基础参数,然后提供一个在 plugin 整个除此外都能访问到的被分享到数据内容。

  • useShare 可以在 rerender 的时候去消费 share state,同时也会获取到 monaco 的实例。也支持再其中使用 react hook,他的特点是在 use 的后面执行,从而能拿到所有的插件 share 出来的 state。

  • preload 则是 useEffect monaco 的包装器,他会在 monaco 被挂载后执行,简化一些需要对 monaco 进行操作的内容,比如快捷键,指令等。

  • load 则是在 editor 被挂载后触发。

preload 和 load 还有一个特点便是会 watch plugin 的改变,并不是每次都去执行的。

没写文档,给你一些我的设计思想给你作为参考(我就不翻译成英语了😭)

@kahosan
Copy link
Contributor Author

kahosan commented Sep 4, 2023

光标选中汉字的时候宽度有点问题,只有汉字的一半宽
可能是 monaco 这块的问题,尝试把 vim mode 关掉后,手动设置宽度一样会被覆盖掉

image image

@NWYLZW
Copy link
Member

NWYLZW commented Sep 4, 2023

光标选中汉字的时候宽度有点问题,只有汉字的一半宽 可能是 monaco 这块的问题,尝试把 vim mode 关掉后,手动设置宽度一样会被覆盖掉

image image

中文的 case 暂时不管吧👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants