Zulip Chat Archive

Stream: lean4

Topic: Keep VS Code from replacing escape sequence?


Kyle Miller (Jan 24 2022 at 20:45):

In the following, if you insert \" between the single quotes '', navigate to the blank line, and press the tab key, then the \" gets replaced with Ä.

def is_dquote (c : Char) : Bool :=
  if c == '' then

  else
    false

I guess if, rather than inserting \", you type \, tab, ", then this cancels \ being active. Is there a way to cancel it after typing \"? The escape key doesn't seem to do so. (Is there a way to prevent it from spookily replacing \" from a distance?)

(This is not real code, just a demonstration.)

František Silváši (Jan 24 2022 at 21:30):

It makes me want to strangle baby seals when my newline "\n" is replaced with a unicode negation.

Henrik Böving (Jan 24 2022 at 21:33):

In Emacs if you double type a \ it will ignore the unicode stuff, maybe it has been implemeted like this in vscode as well?

Patrick Massot (Jan 24 2022 at 22:09):

Did you follow the suggestion at https://github.com/leanprover/vscode-lean/#input--editing-settings?

Patrick Massot (Jan 24 2022 at 22:10):

Note that you can also use another input leader (other than \).

Arthur Paulino (Jan 24 2022 at 22:22):

Patrick Massot said:

Note that you can also use another input leader (other than \).

IIRC I saw in a video that you use ,. I think that's a smart move and I'm going to copy it :eyes:

František Silváši (Jan 24 2022 at 22:51):

Oh this is brilliant advice. I'll use a different leading character indeed. Thanks <3.

Eric Wieser (Feb 05 2022 at 07:15):

I think this would also be resolved by adding a Unicode completion that sends \" to itself

Eric Wieser (Feb 05 2022 at 07:15):

Same for \n

Eric Wieser (Feb 05 2022 at 07:16):

The "shortest matching prefix" behavior comes at the expense of having some bad prefixes we need to override

Eric Wieser (Feb 05 2022 at 07:16):

Maybe that would interfere with \"a though


Last updated: Dec 20 2023 at 11:08 UTC