microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.72k stars 766 forks source link

New line leaves a trailing whitespace #4354

Open antontkv opened 1 year ago

antontkv commented 1 year ago

Environment data

Code Snippet

class Foo:
    def bar(self):
        return "bar"

Repro Steps

  1. Put cursor at the end of the return statement.
  2. Press enter couple of times.

Expected behavior

Each new line should not leave a trailing whitespace. This is how it was on version v2023.4.30.

pylance_old

Actual behavior

First new line leaves a trailing whitespace.

pylance_new

Logs

Logs when hitting enter at the end of the return statement.

2023-05-12 12:02:11.380 [info] (875) [FG] parsing: /home/antontkv/temp/python_tests/pylance_bug.py (1ms)
2023-05-12 12:02:11.380 [info] (875) [FG] binding: /home/antontkv/temp/python_tests/pylance_bug.py (0ms)
2023-05-12 12:02:11.382 [info] (875) Background analysis message: setFileOpened
2023-05-12 12:02:11.382 [info] (875) Background analysis message: markFilesDirty
2023-05-12 12:02:11.427 [info] (875) Background analysis message: setFileOpened
2023-05-12 12:02:11.427 [info] (875) Background analysis message: markFilesDirty
2023-05-12 12:02:11.594 [info] (875) [FG] parsing: /home/antontkv/temp/python_tests/pylance_bug.py (0ms)
2023-05-12 12:02:11.595 [info] (875) [FG] binding: /home/antontkv/temp/python_tests/pylance_bug.py (0ms)
2023-05-12 12:02:11.676 [info] (875) Background analysis message: analyze
2023-05-12 12:02:11.677 [info] (875) [BG(1)] analyzing: /home/antontkv/temp/python_tests/pylance_bug.py ...
2023-05-12 12:02:11.677 [info] (875) [BG(1)]   parsing: /home/antontkv/temp/python_tests/pylance_bug.py (1ms)
2023-05-12 12:02:11.678 [info] (875) [BG(1)]   binding: /home/antontkv/temp/python_tests/pylance_bug.py (0ms)
2023-05-12 12:02:11.697 [info] (875) [BG(1)]   checking: /home/antontkv/temp/python_tests/pylance_bug.py (19ms)
2023-05-12 12:02:11.697 [info] (875) [BG(1)] analyzing: /home/antontkv/temp/python_tests/pylance_bug.py (20ms)
2023-05-12 12:02:11.698 [info] (875) Background analysis message: getSemanticTokens delta
2023-05-12 12:02:11.699 [info] (875) [BG(1)] getSemanticTokens delta previousResultId:1683874926862 at /home/antontkv/temp/python_tests/pylance_bug.py (1ms)
2023-05-12 12:02:11.699 [info] (875) Background analysis message: resumeAnalysis
2023-05-12 12:02:11.699 [info] (875) [BG(1)] indexing: /home/antontkv/temp/python_tests/pylance_bug.py [found 1] (0ms)
2023-05-12 12:02:11.699 [info] (875) Indexing Done: /home/antontkv/temp/python_tests/pylance_bug.py
heejaechang commented 1 year ago

format on type is leaving trailing whitespace.

@antontkv can you turn off format on type until we fix the issue?

just put this in your settings.json file.

"[python]": {
        "editor.formatOnType": false   
    }