jhuix/vscode-markdown-preview-showdown

Tracking the cursor position in both windows simultaneously

sebi5361 opened this issue · 7 comments

Feature request

Could vscode-markdown-preview-showdown have the same capability than the default markdown previewer regarding tracking the cursor position in both windows simultaneously?

jhuix commented

It is very difficult to implement this feature in vscode, so it won't be implemented temporarily.

I thought you could just reuse some code of the default markdown previewer, but indeed it must be well more complicated than that~~

By reading the project description I understand that there is an automatic scroll sync feature enabled by default with markdown-preview-showdown.scrollSync set to true.
But I have noticed it doesn't work properly as often synchronisation is lost.
Improving this feature in the meantime would be a must!

jhuix commented

The markdown-preview-showdown.scrollSync setting is experimental. Because when I keep typing text, the vscode notification of the cursor position cannot always be received correctly, and I haven't found a better way so far.
And it simply corresponds to the scrolling HTML page position by the percentage of the cursor position in the full text of markdown.

Oh I get it.
I believe not receiving correctly the cursor position sometimes is not the main problem, but it is more likely this simple percentage implementation.
It might work correctly on the edges of the document but not in the middle as the rendering makes both panels really different.
I see the difficulty here. It might be really difficult to improve it indeed.

jhuix commented

Oh I get it.
I believe not receiving correctly the cursor position sometimes is not the main problem, but it is more likely this simple percentage implementation.
It might work correctly on the edges of the document but not in the middle as the rendering makes both panels really different.
I see the difficulty here. It might be really difficult to improve it indeed.

Yes, you are right.

A simple software that keeps synchronisation very efficiently is NoteRoot. It is discontinued though and not open-source as now being part of a wider institutional project called kpaces.
As it is a Chrome App it is most likely written in javascript and might be inspirational.

I am closing this issue. It was just some ramblings...