Skip to content

Spike on auto indentation  #5821

Closed
Closed

Description

@luabud

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on May 28, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on May 28, 2019
  3. DonJayamanne commented on May 29, 2019

    @DonJayamanne
    • Look into using regex based on python grammar
  4. jkyeung commented on Jun 7, 2019

    @jkyeung

    Um, what is the purpose of this issue? Is it to basically bring issue #481 back to the forefront? Is the term "spike" here the same as (or perhaps a more forceful version of) what I've often seen as "bump" on various forums?

    I certainly would not mind if this was moved to the front burner.

    In particular, the "fix" for backslash line continuation is broken. Issues #4241 and #4563 deserve more attention.

    I think it is a fairly simple matter, actually. The on-Enter rule that was added to address #3284 was this (in extension.ts):

    {
        beforeText: /^(?!\s+\\)[^#\n]+\\\s*/,
        action: { indentAction: IndentAction.Indent }
    }
    

    It has the fatal flaw that the regex is not tied to the end of the line. I think that whoever put this in (apparently proposed by Jake Bailey (@jakebailey)) probably meant the regex to be

    /^(?!\s+\\)[^#\n]+\\\s*$/
    

    Technically, that is still wrong, because the Python interpreter doesn't allow whitespace after the line-continuation backslash. It would be more correct as

    /^(?!\s+\\)[^#\n]+\\$/
    

    Since this is such a simple change and would save so many people the countless small headaches of unintended autoindentation after strings that contain backslash-escapes, I implore the powers that be to please give this some attention.

  5. brettcannon commented on Jun 10, 2019

    @brettcannon
    Member

    jkyeung Spikes are basically us putting in some research into how best to try and solve the problem.

  6. ericsnowcurrently commented on Jun 11, 2019

    @ericsnowcurrently

    jkyeung, I've left a comment on #3284 referring to your comment here. :)

  7. ericsnowcurrently commented on Jun 11, 2019

    @ericsnowcurrently

    I took at look at the existing code. Without upstream vscode changes, there isn't a lot we can do there.

    Here's one rule we could add that might help a little with the indent of closing brackets:

    {
        afterText: /^\s*[)}\]]/,
        action: { indentAction: IndentAction.Outdent }
    }
  8. ghost removed
    needs proposalNeed to make some design decisions
    on Jun 11, 2019
  9. locked as resolved and limited conversation to collaborators on Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions