question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"hasSuggestions" API

See original GitHub issue

I’d like to implement a “loose” spell checking mode, where if a word is not correct but there are no suggestions for it then the spell checker doesn’t yell at the user.

I can currently do something like this to check if there are any suggestions:

const hasSuggestions = !!instance.suggest ( word ).length;

But that would compute all possible suggestions, and I don’t really care about having them available to me at that point in time, so I’d like nspell to have a method that allows me to implement that in a much more efficient way, like:

const hasSuggestions = instance.hasSuggestions ( word );

Which more practically would exit early from unnecessary expensive loops like this one:

https://github.com/wooorm/nspell/blob/c92902162193084027a5a8b7259702af90804528/lib/suggest.js#L274-L276

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
fabiospampinatocommented, Sep 21, 2020

Does your recent work change your need for this feature? It doesn’t make a lot of sense to me (as the 1st result might be bad)

Not really. But I’ve changed my mind on this a bit, the added confusion of having words highlighted differently depending on if they’ll have any suggestions or not might not be worth it, like I’ve never seen a two-tier spell checker like that 🤔 Plus performance-wise this may backfire even, as suggestions can be memoized, but if you need to know if there are any suggestions before actually computing any of them, and then later on computing them, you’ll be computing the first suggestion twice rather than once essentially.

So let me close this, eventually if I’ll change my mind on this again I’ll submit a PR or something.

0reactions
wooormcommented, Sep 21, 2020

Does your recent work change your need for this feature? It doesn’t make a lot of sense to me (as the 1st result might be bad)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules with suggestions must set the `meta.hasSuggestions ...
I'm basically running into an issue where eslint is asking me to set meta.hasSuggestions to true. When I use "react-hooks/exhaustive-deps": ...
Read more >
Set the `meta.hasSuggestions` property to `true`. `meta.docs ...
js project with npm run build , I am getting following error, I have tried many solution but nothing is working for me....
Read more >
Class ProductSuggestions
This method returns a list of products which were found using the suggested terms as search criteria. The product lookup is being executed...
Read more >
Intent.MessageOrBuilder (Google Cloud API gRPC 0.63.0 API)
The voice and text-only responses for Actions on Google. boolean, hasSuggestions(). The suggestion chips for Actions on Google. boolean, hasText().
Read more >
MentionsUserPicker (Atlassian JIRA 7.8.2 API)
Method Summary ; com.atlassian.pageobjects.elements.query.TimedCondition, hasSuggestion(String username) ; boolean, hasSuggestions() ; com.atlassian.pageobjects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found