Qooxdoo 的 Emacs 自动完成?
我正在使用 Qooxdoo 和带有 js2-mode 的 emacs 启动一个项目(顺便说一句,这是一个很棒的工具),但我有一个小问题:没有对 qooxdoo 框架类的自动完成支持。目前我启用了自动完成模式,但当我需要记住框架类时它没有帮助。
笔记: - 我正在使用 emacs 24。 - 如果需要,我可以放弃自动完成模式并使用公司模式。
谢谢!
编辑:为了完成这项工作,我做了一个小脚本来从框架/源/类目录中获取类名:
find . -iname '*.js' -print0 | while read -d $'\0' file
do
grep '^qx.Class.define(".*",$' $file | sed 's/qx\.Class\.define("\(.*\)",/\1/' >> ~/.emacs.d/ac-dict/js2-mode
done
之后,只需遵循 sanityinc everything 的答案即可按预期工作。谢谢!
I'm starting a project using Qooxdoo and emacs with js2-mode(great tool btw) but I have a little problem: no auto complete support for the qooxdoo framework classes. Currently I have auto-complete-mode enabled, but it doesn't help when I need to remember the framework classes.
Notes:
- I'm using emacs 24.
- If needed, I can drop auto-complete-mode and use company-mode instead.
Thanks!
Edit: To make this work, I did a little script to get the class names from the framework/source/class directory:
find . -iname '*.js' -print0 | while read -d
After that, just followed the answer from sanityinc everything worked as expected. Thanks!
\0' file
do
grep '^qx.Class.define(".*",
After that, just followed the answer from sanityinc everything worked as expected. Thanks!
$file | sed 's/qx\.Class\.define("\(.*\)",/\1/' >> ~/.emacs.d/ac-dict/js2-mode
done
After that, just followed the answer from sanityinc everything worked as expected. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用基于主要模式的用户定义字典来完成此操作。首先,确保您的
'ac-sources
包含'ac-source-dictionary
。然后,创建一个包含框架类名称列表的文件,并将其保存为~/.emacs.d/ac-dict/js
(或~/.emacs.d/ac -dict/js2-模式
)。在您的
~/.emacs
(或~/.emacs.d/init.el
)中设置以下变量,如果您使用该方案,则应该这样做;- ):重新启动您的 emacs,然后 .js 文件中的自动完成候选项应包含您的类名。
You can accomplish this using a user-defined dictionary based on the major mode. First, ensure your
'ac-sources
includes'ac-source-dictionary
. Then, create a file containing a list of the framework class names, and save it as~/.emacs.d/ac-dict/js
(or~/.emacs.d/ac-dict/js2-mode
).Set the following variable in your
~/.emacs
(or~/.emacs.d/init.el
, if you are using that scheme instead, which you should ;-):Restart your emacs, and then auto-completion candidates in .js files should include your class-names.