math2001 / MarkdownLivePreview

A Sublime Text 3 plugin to preview your markdown as you type
https://math2001.github.io/MarkdownLivePreview
MIT License
304 stars 37 forks source link

Bug: Editing gets very slow and preview length is limited on larger files #16

Open marnovo opened 7 years ago

marnovo commented 7 years ago

I have a 70KB markdown file that around line 1700 (or 53KB of content) gets incredibly slow to edit and the MD preview pane stops to add any more lines after this, even tough it updates accordingly previous lines if I change them.

math2001 commented 7 years ago

I have a 70KB markdown file that around line 1700 (or 53KB of content) gets incredibly slow to edit

For now, I don't have a solution to improve the speed, unfortunately...

the MD preview pane stops to add any more lines after this, even tough it updates accordingly previous lines if I change them.

So, at the end of your file, if you add a line, nothing gets updated in the preview, BUT if you add somewhere else, it does?

marnovo commented 7 years ago

For now, I don't have a solution to improve the speed, unfortunately...

Maybe add a config option to update rendering only every N ms?

So, at the end of your file, if you add a line, nothing gets updated in the preview, BUT if you add somewhere else, it does?

Yes and yes.

dessalines commented 7 years ago

I tried this and it crashed sublime text.

Exadra37 commented 7 years ago

For me in a markdown file with around 100 lines the key strokes are delayed to show in the original file and in the preview...

The plugin is very nice but with this lag it becomes a little uncomfortable to use :(

screenshot from 2017-03-04 15 15 17

I hope you can find a solution for this lag :)

jhoff commented 7 years ago

Is it possible for the plugin to simply use a debounce method? As long as there has been input in the last 300ms ( or whatever configured value the user sets ), don't update but as soon as that timer expires, update the preview.

marnovo commented 7 years ago

Is it possible for the plugin to simply use a debounce method? As long as there has been input in the last 300ms ( or whatever configured value the user sets ), don't update but as soon as that timer expires, update the preview.

My thoughts as well. Might be a simple workaround, with little compromise.

dessalines commented 7 years ago

More important than the debounce, would be making sure that the markdown converter only runs for the line you're editing.

math2001 commented 7 years ago

@dessalines no because one line can affect other lines. Updating the preview each X s is a good idea, though. I just don't have time to work on it yet.

dessalines commented 7 years ago

I think the only ones that are multi line are the code surrounders. It'd be easy to add a flag to always convert text in between those.

jhoff commented 7 years ago

With a proper debounce, it shouldn't matter if you redraw the whole document. I suspect that people aren't typing markdown so quickly that they need the preview to update faster than the blink of an eye. For me, I'm typing a sentence or two and then want to look over and see what it looks like. Even at a 200-300ms debounce, it would prevent the dragging input and most people wouldn't notice the delayed re-draw.

I don't know a lick of python otherwise I would take a stab at it. Thanks though for all the great work. This is easily one of my favorite plugins.

math2001 commented 7 years ago

This is easily one of my favorite plugins.

Wow... 😄

I've pushed a few commits that should help. Here are the changes:

Haven't tagged, because I'm scarred of this blinking thing

I want to make sure i'm just lucky to get my both computers (tested on a pretty slow one, though) to not get this blink, so I haven't tagged anything yet → users won't get the update.

So could you try to explicitely update this package? → ctrl+shift+p → Package Control: Upgrade Package, you might be able to find MarkdownLivePreview, I'm not sure.

If you don't, could you remove this package (your setting won't be removed, don't worry), try to add it as a repository, I think Package Control doesn't need tags to update repo that the user has manually added:

  1. ctrl+shift+p → Package Control: Add Repository
  2. Paste this in https://github.com/math2001/MarkdownLivePreview

Again: ctrl+shift+p → Package Control: Upgrade Package

If you still don't find it, install this package with git.

Please let me know which solution worked for you (for updating).

This message is addressed to anyone who's willing to help me with this issue 🙂