Skip to content

cute-jumper/company-qml

Repository files navigation

company-qml

http://melpa.org/packages/company-qml-badge.svg

A company-mode backend for QML files.

Screenshots

./screenshots/object.png ./screenshots/field.png ./screenshots/global.png

Usage

Since 2016-02-12, this package should work out of box if you only want completions for standard QML objects.

To use it:

(add-to-list 'company-backends 'company-qml)

Done!

For users of old versions: Please note that qmltypes-parser-file-list is obsolete now. It has been renamed to company-qml-default-qmltypes-files. What’s more, if you set this variable, it will override the default completions that comes with this package. For most of the users, it will be sufficient to delete the settings of qmltypes-parser-file-list (it’s not needed any more!) and use the default completions provided by this package.

Config

If you want this package to provide completions for third-party libraries, follow the steps below:

  1. First, you need plugins.qmltypes files so that they can be parsed to get the completion information for QML objects. You can try to find these plugins.qmltypes files under the third-party library’s directory. If you can’t find them, refer to this page for the information of generating qmltypes files.
  2. Set the variable company-qml-extra-qmltypes-files to a list of plugins.qmltypes files. For example,
    (setq company-qml-extra-qmltypes-files '("/path/to/lib1/module1/plugins.qmltypes"
                                             "/path/to/lib1/module2/plugins.qmltypes"
                                             "/path/to/lib2/module1/plugins.qmltypes"
                                             "/path/to/lib2/module2/plugins.qmltypes"))
        

You can also override the default completions provided by this packages by setting the variable company-qml-default-qmltypes-files. Find out the locations of plugins.qmltypes files for standard QML objects and then set the variable company-qml-default-qmltypes-files in the same way as company-qml-extra-qmltypes-files.

TODO

  • Support “as” in import statement.
  • Implement a better QML parser. So far we only support very simple completions.
  • Javascript completions.

    I’m not proficient in either QML or the development of company-mode extensions. Any improvements or suggestions are welcome!

About

Emacs company-mode backend for QML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published