Port Python 3 backend to KSyntaxHighlighting
Closed, ResolvedPublic

filipesaraiva triaged this task as Wishlist priority.
filipesaraiva moved this task from Backlog to To-Do on the Cantor board.Aug 26 2018, 3:49 PM
filipesaraiva moved this task from To-Do to Work in Progress on the Cantor board.
filipesaraiva moved this task from Work in Progress to Done on the Cantor board.Sep 4 2018, 2:05 AM
sirgienko added a subscriber: sirgienko.EditedSep 4 2018, 6:36 AM

Hi, @fililesaraiva.

PythonKeywords::instance()->addVariable(variable);
}

don't good idea, because in this case we store all variables from all Python session in singliton PythonKeywords.
I think, keywords classes should store only session independent data, in our case, from KSyntaxHigligting

Thanks @sirgienko. When I ported to KSyntaxHighlighting the tab completion stopped to work for variables.

I will study an alternative implementation to maintain tab completion. Do you have any idea?

As variant, we could use variable model: it alreay stored variable names, unique for each session, and we have api to acess to it from Cantor::Session.

But maybe more simple way is using native autocompletion tools from Python itself. Like we do it in Octave (octavecompletionobject.cpp::35).

Also, for example, Maxima already use variable model for getting lists of variable names (maximacompletionobject.cpp:58), so I think, Python could do it too.

Hi, @filipesaraiva

In 610f8c8ec70b4b52a3f4487c3348b87b66a0b85f I have added autocompletion by native Python autocompletion.
It's work for variables, functions, modules, even for class methods and fields.

Also in previous commit i have fixed some autocompletion type fetching's bugs, so now functions autocomplited as functions, and keywords as keywords.

I think, you will like it :)