Qooxdoo 的 Emacs 自动完成?

发布于 2024-11-25 04:18:29 字数 529 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青萝楚歌 2024-12-02 04:18:29

您可以使用基于主要模式的用户定义字典来完成此操作。首先,确保您的 'ac-sources 包含 'ac-source-dictionary。然后,创建一个包含框架类名称列表的文件,并将其保存为 ~/.emacs.d/ac-dict/js (或 ~/.emacs.d/ac -dict/js2-模式)。

在您的 ~/.emacs (或 ~/.emacs.d/init.el)中设置以下变量,如果您使用该方案,则应该这样做;- ):

(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")

重新启动您的 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 ;-):

(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")

Restart your emacs, and then auto-completion candidates in .js files should include your class-names.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文