Skip to content

[word-search] Capitalize output when search text is capitalize#8705

Merged
pernielsentikaer merged 10 commits intoraycast:mainfrom
bkeys818:word-search-uppercase
Oct 30, 2023
Merged

[word-search] Capitalize output when search text is capitalize#8705
pernielsentikaer merged 10 commits intoraycast:mainfrom
bkeys818:word-search-uppercase

Conversation

@bkeys818
Copy link
Contributor

@bkeys818 bkeys818 commented Oct 6, 2023

Description

When the search text is capitalized, the copied/pasted word will also be capitalized.

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: rishabswift/word-search Issues related to the rishabswift/word-search extension labels Oct 6, 2023
@raycastbot
Copy link
Collaborator

raycastbot commented Oct 6, 2023

Thank you for your contribution! 🎉

🔔 @RishabSwift @thomaspaulmann you might want to have a look.

@pernielsentikaer
Copy link
Collaborator

Hi @bkeys818 👋

Thanks for your contribution 🔥

Wouldn't it make sense to uppercase in the list too, now that it's done in the actions?

@RishabSwift do you mind checking this

@pernielsentikaer pernielsentikaer self-assigned this Oct 11, 2023
@bkeys818
Copy link
Contributor Author

@pernielsentikaer, Can't hurt

@pernielsentikaer
Copy link
Collaborator

@RishabSwift do you have time to check?

@RishabSwift
Copy link
Contributor

Thanks for the feature! Will check it out in a few hours

@RishabSwift
Copy link
Contributor

@bkeys818 I just tried it out.

Doesn't seem to work?

Screenshot 2023-10-15 at 18 04 31@2x

It is not capitalizing the list nor the actions for me (like when I copy or paste in active app).

@frntline-dev
Copy link

@bkeys818, I think it's preferable to capitalize the words as they are extracted from the request response in the API file rather than in the search results. This approach keeps everything consolidated in one location and avoids the need to manipulate the render method.

What do you think?

Co-authored-by: Rishab Swift <15897093+RishabSwift@users.noreply.github.com>
@bkeys818
Copy link
Contributor Author

@frntline-dev, I'd probably help to explain why I suggested this change.

I use to use Alfred 5, which had "spell", a similar functionally to this extension. One of my favorite features was that it would match the case of the original word.

When I use this extension, I'll copy a word I'm unsure is spelled right and call the extension. Then, I select the correct word which replaces the original. When the misspelled is the first word in a sentence (aka. capitalized), the corrected spelling always appears all lowercase. That means I have to go back and re-capitalize it every time.

I acknowledge that it's a minor annoyance, but I think the fix is justified since it's insignificant. That's just my opinion. I'd love to hear what other people think.

@pernielsentikaer
Copy link
Collaborator

We could also make it a preference if it should happen or not and then lease default behavior as today and make a toggle for it 🙂

@RishabSwift
Copy link
Contributor

@bkeys818 I think there's a better way to achieve the capitalization of the first letter.

For example, in the api.ts, you could simply do the following at the last block of code that parses the definition of each word search result (line 28)

words.forEach((word) => {
   ...

    // if wordToSearch is capitalized, capitalize the first letter of the word
    if (wordToSearch[0] === wordToSearch[0].toUpperCase()) {
        word.word = word.word[0].toUpperCase() + word.word.slice(1);
    }

   ...
});

This centralizes the logic, ensuring the tsx file remains clean and focused on rendering.

I think this is a better way to go about it, don't you think?

@bkeys818
Copy link
Contributor Author

@RishabSwift, that is an excellent idea. I'll get it done right now.

@pernielsentikaer
Copy link
Collaborator

Can you check it again @RishabSwift

@RishabSwift
Copy link
Contributor

Looks great @bkeys818! Thanks for taking the time 💯

@RishabSwift
Copy link
Contributor

Can you check it again @RishabSwift

All looks well!

@pernielsentikaer
Copy link
Collaborator

Awesome, thanks 🔥

@pernielsentikaer pernielsentikaer merged commit a41faee into raycast:main Oct 30, 2023
@raycastbot
Copy link
Collaborator

Published to the Raycast Store:
https://raycast.com/rishabswift/word-search

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@bkeys818 bkeys818 deleted the word-search-uppercase branch November 18, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: rishabswift/word-search Issues related to the rishabswift/word-search extension status: awaiting response from dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants