spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.32k stars 1.61k forks source link

Refactor and unify source code analysis functionality #3493

Open jitseniesen opened 8 years ago

jitseniesen commented 8 years ago

This is only an idea that I wanted to record, prompted by #3491, and thus quite vague. There are the number of places where we need to parse Python code, including:

We do this sometimes ad hoc, leading to bugs (e.g.#1448, #1673, #3214) and duplication of effort. I think we should try to do all these things in one place. This may also help with making Spyder language agnostic.

A first step may be to do tokenizing in one place. Can we perhaps make use of Pygment's tokenizer?

ccordoba12 commented 8 years ago

@jitseniesen, unfortunately we can't use Pygments to tokenize all file types because it needs to parse the entire file instead of doing it line by line, which is what QSyntaxHighlighter expects (and it's also more efficient for big files).

So for some file types (e.g. Python) we need to define our own tokenization routines.


About your other points, I'm all for them. Let's wait until @rlaverde finishes its refactoring of CodeEditor to discuss them :-)

GauravGaikwad94 commented 6 years ago

Is code refactor feature available in spyder? @ccordoba12 @rlaverde

rlaverde commented 6 years ago

No, code refactoring isn't avalaible, @ccordoba12 is refering to an internal refactoring of spyder code (Editor extensions), about code refactoring feature you could take a look to #1937 and #4751

goanpeca commented 4 years ago

This is related to work I will probably implement in the plugin new API side. After all plugins have been migrated, I plan to create a Python plugin that should extend the base plugins with Python Specific functionality. In doing this I will probably achieve what @jitseniesen is proposing.