Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and unify source code analysis functionality #3493

Open
jitseniesen opened this issue Oct 2, 2016 · 4 comments
Open

Refactor and unify source code analysis functionality #3493

jitseniesen opened this issue Oct 2, 2016 · 4 comments

Comments

@jitseniesen
Copy link
Member

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:

  • automatic indentation
  • automatic insertion of colon at end of line
  • highlighting of matching brackets
  • generating outline
  • syntax highlighting (via Pygments)
  • folding (when we implement that)

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
Copy link
Member

@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
Copy link

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

@rlaverde
Copy link
Member

rlaverde commented Feb 9, 2018

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
Copy link
Member

goanpeca commented May 4, 2020

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.

@goanpeca goanpeca self-assigned this May 4, 2020
@goanpeca goanpeca added this to the Sprint May milestone May 4, 2020
@ccordoba12 ccordoba12 modified the milestones: Sprint May, Sprint June Jun 1, 2020
@ccordoba12 ccordoba12 modified the milestones: Sprint June, Sprint July Jul 2, 2020
@goanpeca goanpeca removed their assignment Jul 20, 2020
@ccordoba12 ccordoba12 modified the milestones: Sprint July, v5.0alpha2 Aug 5, 2020
@ccordoba12 ccordoba12 modified the milestones: v5.0alpha2, v5.0alpha3 Nov 12, 2020
@ccordoba12 ccordoba12 modified the milestones: v5.0alpha3, v5.0alpha4 Jan 8, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0alpha4, v5.0alpha5 Feb 14, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0alpha5, v5.0alpha6 Feb 23, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0alpha6, v5.0beta1 Mar 19, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0.0, v5.x Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants