Kate linter plugin
Just a quicky: I wrote a little plugin for KTextEditor which supplies you with basic error checking when you save documents. Currently only PHP (via php <span class="re5">-l</span>
) and JavaScript (via JavaScript Lint) are supported.
Screenshots
Requirements
- usual tools for compiling C++, e.g. gcc.
- cmake
- Qt development packages, i.e. under Ubuntu:
<span class="kw2">sudo</span> <span class="kw2">aptitude</span> <span class="kw2">install</span> libqt4-dev
- KDE 4.2 with development packages for kdelibs and kdebase, i.e. under Ubuntu:
<span class="kw2">sudo</span> <span class="kw2">aptitude</span> <span class="kw2">install</span> kdebase-dev kdebase-workspace-dev kdelibs5-dev
. Note: You’ll need the experimental KDE 4.2 packages activated as of now, see for example the Kubuntu news on KDE 4.2 RC1 for hints. - proper setup of environment variables, read this techbase article for more information. the
.bashrc
linked there should be enough for most people - For PHP support: a PHP executable which supports the
-l
switch for linting - For JavaScript support: a JavaScript Lint executable, you could download and compile the sources for example.
Installing
Get the sources for the linter plugin from KDE SVN and compile it, using e.g. the functions supplied via the .bashrc
mentioned above:
# go to your development folder cs # checkout sources svn co svn://anonsvn.kde.org/home/kde/trunk/playground/devtools/kte_linter cd kte_linter # build base linter plugin cd linter cmakekde # build php linter plugin cd ../phplinter cmakekde # build javascript linter plugin cd ../jslinter cmakekde # update sycoca kbuildsycoca4 # start editor and select the plugins - happy coding! kwrite
Todo
Support for more languages
If you know good linters drop me a note. But it would be even better if you could write your own linter plugin. It’s pretty easy, take a look at one of the existing plugins for a skeleton & documentation.
Right now each plugin returns a hardcoded list of highlighting-modes which it supports for linting. This should be made configurable so that custom highlighting modes are supported
make error messages more pretty
Happy coding!