-
Notifications
You must be signed in to change notification settings - Fork 847
Fix AddReturnType refactoring throwing when file not in project #19052
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
Conversation
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
vsintegration/tests/FSharp.Editor.Tests/Refactors/AddReturnTypeTests.fs
Outdated
Show resolved
Hide resolved
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
Fix AddReturnType refactoring throwing on non-existent files
Problem: The AddReturnType refactoring throws when invoked on a file that's not yet known to the F# extension (e.g., file copied but project options not refreshed).
Solution: Wrapped the refactoring logic in a try-catch block to handle exceptions gracefully.
Changes Made:
GetFSharpParseAndCheckResultsAsyncwhen file not in projectGetFSharpParseAndCheckResultsAsyncin a try-catch in AddReturnType.fsFiles Changed:
vsintegration/src/FSharp.Editor/Refactor/AddReturnType.fs- Added try-catch block with wildcard patternvsintegration/tests/FSharp.Editor.Tests/Refactors/AddReturnTypeTests.fs- Improved test to create a document not in F# project optionsReady for merge - The fix is minimal and surgical, addressing exactly the issue described. The test now properly simulates the race condition scenario.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.