DavidAnson / vscode-markdownlint

Markdown linting and style checking for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
MIT License
930 stars 170 forks source link

fixing MD034 moves cursor into wrong/awkward position #251

Closed zzzz465 closed 1 year ago

zzzz465 commented 2 years ago

fixing MD034 using fix on save set cursor to a awkward position.

1. when the cursor is positioned newline after a link

the cursor moves into a link and makes a selection from it to the next newline

before

image

after

image

expected

image

2. when the cursor is positioned on the link

the cursor doesn't move to the end, which makes it awkward to edit forward.

before

image

after

image

expected

image

DavidAnson commented 2 years ago

Sounds very similar to: https://github.com/DavidAnson/vscode-markdownlint/issues/159

I’ll have a look, but I may not be able to coax the right behavior out of VS Code.

DavidAnson commented 1 year ago

This works correctly for me on VS Code 1.74.2 (Mac) with markdownlint 0.48.1. Specifically, with "editor.formatOnSave": true active, your scenario 1 behaves as you expect with the cursor remaining on the line after the link and your scenario two leaves the cursor between the "o" and "m". (Note that scenario 2 with the cursor after the "m" results in the cursor being after the ">", but this makes sense as it stays at the end of the line. Putting the cursor anywhere in ".com" keeps it where it as as you want.