Closed TheBlob42 closed 10 months ago
Thanks for reporting @TheBlob42! Crash is almost always a bug, and in this case it definitely is! Patches are welcome 🙂
Also the error message in this case is not entirely clear. I got a bit lucky to find the root cause 😅
I'd be happy to make error messages clearer! Is there something in particular that was confusing?
Well I should have specified it a little better. The error message String <string> couldn't be converted to a path\n
was absolutely clear. The problem was the empty string being inserted into it. This led me believe I need to search for an "empty" link in the (quite big) documentation project. But the "real" reason was the /
path which I guess is somehow converted to an empty string here for this error message.
This threw me off. Never the less I was able to figure it out :slightly_smiling_face:
It would be awesome to include the file, line and column of a particular problematic element into the error message (in case of a parsing issue), but I am not sure how easy such a change would be :thinking:
After some binary search I found this commit: https://github.com/artempyanykh/marksman/commit/e4366cde7acf8d0c015c5b19fb31d2e43abb7ee5 to be the one introducing the issue (reverting to the one before it resolves the crash). A little strange for me since nothing changed in the path parsing, but maybe you have a good idea what could be the issue here
I just recently worked on a docusaurus documentation with a file that contained a link to the root page
[<text>](/)
which crashes Marksman with the following error message:Reproducing
Just create a markdown file with the following content to reproduce the crash:
Expected Result
I totally understand that such a link does not work for the "goto definition" or reference functionality, but it should not crash the whole server and make it unusable for the rest of the project. Also the error message in this case is not entirely clear. I got a bit lucky to find the root cause :sweat_smile:
Seems like the parsing here can not detect a "root path" correctly. Haven't had any more detailed look into this yet.