cute-jumper / company-qml

Emacs company-mode backend for QML
10 stars 1 forks source link

Still working in 2019? Parser errors #7

Open DougBeney opened 5 years ago

DougBeney commented 5 years ago

Typically I get an error in *messages* that looks like this:

backend company-qml error "Wrong type argument: qmltypes-parser-type-info, [cl-struct-qmltypes-parser-type-info "QQuickAbstractStyle" "QObject" ["QtQuick.Controls.Private/AbstractStyle 1.0"] nil ("data" "padding") nil nil]" with args (candidates R)

And here's the full debug-on-error message:

Debugger entered--Lisp error: (wrong-type-argument qmltypes-parser-type-info [cl-struct-qmltypes-parser-type-info "QQuickAbstractStyle" "QObject" ["QtQuick.Controls.Private/AbstractStyle 1.0"] nil ("data" "padding") nil nil])
  signal(wrong-type-argument (qmltypes-parser-type-info [cl-struct-qmltypes-parser-type-info "QQuickAbstractStyle" "QObject" ["QtQuick.Controls.Private/AbstractStyle 1.0"] nil ("data" "padding") nil nil]))
  #f(compiled-function (type-name type-info) #<bytecode 0x1bb86c9>)("QQuickAbstractStyle" [cl-struct-qmltypes-parser-type-info "QQuickAbstractStyle" "QObject" ["QtQuick.Controls.Private/AbstractStyle 1.0"] nil ("data" "padding") nil nil])
  maphash(#f(compiled-function (type-name type-info) #<bytecode 0x1bb86c9>) #<hash-table equal 303/325 0x1c07331>)
  company-qml--setup-completion-table(#<hash-table equal 303/325 0x1c07331> nil)
  company-qml--get-completion-table()
  company-qml--get-qmltypes-completions("Re" "QtQuick4.0" t)
  #f(compiled-function (x) #<bytecode 0x16d5dfd>)("QtQuick4.0")
  mapcan(#f(compiled-function (x) #<bytecode 0x16d5dfd>) ("QtQuick4.0"))
  cl-mapcan(#f(compiled-function (x) #<bytecode 0x16d5dfd>) ("QtQuick4.0"))
  company-qml-get-completions("Re")
  company-qml(candidates "Re")
  apply(company-qml (candidates "Re"))
  company-call-backend-raw(candidates "Re")
  apply(company-call-backend-raw (candidates "Re"))
  company--force-sync(company-call-backend-raw (candidates "Re") company-qml)
  company-call-backend(candidates "Re")
  company--fetch-candidates("Re")
  company-calculate-candidates("Re" nil)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-manual-begin()
  company-begin-backend(company-qml)
  company-qml(interactive)
  funcall-interactively(company-qml interactive)
  call-interactively(company-qml record nil)
  command-execute(company-qml record)
  helm-M-x(nil #("company-qml" 0 11 (match-part "company-qml")))
  funcall-interactively(helm-M-x nil #("company-qml" 0 11 (match-part "company-qml")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

My attempt to fix this issue was to specify a company-qml-extra-qmltypes-files variable.

To find my plugins.qmltypes files I used this command to generate a big ol list:

find ~/Qt -name "plugins.qmltypes" (My Qt installation is in ~/Qt)

I then set that variable to all of the files returned from that search and put it in my config. Here is the snippet I added to my config.

Now I get this error:

Debugger entered--Lisp error: (search-failed "Module")
  re-search-forward("Module")
  qmltypes-parser-parse-file("/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls/Styles/Flat/plugins.qmltypes")
  qmltypes-parser-init(("/home/doug/Qt/5.13.0/gcc_64/qml/QtLocation/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/wavefrontmesh/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/location/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/calendar/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/qmlmodels/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/sharedimage/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/settings/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/platform/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt/labs/folderlistmodel/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtGraphicalEffects/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtMultimedia/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtWayland/Compositor/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtRemoteObjects/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtBluetooth/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtWebSockets/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Render/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Extras/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Core/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Animation/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Input/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/Qt3D/Logic/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtPositioning/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtWebChannel/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtWebView/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls/Styles/Flat/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Scene2D/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls.2/Universal/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls.2/Imagine/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls.2/Fusion/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls.2/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Controls.2/Material/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Particles.2/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Dialogs/Private/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Dialogs/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/PrivateWidgets/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Window.2/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/LocalStorage/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Extras/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/XmlListModel/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Layouts/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Scene3D/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Templates.2/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQuick/Shapes/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtScxml/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtNfc/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtGamepad/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtTest/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQml/Models.2/plugins.qmltypes" "/home/doug/Qt/5.13.0/gcc_64/qml/QtQml/plugins.qmltypes" ...))
  company-qml--get-completion-table()
  company-qml--get-qmltypes-completions("Rec" "QtQuick4.0" t)
  #f(compiled-function (x) #<bytecode 0x1564ff5>)("QtQuick4.0")
  mapcan(#f(compiled-function (x) #<bytecode 0x1564ff5>) ("QtQuick4.0"))
  cl-mapcan(#f(compiled-function (x) #<bytecode 0x1564ff5>) ("QtQuick4.0"))
  company-qml-get-completions("Rec")
  company-qml(candidates "Rec")
  apply(company-qml (candidates "Rec"))
  company-call-backend-raw(candidates "Rec")
  apply(company-call-backend-raw (candidates "Rec"))
  company--force-sync(company-call-backend-raw (candidates "Rec") company-qml)
  company-call-backend(candidates "Rec")
  company--fetch-candidates("Rec")
  company-calculate-candidates("Rec" nil)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-manual-begin()
  company-begin-backend(company-qml)
  company-qml(interactive)
  funcall-interactively(company-qml interactive)
  call-interactively(company-qml record nil)
  command-execute(company-qml record)
  helm-M-x(nil #("company-qml" 0 11 (match-part "company-qml")))
  funcall-interactively(helm-M-x nil #("company-qml" 0 11 (match-part "company-qml")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

Let me know if you have any ideas.

I am very serious about getting QML completions working in Emacs so I'm happy to provide any more info. I will be messing around with the code of this package as well to see if I could find any solution as well.

Thanks!

cute-jumper commented 5 years ago

It has been a long time since I used QML. Looks like they change the format quite a bit. Unfortunately I don't have time to finish the rewrite of the parser (#5).

If you have time, feel free to contribute. What you need to modify is probably qmltypes-parser.el. I'm happy to review the code.

DougBeney commented 5 years ago

Thanks for the tips! I'm up for a challenge.

tastytea commented 4 years ago

Any update on this?