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

feat(Remix): Added Spotlight option in server config #547

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Shubhdeep12
Copy link
Contributor

Added comment to add spotlight in Sentry.init for remix server config

Note: We did not include the installation and setup of Spotlight because it is not added by default, and it is also not mandatory.

#535

Comment on lines 108 to 109
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
Copy link
Member

@Lms24 Lms24 Mar 11, 2024

Choose a reason for hiding this comment

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

Have you tested this in a Remix application? I don't think this works as you'd expect. Unless I'm missing something, this is a pure code comment and won't be picked up by the function call builder that generates the AST for the Sentry.init call.

If you tested this and things work, please disregard the rest of this comment :)

It's very closely related to what I wrote in #546 about AST manipulation. Maybe we need to find a way to make this work rather sooner than later.

What I was trying to do earlier when reviewing #546 was using a recast builder to manually build the AST. It allows me to insert comments into an AST node like the options object. If you wanna take a look at this, we already do stuff like this in ast-utils.ts: https://github.com/Shubhdeep12/sentry-wizard/blob/088ffb2452d0a7a00521282a3f5de59d53d2d832/src/utils/ast-utils.ts#L121-L152

Maybe we can use this here, too. So basically change the magiacst builder to a recast.types.builder and manually construct things. But we have to find a way to preserve code formatting (as well as possible) when the code is generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, looks like magicast builder is removing the comments. my bad, I think I missed checking this.
let me try the suggested sol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Lms24 not sure if we can add comments in objects in recast too using builder functions.
But with magicast and recast, there is this way to add comments viz. writing code itself instead of the builder function.
I tried to put the code directly and then parsed it. It's working fine and not removing the comments now.

Any input here? Can we do this way?
Screenshot from 2024-03-18 09-03-55

Copy link
Member

Choose a reason for hiding this comment

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

Hey @Shubhdeep12 yup, if that gets the job done, let's do it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed the fix @Lms24

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

Successfully merging this pull request may close these issues.

2 participants