Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error on words that were previously passing using acronyms in variables #6065

Closed
1 task done
stramel opened this issue Aug 8, 2024 · 4 comments
Closed
1 task done

Comments

@stramel
Copy link

stramel commented Aug 8, 2024

Kind of Issue

Change in behavior / Regression

Tool or Library

cspell

Version

8.13.2

Supporting Library

Not sure / None

OS

macOS

OS Version

14.5

Description

We have existing code that was passing with 8.13.1, now with 8.13.2 we are failing.

Steps to Reproduce

  1. add the variable markUIAsReady

Observe error Unknown word (UIAs)

Expected Behavior

should pass cSpell check.

Additional Information

No response

cspell.json

No response

cspell.config.yaml

---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
dictionaryDefinitions:
  - name: project-words
    path: './project-words.txt'
    addWords: true
dictionaries:
  - project-words
ignorePaths:
  - './.nvm/'
  # ...

Example Repository

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Jason3S
Copy link
Collaborator

Jason3S commented Aug 9, 2024

@stramel,

Thank you. I'll take a look at the CamelCase splitter. It changed slightly recently.

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 9, 2024

It looks like UI was missing from the dictionary.

#6032 made the splitter a bit stricter to get consistent results.

TL;DR

The spell checker has a two pass word splitter. The first pass is a simple camel case splitter. The second pass is more extensive.

The goal of the first pass is speed. It handles over 90% of the splitting needs.

  • ASCIIToUTF16 -> ASCII, To, UTF16
  • ERRORCode -> ERROR, Code
  • xyzText -> xyz, Text
  • WALKingRUNning -> WALKing, RUNning
  • markUIAsReady -> mark, UIAs, Ready

Very short words like xyz are not checked against a dictionary. (Setting: minWordLength).

If the first pass fails to find (or skip too short words) all the words, then the second pass is used. The second pass will not skip short words. It expects all the words to be found. It tries all possible word breaks.

  • markUIAsReady -> mark, UI, As, Ready

#6032 fixed an issue where during the first pass, short words were added to the found list while checking a document. If earlier in your document, you had a function called addButtonToUI(), the UI would have been added to the "found" list. Then later in the document, markUIAsReady would have worked, because UI is now in the found list. But if markUIAsReady had been at the beginning of the document, then it would have shown up as a misspelling. #6032 fixed that issue. But it exposes issues that used to work.

Jason3S added a commit that referenced this issue Aug 9, 2024
Related to #6065.
- Try standard word breaks before using English suffix endings.

- Make sure the API doesn't change when adding functions to `text.ts`.
- Fix possible accent issue with wordSplitter (note, not an issue with Normalized strings).
@stramel
Copy link
Author

stramel commented Aug 9, 2024

Thank you @Jason3S for looking into this and the background on how the bug occurred! I'm excited to try it out the fix!

Jason3S added a commit that referenced this issue Aug 12, 2024
Related to #6065.
- Try standard word breaks before using English suffix endings.

- Make sure the API doesn't change when adding functions to `text.ts`.
- Fix possible accent issue with wordSplitter (note, not an issue with Normalized strings).
@Jason3S
Copy link
Collaborator

Jason3S commented Aug 12, 2024

@stramel,

I'm sorry for the misunderstanding, but there isn't a "fix". The bug hid an issue that has been there for a long time. The fix is to add UI to the dictionary. This has been done.

I'll release a new version of CSpell soon with the updated dictionary, but you might have the same issue with other words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants