question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parenthesis wrapping after `raise` is wrong

See original GitHub issue

Environment data

  • VS Code version: 1.43.0
  • Extension version (available under the Extensions sidebar): 2020.2.64397
  • OS and version: Ubuntu Linux 16.04 LTS
  • Python version: Python 3
  • Type of virtual environment used: n/a
  • Jedi or Language Server?: jedi
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Given code like this:

if False:
    raise Thing(|)

Then pressing return with the cursor between the parentheses should wrap the code as so:

if False:
    raise Thing(
        |
    )

This is what you get if either there isn’t a raise keyword present or if it is return instead

Actual behaviour

Given code like this:

if False:
    raise Thing(|)

Then pressing return with the cursor between the parentheses actually wraps to:

if False:
    raise Thing(
|)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
luabudcommented, Feb 24, 2021

@PeterJCLaw I talked to the team and everyone was ok with a PR for the change for raise 😊

0reactions
PeterJCLawcommented, Feb 27, 2021

@luabud thanks! I’ve raised https://github.com/microsoft/vscode-python/pull/15516, which I’ve manually checked has the expected behaviour. I’ve gone with keeping this really simple for now (i.e: not attempt to handle raise Foo()| specially), but I’m happy to explore that if you feel it’s needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why wrap Arrow function body in parentheses - Stack Overflow
Without parenthesis, the object declaration brackets {} are considered as the arrow function body which will lead a logic error. @Rajesh that ...
Read more >
Why are there parentheses wrapping the brackets? - Reddit
The problem with returning objects that way is that the brackets are treated as the opening and closing brackets of a function.
Read more >
Resolving that final pesky wrapped stitch! - YouTube
In this knitting tutorial I demonstrate how to resolve a stitch that was wrapped on the wrong side for a short row, while...
Read more >
PEP 8 – Style Guide for Python Code
Continuation lines should align wrapped elements either vertically using ... Between a trailing comma and a following close parenthesis:.
Read more >
Finish Strong: 5 Mistakes To Avoid As You're Wrapping Up ...
As you near the end of the year, chances are you're clearing the decks and preparing for some much-needed time off. But as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found