Skip to content

Add evaluate-math-expression extension#17089

Merged
raycastbot merged 8 commits intoraycast:mainfrom
DervexDev:ext/evaluate-math-expression
Feb 28, 2025
Merged

Add evaluate-math-expression extension#17089
raycastbot merged 8 commits intoraycast:mainfrom
DervexDev:ext/evaluate-math-expression

Conversation

@DervexDev
Copy link
Contributor

@DervexDev DervexDev commented Feb 15, 2025

Description

Screencast

Checklist

@raycastbot raycastbot added the new extension Label for PRs with new extensions label Feb 15, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Feb 15, 2025

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days

Once the PR is approved and merged, the extension will be available on our Store.

@pernielsentikaer
Copy link
Collaborator

@greptileai can you do a review here 😊

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds a new "Evaluate Math Expression" extension that reads selected text, evaluates it as a math expression, and outputs the result according to user preferences.

  • In CHANGELOG.md, please use {PR_MERGE_DATE} instead of the hardcoded date "2025-02-15" - this will be automatically replaced with the current date upon merging
  • In src/evaluate-math-expression.ts, error handling could be simplified with showFailureToast from @raycast/utils instead of the current showToast implementation
  • The evaluate function is marked as async but doesn't contain any await operations
  • Consider adding validation for empty text selection before evaluation
  • The Preferences interface in preferences.ts is unnecessary as it's autogenerated in raycast-env.d.ts

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

10 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

return {
...preferences,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
maxDecimals: parseInt(preferences.maxDecimals as any) || undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using Number(preferences.maxDecimals) instead of parseInt() to handle decimal values properly

@pernielsentikaer pernielsentikaer self-assigned this Feb 27, 2025
DervexDev and others added 4 commits February 27, 2025 16:35
Co-authored-by: Per Nielsen Tikær <per@raycast.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…on.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@DervexDev
Copy link
Contributor Author

@pernielsentikaer Done!

# Evaluate Math Expression

A [Raycast](https://www.raycast.com/) extension that reads current selection, evaluates the math expression, and shows it in a desired way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a few examples here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2025-02-28.at.9.16.37.PM.mov

There is no good way to showcase this extension using static images. Does Raycast support GIFs?

Comment on lines +3 to +8
export interface Preferences {
maxDecimals?: number;
replaceSelection: boolean;
copyToClipboard: boolean;
displayResult: boolean;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to manually set preference types as this is autogenerated in raycast-env.d.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified it, but I can't get rid of it completely as the maxDecimals field has a different type

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit f1b95aa into raycast:main Feb 28, 2025
2 checks passed
@github-actions
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/Dervex/evaluate-math-expression

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants