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

Editing code leads to unexpected token '<newline>' errors in error list #4835

Closed
petrsercl opened this issue Nov 4, 2018 · 21 comments
Closed
Labels

Comments

@petrsercl
Copy link

PYVS editor is not usable in Visual Studio 2017 (15.8.9 and several previous versions). If I try to add a new code to existing code, it always throws syntax error (unexpected token).

error_in_syntax_which_does_not_exist

@RaymonGulati1
Copy link
Contributor

It would be helpful if you could answer a few questions:

  1. Have you checked the spacing and tabs to ensure they are the correct?
  2. Can you run a simple hello world program?
  3. Would it be possible for you to send me that portion of the code or file?

@huguesv huguesv changed the title Impossibility to add new code in the editor Editing code leads to unexpected token '<newline>' errors in error list Nov 5, 2018
@huguesv huguesv added the devcomm label Nov 5, 2018
@huguesv
Copy link
Contributor

huguesv commented Nov 5, 2018

@huguesv
Copy link
Contributor

huguesv commented Nov 5, 2018

@huguesv
Copy link
Contributor

huguesv commented Nov 5, 2018

@TheNextLVL
Copy link

I have the same issue, each time that I create a new line appears the error. If I close the file and reopen the error dissapear.

The version is:
Visual Studio Enterprise 2017 - 15.8.9
Python - 15.8.18241.1

@Helmur100
Copy link

Same problem here, if I restart VS2017, these are gone but appear once I start working in the document:
vs2017_error

VS2017 v15.9.3

@rafeek
Copy link

rafeek commented Jan 8, 2019

I have this problem as well
VS2017 v15.9.4

There is a workaround as stated here: https://developercommunity.visualstudio.com/content/problem/374322/phantom-python-errors-in-vs-community-1588.html

I replaced all occurrences of "TODO"with "TO DO".

@JenusL
Copy link

JenusL commented Mar 28, 2019

Now when a workaround has been identified, could this finally be fixed please?

@huguesv
Copy link
Contributor

huguesv commented Apr 3, 2019

I couldn't reproduce the issue with TODO in VS 2019.

@aw2003
Copy link

aw2003 commented May 22, 2019

Still an issue in 15.9.12 on Win7 64-bit with Python 2.7.14. How many months more before we get some kind of fix? VS2013 is a better editing environment at the moment....!

@davidalbertonogueira
Copy link

How can this issue be closed with so many people reporting it?
I replaced all occurrences of "TODO" with "TO DO" and so far so good.

@MacMarde
Copy link

For me too working with replacing TODO with "TO DO".
This very simple but extremly annoying issue is now well known over a year and MS can't fix it?

@rafeek
Copy link

rafeek commented Jul 24, 2019

There seems to be a lot of punting this issue around and trying to close it without actually fixing it. Is this going to be fixed ever?

@haugstve
Copy link

I'm on VS Code and had a similar issue. Just spent half an hour commenting out lines to locate what I expected to be a missing parentheses. At the end, only four lines and imports where left. I could not for the life of me figure out why I was getting unexpected token newline. Running the flask app worked fine, after finding this tread I closed and reopened VS code. No more errors.

If there is shared code between the Python VS Code Extension and PTVS it might be related?

Version: 1.37.1

@aw2003
Copy link

aw2003 commented Aug 21, 2019

This is exactly the kind of problem which makes working in an IDE very annoying on a daily basis - if it doesn't get fixed, people will start to look at alternatives as continually being reminded of having to add workarounds to your comments just to avoid the IDE telling you about non-existent syntax errors is a "grinding" bug in the UI - the kind which saps your enthusiasm for the whole product.

@nilam1996
Copy link

I am facing the problem, while I want to do loads of caching data then the error getting....json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
so can anyone explain to me why the error coming?

@TiemenSch
Copy link

Still very much facing this in the latest VS Code and after deleting and re-downloading the latest language server. On random but frequent (hourly or so) occassions during the day I get all kinds of phantom errors where a file just trips up as soon as I edit a single character after opening.

languageServer
languageServer.0.4.71

Python Extension
Name: Python
Id: ms-python.python
Description: Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, refactoring, unit tests, snippets, and more.
Version: 2019.10.44104
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python

VS Code
Version: 1.39.2 (user setup)
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:35:18.241Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

@gramster
Copy link
Member

gramster commented Nov 6, 2019

Thanks to everyone for these reports.

@TiemenSch, could you please report your issue against the language server here: https://github.com/microsoft/python-language-server. PTVS is using an old language server (~2 years since the fork) so this is not the place to report issues with the new language server in VS Code. I'd move the issue over but want to keep the original issue open against PTVS.

For those experiencing the original issue in Visual Studio, we are working on moving VS to use the new language server early in 2020, which should provide a considerably better experience. We are not fixing bugs in the old language server which is why there has been no movement on this. As a small team we have to decide where to focus our limited resources and we'd rather keep that focus on getting PTVS moved over to the LSP (language server protocol) and the new language server. We thank you for your patience.

@TiemenSch
Copy link

My apologies! I came here after multiple referencing issues and thought this was the one. Completely overlooked the switch in tooling. Thanks for the clear explanation and I'll head over straight away!

@eromoe
Copy link

eromoe commented Sep 25, 2020

Similar error:

image

image

@greazer greazer closed this as completed Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests