Reputation: 149
Until now I have programmed python3 using pythons IDLE where I can edit my code and run it from command line without problems.
Now I decided to use Visual Studio 2017 as my IDE.
I have created a Visual Studio python project from my existing code.
The program runs fine if I just let it run without changes.
But every time I enter a new line of code into my program, Visual studio messes up everything.
For example I add the following function:
def test():
pass
Now visual studio marks it red an gives error for the first line: "unexpected token ''" and for the second line: "unexpected ident". Now the functions beneath also get marked red. All errors seems to be about unexpected tokens and unexpected ident.
This happens regardless where I change the code in the whole .py file. It happens in function already existing or outside funtion. And it also happens if I just copy and paste n new line of code.
The code and the idents are correct as far as I can check it! I also have tried to mark the whole code and then used "Edit -> Advanced -> Untabify Selected Lines". So I guess idents should now be correct.
The workaround for now is also very strange: I do need to select the whole code with ctrl-a, copy it with ctrl-c, delete the whole code and then paste it again with ctrl-v. Now the code looks exactly as before, but VS errors are gone. I can let the programm run without problems.
How can I avoid this workaround? Its driving me crazy.
Upvotes: 1
Views: 220
Reputation: 149
The solution can be found here:
https://github.com/Microsoft/PTVS/issues/4835
Just replace every "TODO" appearance in your code with "TO DO", also in the comments of course.
Unbelievable but true!
Upvotes: 2