ypresto / vscode-intelli-refactor

Smartly select range for refactoring under cursor. Use with VSCode Insiders.
MIT License
12 stars 1 forks source link

Add python support #7

Open arpheno opened 2 years ago

arpheno commented 2 years ago

Tell me what needs to be done roughly and I'll do it.

arpheno commented 2 years ago

https://www.npmjs.com/package/python-ast this will be required? Do i need to disentangle the TS parsing from the actual implementation of the refactorings?

ypresto commented 1 year ago

Although I want to support Go too, loading/calling AST parser of every language from single extension looks bad design. That must be provided by language server instead.

There are two candidate in VSCode API which could power this extension by providing AST-like tokens from language server:

Extensions can call these with the command.

I'll review the feasibility of using these.

ypresto commented 1 year ago

While it is simpler if we can use above APIs, AST might be necessary to know the range of "expression".

Another solution is to use ANTLR which can output JS parser for many languages. With this we still add implementation for each language, but we don't need to include or call binaries to grab AST.

Python example: https://github.com/lexanth/python-ast#readme