asciidoctor-intellij-plugin icon indicating copy to clipboard operation
asciidoctor-intellij-plugin copied to clipboard

Scrolling the editor should also scroll the preview

Open ahus1 opened this issue 2 years ago • 5 comments

Why the new feature should be added

At the moment the preview scrolls to the editor position. To scroll through the preview, one would need to use the up/down keys to scroll in the editor.

Scrolling with the scollbar in the editor does nothing - the same for the preview.

A similar setting is available in VS Code and in the Markdown Extension ("sync preview").

How the new feature should work

There should be an option in the plugin's settings. Not sure about the default setting, yet. While it is in preview, it should be disabled.

ahus1 avatar Jan 18 '23 18:01 ahus1

Hey @ahus1, I would like to work on this issue. Let me know the next set of steps to follow. Thanks !!!

dipeshsingh253 avatar Sep 27 '23 07:09 dipeshsingh253

Hey @ahus1 , any updates regarding this issue?

dipeshsingh253 avatar Oct 06 '23 11:10 dipeshsingh253

Hi @dipeshsingh253 - thanks for reaching out and offering your help.

There's a guide that helps you to get started with this project. Once you have the plugin running in your IDE, you can debug it and inspect what is happening in AsciiDocSplitEditor.MyCaretListener#caretPositionChanged: Whenever the caret position changes, it ensures that the preview is scrolled to that line.

You'll need to investigate how a different listener can translate the currently visible area in the editor to a line number in the document that is then sent to the preview.

Once that is solved, we might need a new option in the plugin's settings. For that, the AsciiDocPreviewSettingsForm.form need to change as well as the settings class. The last change in that area has been done to add the Mermaid diagram, see 4bfcf96a779521158a6c8f1ed6bb62beb6b7ada7, which can serve as a blueprint.

Let me know if this information is helpful to get you started. If you get stuck in the settings, I can help out with that part.

ahus1 avatar Oct 07 '23 16:10 ahus1

Hi @ahus1 , Thanks for your response.

I'm looking forward to working on this issue. By the way, I was wondering if Ascidoctor has any community channels on Discord or Slack ?

Thanks! 😄

dipeshsingh253 avatar Oct 16 '23 06:10 dipeshsingh253

Hi @ahus1 , I checked out the source code. AsciiDocSplitEditor.MyCaretListener#caretPositionChanged This method is only invoked on caret position change, and we have to display the preview on scroll, right? Is there any method that is invoked on scroll in the editor?

Thanks !!!

dipeshsingh253 avatar Oct 17 '23 09:10 dipeshsingh253