Skip to content

Please remove the broken "smart edit" feature in Code Editor #2378

Closed
@Voileexperiments

Description

@Voileexperiments

It's broken/annoying in many ways and it's very annoyed to code against it:

  1. When typing quotes or parentheses, the code editor might turn it into a full pair of them. The problem is that it sometimes does this and sometimes does not, and I find it often does stupid things like:

    ''.join''.join(c) for c in r for r in image)

    Now when I type ( between join and '' it fills in () instead? Is it not aware that the parenthesis is not complete and so ( should be matching the dangling )?

  2. Similarly, the code editor likes to eat the closing quotes/parentheses when the context clearly lacks one to begin with. if I have

    add(a,b)

    And now I want to change it to add(max(a,c),min(b,c)), and I typed it to

    add(max(a,c),min(b,c)

    With the cursor just before the last c (because I'm typing inside the add(a,b). Now I only need to close the parenthesis. However, when I press ) it eats my ) and I have type it again to make the ) appear. Now imagine if there are multiple nested ) at the end.

  3. When typing quotes or parenthesis while something's selected, they are wrapped around the text instead. This leads to peculiar situations like this: Let's say I have

    f'minute{'' if n==1 else 's'}'

    Oops, now I should probably replace the outer quotes to double quotes. I can either

    • Move cursor to after the ', press backspace, then type "; but then "" will appear instead. And no, backspace doesn't work here since it removes both double quotes. You need to either delete the right one, or resort to more selecting/moving cursor around
    • Select ' and type "; but then it becomes "'" instead of just ", so now you realized you fxxked up and immediately want to backspace the extra characters out. But since ' is still selected, backspace or delete gives you "" instead, which is the above situation.
    • Copy a " with Ctrl+C, Select ', Ctrl+V. This works but it is extremely inconvenient.
    • Do some crazy stuff like selecting the whole text, Ctrl+X, backspace once so only f is left, then type " and Ctrl+V? I just want to change the surrounding chars, why do I have to fiddle with the entire block?
  4. Python: Making a new line through pass automatically assumes you're ending the block, which is not useful at all. Let's say I have

    def f(a, b):
        pass
    def a(a, b):
        pass

    When I want to finish the function f and remove the pass there, there are a few possible things I might do:

    • Move cursor to :, newline, and except both a indent to appear (hint: it doesn't in some editors, e.g Notepad++), and then try to remove pass via some gymnastics? Switching to mouse from a keyboard position or having to quadraple-tap an arrow button is very time-consuming.
    • Move cursor to the end of pass, newline, expect a indent to appear, then shift + up, backspace, and start coding! Which doesn't work because the indent is gone after creating a new line. Now I have to press an additional tab.
    • Others? But it's also very time consuming.
  5. Also Python: The code editor really hates inline if/elif blocks in Python. Let's say I'm typing this code snippet:

    if n%p==0: n /= p

    And I want to add another elif/else condition. Because of 3, When adding a newline after n /= p an extra indent will always be created unless it was pass. But then I already have a single-line if condition, why would I ever want an extra indent? I've never seen anyone who mixes inline if condition with multi-line if condition (since it'd be atrocious code style to do so). When I newline in this case, I want to type outside the if block, not inside it.
    Seriously, what's the issue of using the old, tried-and-true rule of "just follow the indent of the line being newline-ed out of"? If I already have this:

    if n%p==0:
        n /= p

    Then naturally I might want to still code inside the if block when newlining after n /= p. And it has always worked.

  6. Probably many more that I can't recall.


My general experience with the smart editor features in this particular code editor is that they never worked well, and I have to constantly fight against them when typing code.

Also note than all of the above issue doesn't happen in Monaco, so I see that I'm not indeed insane and just imagining things.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions