Skip to content

Don't outdent on enter after raise with arguments #15516

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

Merged

Conversation

PeterJCLaw
Copy link

@PeterJCLaw PeterJCLaw commented Feb 27, 2021

This changes the behaviour of pressing enter after a raise statement which involves an explicit value so that the cursor position is no longer outdented. Previously this worked well for things like:

    raise
    raise e

but less well for things like:

    raise Exception(|)

which wouuld end up like:

    raise Exception(
|)

With this change applied the latter case will end up like:

    raise Exception(
        |
    )

which matches the behaviour of 'return'. The first case (without
a value) is unaffected, though the case of:

    raise e

will, just like 'return' now require the user to explicitly outdent after pressing enter. It is expected that this is an acceptable trade-off, especially as it is already the case for return statements.

Fixes #10583.

This changes the behaviour of pressing enter after a raise statement
which involves an explicit value so that the cursor position is no
longer outdented. Previously this worked well for things like:

    raise
    raise e

but less well for things like:

    raise Exception(|)

which wouuld end up like:

    raise Exception(
|)

With this change applied the latter case will end up like:

    raise Exception(
        |
    )

which matches the behaviour of 'return'. The first case (without
a value) is unaffected, though the case of:

    raise e

will, just like 'return' now require the user to explicitly
outdent after pressing enter. It is expected that this is an
acceptable trade-off, especially as it is already the case for
return statements.

Fixes microsoft#10583.
@PeterJCLaw PeterJCLaw force-pushed the fix-10583-no-outdent-on-raise branch from f001243 to 6967ff2 Compare February 27, 2021 10:11
@codecov-io
Copy link

Codecov Report

Merging #15516 (6967ff2) into main (c2e9274) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##            main   #15516   +/-   ##
======================================
  Coverage     65%      65%           
======================================
  Files        561      561           
  Lines      27031    27031           
  Branches    3923     3923           
======================================
  Hits       17587    17587           
  Misses      8705     8705           
  Partials     739      739           
Impacted Files Coverage Δ
src/client/language/languageConfiguration.ts 100% <ø> (ø)

@karthiknadig karthiknadig merged commit 8cce85d into microsoft:main Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parenthesis wrapping after raise is wrong
4 participants