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

Optionally force ropevim to use python3. #71

Merged
merged 5 commits into from Jun 3, 2019
Merged

Conversation

@bonderado
Copy link
Contributor

@bonderado bonderado commented Aug 31, 2018

Hello, thank you very much for this plugin, I used it extensively.

The only problem it ever gave me is that, running under Python2, it does not work when using Python3-only features.
To overcome this limit I introduced a way to optionally force ropevim to use Python3 syntax via a new variable.
Personally, I set the variable globally, so that even my Python2 scripts get better forward compatibility, but it can be set local to a buffer at need or automatically via autocommand if the intended version of Python can be guessed..

In the few months I used this option I did not observe problems. When renaming variables, the refactoring is applied to f-strings too.

I submit this pull request so that my approach can be examined and tested by a wider audience, possibly integrated upstream.

bonderado added 5 commits May 16, 2018
A new variable 'ropevim_prefer_py3' has ben introduced.
If non-zero, ropevim will run under the python3 interpreter, if it is
available, even for python2 scripts. This should help reducing the use of
python2-only idioms.  The default value is `0`.
Python 3 strings do not need decoding, so 'decode' is not available.
In python2 the call is performed to preserve the original program logic.
@bonderado bonderado force-pushed the bonderado:py3 branch from 223aa22 to 031e363 Nov 27, 2018
@bonderado
Copy link
Contributor Author

@bonderado bonderado commented Nov 27, 2018

I corrected a mistake in the naming of the user-defined alias for the command for python provider and added a default value to get(b:,....).

@Krilivye
Copy link

@Krilivye Krilivye commented May 24, 2019

Hi I use this hack on every new install how can I help to help to merge it? :)

@bonderado
Copy link
Contributor Author

@bonderado bonderado commented Jun 1, 2019

Hi, thank you for your interest, but I think there is not much to be done in that direction: the PR has no conflict and only needs reviewing, but the project seems to be stagnating (though honestly it works quite well, so why change it?).
I put this PR here mostly as a way to document my personal solution It is possible that this PR will be merged once new features an the spreading adoption of python3 will make some change necessary.
For now I will just keep using my hack.
Thank you again and happy (neo)vimming.

@bonderado bonderado closed this Jun 3, 2019
@bonderado bonderado reopened this Jun 3, 2019
@soupytwist
Copy link
Contributor

@soupytwist soupytwist commented Jun 3, 2019

I don't really maintain this project, but I do (somewhat) maintain rope. The project has stagnated, but myself and @mcepl are still here.

I don't see any reason not to merge this, and I don't think @mcepl will object. Sorry for the nonresponse on this.

@soupytwist soupytwist merged commit 86d9d63 into python-rope:master Jun 3, 2019
@mcepl
Copy link
Contributor

@mcepl mcepl commented Jun 3, 2019

No, I don't have a problem with it. However, I think this vim plugin has no future for me (and whole rope perhaps), because the future as I see it is in LSP (see python-rope/rope#219 (comment) ).

@bonderado
Copy link
Contributor Author

@bonderado bonderado commented Jun 4, 2019

Thank you for the answer and for suggesting an alternative. I am piqued, but at the moment changing tools is low on my priority list.

I appreciate that you took the trouble of merging even though you have little interest in this right now.
Have a good week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.