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
47 stars 15 forks source link

bug fix for tags #115

Closed richrobber2 closed 2 years ago

richrobber2 commented 2 years ago

bug description: the bug seems to be caused when the tag has spaces so I say change it to some other text

This is for the "story map" I believe this was a bug that only happens when the first tag is used with spaces

changed from

  addPassageTag(passages: Passage[], tag: string) {
    for (const passage of passages) {
      if (!passage.tags.some((oldTag) => !oldTag.toLowerCase().localeCompare(tag.trim().toLowerCase()))){
        passage.tags.push(tag.trim());
      }
    }
  }

to

addPassageTag(passages: Passage[], tag: string) {
    for (const passage of passages) {
      // parse for and remove spaces because spaces break the tags change it to a "_"
      if (!passage.tags.some((oldTag) => !oldTag.toLowerCase().localeCompare(tag.trim().replace(/\s/g, '_').toLowerCase()))){
        passage.tags.push(tag.trim().replace(/\s/g, '_'));
      }
    }
  }

this only changes it so that it uses regex to remove the middle spaces that cause bugs

richrobber2 commented 2 years ago

this did not fix the bug i was getting but it will fix the other potential bugs so I recommend changing this

cyrusfirheir commented 2 years ago

Should be fixed in v0.18.3.