3

I can use it in other applications such as notepad, but it just won't work with vs code.It seems that there is a bug or did I do any thing wrong? For example

::td::TODO

and every time I will get a different result:

AHK BUG

How to fix this?

Community
  • 1
  • 1

3 Answers3

3

It is a bug from an extension Markdown All in One It is fine when I disabled it.

1

Autohotkey workaround:

::td::{Sleep 100}TODO

Increase the 100ms as the hotstring (to delete) becomes larger. On my machine I could expand hotstrings with length 25 in 250ms. Your mileage may vary.

Relevant Github Issue

I replaced my hotstrings en masse with the following regex:

Search: ::[a-z0-9_-]+::(?!\{)
Replace: $0{Sleep 250}


In the Github issue Mehul has another workaround:

:SE, K1:td::TODO

This does not require a variable amount of ms as it will always work regardless of hotstring length but it took so long to print the replacement text I found it unworkable.

Laoujin
  • 9,962
  • 7
  • 42
  • 69
0

I really didn't want to disable the Markdown all in one extension.

Going off of @Laoujin's workaround, this works perfectly for me.

The below hotstring will type out the current date when type qcd (not terminating character). If VSCode is active, it waits 100 milliseconds.

:*:qcd::
FormatTime, timeString, , MM/dd/yyyy
typeText(timeString)
return


typeText(text) {
  IfWinActive, Visual Studio Code
    Sleep, 100

  SendInput, %text%
}
MGreenfield
  • 355
  • 1
  • 13