Skip to content

Conversation

@ChouUn
Copy link

@ChouUn ChouUn commented Oct 28, 2025

more details in #1665

Copilot AI review requested due to automatic review settings October 28, 2025 23:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the source map traceback regex pattern to avoid incorrectly matching anonymous function stack entries. The regex is updated to exclude the < character from file path matching, preventing matches against patterns like in function <...> that appear in Lua stack traces.

  • Updated regex pattern from (%S+) to ([^%s<]+) to exclude < character
  • Added comprehensive comments explaining the fix and its limitations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1665
// Avoid matching anonymous function stack entries like `in function <...>`
// by excluding `<` before the file path.
// TODO: This will still fail for paths containing spaces.
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The TODO comment mentions that paths with spaces will fail, but this is a known limitation of the current implementation. Consider adding more context about why this limitation exists (the pattern uses [^%s<]+ which excludes whitespace) and potential workarounds or future solutions.

Suggested change
// TODO: This will still fail for paths containing spaces.
// TODO: This will still fail for paths containing spaces.
// The Lua pattern used here ("([^%s<]+)%.lua:(%d+)") excludes whitespace to avoid matching
// anonymous function stack entries (e.g., 'in function <...>'). As a result, file paths with spaces
// are not matched and will not be rewritten in the stack trace.
// Potential workarounds: use a more sophisticated pattern, escape spaces in file paths, or
// post-process stack traces to handle these cases in the future.

Copilot uses AI. Check for mistakes.
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.

1 participant