cyrusfirheir / twee3-language-tools

[ VSCode extension ] Syntax highlighting and programmatic language tools for Twee 3, and Twine 2 storyformats.
https://marketplace.visualstudio.com/items?itemName=cyrusfirheir.twee3-language-tools
MIT License
45 stars 14 forks source link

Nonexistent Passage warning Quickfix #73

Open MinusGix opened 2 years ago

MinusGix commented 2 years ago

It would be nice to use some existing simple text similarity algorithm to make so if the user types an incorrect passage, we can provide an option to correct it to what they probably meant.
Ex: User writes <<goto "island">> when what they meant was to use their passage named "Island". This case is simple case insensitive checking and would be easier to implement.
But typos are also common, so I think a text similarity library should be used to provide the best results. Possibly allow multiple results, if possible, though I'd limit it to like three or so.
This would make using it better, since then they don't have to scan for where in the name they made the error, and just use ctrl + . and correct it.
This would probably be unique to sugarcube-2, but it would be nice to make it generic enough to work for Harlowe and other formats if we ever properly add passage validity checking to them.

Tranberry commented 2 years ago

👺 force lower case passage names.

I like the idea of the extension being smart about passage names but I do wonder if it will slow it all down.


Not sure if less resource hogging but can't we give a list of all passages in a drop down if misspelled passage name? or a create passage feature.. .

MinusGix commented 2 years ago

japanese_goblin force lower case passage names.

I like the idea of the extension being smart about passage names but I do wonder if it will slow it all down.

Not sure if less resource hogging but can't we give a list of all passages in a drop down if misspelled passage name? or a create passage feature.. .

Showing all passages in the dropdown would be slow and also not that useful. I'm not even sure if VSCode even supports over a hundred entries in the quickfix dropdown.

It might cause some slow down on large projects (because then it has to do the text similarity algo on every single passage name), but for a lot of projects it would be perfectly fine. Though, like other features which take some processing to do, this would be behind a setting that allows you to disable it if it is a problem.