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

Add error marker when invalid main function #9489

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

martmull
Copy link
Contributor

@martmull martmull commented Jan 9, 2025

Before

image

After

image

@martmull martmull linked an issue Jan 9, 2025 that may be closed by this pull request
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

Added error marker functionality to validate serverless function exports in the code editor, with custom Monaco editor markers for visual feedback.

  • Added setMarkers prop in CodeEditor.tsx to support custom Monaco editor markers during validation
  • Added new utility getWrongExportedFunctionMarkers.ts to detect invalid 'main' function exports using regex patterns
  • Fixed issue with hardcoded endLineNumber=1 in marker coordinates which could cause incorrect error highlighting
  • Implemented marker cleanup by setting empty markers array when validation passes
  • Added model state management in CodeEditor.tsx to properly track and update markers

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

@martmull martmull force-pushed the 9395-fix-serverless-function-is-forced-to-be-named-main branch from a5e555d to 9c8606d Compare January 9, 2025 14:29
@martmull martmull force-pushed the 9395-fix-serverless-function-is-forced-to-be-named-main branch from c2390f1 to 244cc78 Compare January 9, 2025 14:59
@martmull martmull enabled auto-merge (squash) January 9, 2025 15:13
Copy link
Contributor

@Devessier Devessier left a comment

Choose a reason for hiding this comment

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

That's perfect! Thank you! I approve the PR. Maybe we can write a few tests for the getWrongExportedFunctionMarkers function.

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

Successfully merging this pull request may close these issues.

Fix: Serverless function is forced to be named 'main'
3 participants