Nedra1998 / nvim-mdlink

Useful functionality for working with links in markdown
MIT License
21 stars 1 forks source link

Create a link in markdown file in an empty line freezes/crashes nvim? #2

Open MikeLemo1 opened 8 months ago

MikeLemo1 commented 8 months ago

Hi, Using this plugins after a frustration with mkdnflow which doesn't quite follow my work philosophy anyway and only needed the link follow and create as well as Header-anchors cmp generation part of it anyway which mean the rest in mkdnflow is bloatware for me.

So when pressing on an empty line in nvim it freezes / crashes it. I'm quite new to nvim and It's be nice to hear how'd one experienced with theenvironment approach debugging / handling it from reading log files nvim generate and specific methods and tools to use when moving between nvim tools and references.

Anyway's if that'd not specific to my PC it might be just simple fix but'd be still nice to hear a brief about how'd one approach debugging it

Nedra1998 commented 8 months ago

Glad that you like the plugin, and thanks for giving it a try.

I apologize, I myself am not the most experienced at debugging nvim plugin issues. My current method for debugging issues it so put in vim.notify or print (which is saved as a message).

I think that I've run into this same issue as well. When the plugin tries to auto-suggest files to link to, it first builds an index of all the files in the current directory. however if that is in the home directory for example that can be too many files and freeze for quite a while while it attempts to index all of them.

I've just merged a change to limit the recursive depth when listing all the files, so that should resolve this issue to some degree. Although still not completely solved since having enough files to index within the maximum recursive depth could still cause it to freeze.

If you could test again with the latest changes and see if that solves the issue for you. Thanks! https://github.com/Nedra1998/nvim-mdlink/commit/18afcc3cf78b7ed6464e02eb94ece24947640234

MikeLemo1 commented 8 months ago

was'nt sure what is doe's when pressing enter on an empty line but if you say it's recursive and it freezes nvim dues to long proccess you could still like you suggested limit the search vbut not just by recursion level but mybe by adding a counter to the search look that'd break out of it with a warning message after a set limited amount of files by the user (say 500 files limit and then break with a limit) to prevent nvim from freezing.