[Qt-creator] Basic Syntax Highlights
Damien Fagnou
damien-f at moving-picture.com
Thu Oct 29 12:15:55 CET 2009
Hi Bjørn ,
Thanks I did just that using the QScriptEditorPlugin as a template .
This is really working well and I managed to get it much further than I had anticipated !
QtCreator is already great but the possibility to extand it with such relative ease is incredible !!
one question related to support of Lua Language :
1) QtScriptEditor use this IncrementalScanner for speed I guessed ?
is that really needed ? it as provent a little difficult to implement multi-line comments or string
that use more complex sequence of char : --[[ --]] for comments and [[ ]] for strings .
I have resorted to use more standard QRegExp technicque for those but have both the incremental scanner and those is making
un-intuitive to extand.
so my question is what are exactly the advantage of the IncrementalScanner compare to a schema like in the QHighlighter exampler in Qt ?
Thanks a Lot
Damien
ext Damien Fagnou wrote:
>/ Hi ,
/>/
/>/ we use a lot of Lua in our company , we have some syntax highlight
/>/ definitions that include lua keywork and some of our own extension. and
/>/ the editor we current use for that is using the highlight definition to
/>/ do the auto complete [just dictionary style ]
/>/
/>/ I want to move people coding in Lua to qtCreator along with the C++
/>/ developers but what is involve in adding an highlights based on keywords
/>/ and autocompletion of those to a a language ( ex lua ) ?
/>/
/>/ how big of a project is it to add a very basic language support like that ?
/
Most of the work should be in implementing a QSyntaxHighlighter for Lua.
The other tricky thing is that there is no easy way to add syntax
highlighting for a new language to Qt Creator at the moment. You will
have to create a new plugin (say LuaPlugin), which adds a new derivative
of the BaseTextEditor (say LuaEditor), with appropriate factory, editor
action registration (TextEditorActionHandler), define and register the
MIME type, etc.
I guess we could add a Highlight plugin, through which we could make it
easier to add basic highlighting support for more languages, but at the
moment this has no priority from our side.
Once you have your LuaPlugin, implementing custom indentation logic,
code completion and navigation for Lua also becomes possible of course.
Regards,
Bjørn
More information about the Qt-creator-old
mailing list