Port worksheet syntax highlighting to KSyntaxHighlighting
Open, WishlistPublic

Description

KTextEditor developers split the syntax highlighting feature in a own library.

Currently Cantor uses keywords coded in the source code of the backends to provide syntax highlighting to in worksheets.

This task aims to study if the current approach in Cantor can be replaced by KSyntaxHighlighting library. This library must to allow the add/remove keywords while the user is working in Cantor to be accepted as a valid alternative.

asemke claimed this task.Jul 4 2018, 8:29 PM

The commit R55:9bb6049e4670b3fa2dd0fdedf9802851a2cf01db ported Maxima backend to KSyntaxHighlighting.

sirgienko added a subscriber: sirgienko.EditedSep 7 2018, 8:37 PM

Well, good job, guys!
But, that we will do with Qalculate and Kalgebra backends? They haven't syntax file, as I see (but we don's support this backends very well, so maybe we could leave it as it is.
And another question: Are we will use KSyntaxHighlighting for the highlighting?
For example, we could use AbstractHighlighter::highlightLine from KSyntaxHighlighting inside DefaultHighlighter, especially in our DefaultHighlighter::highlightBlock function. In this case, hgihtlighting code supported from KSyntaxHighlighting team and we also fix one of our highlighting problem: we can't highlight multiline elements, like multiline strings, comments, etc. (actually, some backends highlighter do multiline hightlighting (MaximaHighlighter::highlightBlock, ScilabHighlighter::highlightBlock, some others backends), but DefaultHighlighter can't do it)

This task aims to study if the current approach in Cantor can be replaced by KSyntaxHighlighting library. This library must to allow the add/remove keywords while the user is working in Cantor to be accepted as a valid alternative.

We could try to solve this problem by requesting API for this, just as we have requested keywordsList.

Ideas?

filipesaraiva removed asemke as the assignee of this task.Sep 7 2018, 9:23 PM
filipesaraiva added a subscriber: asemke.

Well, good job, guys!

That was a nice job!

But, that we will do with Qalculate and Kalgebra backends? They haven't syntax file, as I see (but we don's support this backends very well, so maybe we could leave it as it is.

For now it is not possible, so that is ok. Maybe we can to open some tasks in backlog column while there are not syntax definitions for it in KSyntaxHighlight.

And another question: Are we will use KSyntaxHighlighting for the highlighting?
For example, we could use AbstractHighlighter::highlightLine from KSyntaxHighlighting inside DefaultHighlighter, especially in our DefaultHighlighter::highlightBlock function. In this case, hgihtlighting code supported from KSyntaxHighlighting team and we also fix one of our highlighting problem: we can't highlight multiline elements, like multiline strings, comments, etc. (actually, some backends highlighter do multiline hightlighting (MaximaHighlighter::highlightBlock, ScilabHighlighter::highlightBlock, some others backends), but DefaultHighlighter can't do it)

This is an interesting approach. We definitely must give a look in it.

This task aims to study if the current approach in Cantor can be replaced by KSyntaxHighlighting library. This library must to allow the add/remove keywords while the user is working in Cantor to be accepted as a valid alternative.

We could try to solve this problem by requesting API for this, just as we have requested keywordsList.

Definitely. I can open a task for it and we discuss with KSyntaxHighlight developers.

For now it is not possible, so that is ok. Maybe we can to open some tasks in backlog column while there are not syntax definitions for it in KSyntaxHighlight.

Or we could create syntax datafile and send pull request. A think, we should mention this option in the tasks. I have spended some time on testing highlighting in this backends - they in good condition, so I think rewriting them on KSyntaxHighlighting is not very priority task (and not very easy: qalqulate use own block highlighting function and kalgebra use highlighter from analitza gui). So, wishlist priority, maybe.