Review Request 115422: semi-intelligent keyword-based generic code completion model based on syntax files

Sven Brauch svenbrauch at googlemail.com
Sat Feb 1 21:35:59 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115422/
-----------------------------------------------------------

(Updated Feb. 1, 2014, 9:35 p.m.)


Review request for Kate and KDevelop.


Changes
-------

* don't crash when no highlighting mode is set
* query highlighter to decide what is a word

The second point solves some of the issues, but not all; for example, in doxygen, some commands start with @ and some start with \. Those which start with @ work now, but \ still cancels the completion (KateHighlight::isInWord seems to return false for "\", but true for "@"). Any ideas?


Repository: kate


Description
-------

This patch provides a new completion model which gathers items from the syntax files. It simply suggests all words which are listed as keywords for the highlighting context which is active at the position where completion was invoked.

To avoid storing all the places where the highlighting context changes, an option was added to the function which calculates the highlight, which allows to optionally get all the context changes in a QVector. When completion is invoked, the current line is re-highlighted, and the context switches are extracted; from that the highlighting context at the cursor position is determined. The keyword items from this context become the items of the completion model.

An option is provided in the settings dialog to turn this new model off.


Diffs (updated)
-----

  part/view/kateview.cpp 9d9cff6 
  part/utils/kateglobal.cpp f322074 
  part/utils/kateglobal.h 491e8f8 
  part/utils/kateconfig.h a932533 
  part/utils/kateconfig.cpp 7667aee 
  part/syntax/katehighlighthelpers.cpp f5c1823 
  part/CMakeLists.txt 51af1b8 
  part/completion/katekeywordcompletion.h PRE-CREATION 
  part/completion/katekeywordcompletion.cpp PRE-CREATION 
  part/dialogs/completionconfigtab.ui 7cdb94f 
  part/dialogs/katedialogs.cpp aa0acba 
  part/syntax/katehighlight.h f3eb81b 
  part/syntax/katehighlight.cpp cd8b6a7 
  part/syntax/katehighlighthelpers.h 3f16f87 

Diff: https://git.reviewboard.kde.org/r/115422/diff/


Testing
-------

Tested with various languages. Checked if there are any obvious interferences with kdevelop's supported languages.


File Attachments
----------------

CSS
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/92f2d072-5263-46c1-9edb-cdb81557b736__css.png
CSS + HTML
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/9c5a98d6-a8ff-4ba8-9deb-f0ab0dc37ec6__mixed.png
lua
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/315da290-5610-4083-8d8c-daaacabb3346__lua.png
bash ;)
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/0e806ffe-902b-4cf5-b750-68bcac80365b__bas.png
PHP
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/94271927-ab7b-4221-bb84-65ead2c1afac__php.png
gnuplot
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/b9aad427-6c1b-4c33-9c9d-c95625e26066__gnuplot.png
gnuplot; note that it has different completion items now, depending on context <3
  https://git.reviewboard.kde.org/media/uploaded/files/2014/02/01/24f9fb51-31ed-4f3f-8d3f-3ad36e698e1a__gnuplot2.png


Thanks,

Sven Brauch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140201/7829251d/attachment-0001.html>


More information about the KDevelop-devel mailing list