Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs auto-complete for Qooxdoo?

Tags:

emacs

qooxdoo

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 $'\0' file
do
  grep '^qx.Class.define(".*",$' $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!

like image 259
Rafael Ibraim Avatar asked Dec 12 '25 11:12

Rafael Ibraim


1 Answers

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.

like image 144
sanityinc Avatar answered Dec 13 '25 23:12

sanityinc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!