- Notifications
You must be signed in to change notification settings - Fork825
Properly handle console-only fsc options in the VS context#13702
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
psfinaki commentedAug 16, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Copying here, as the ‘resolved’ review comments get hidden: Got it, tx. Does this mean using -version or any illegal option, will now be simply ignored? Or would it allow outputting the version info on each build to the VS console? |
@psfinaki --- hey there, there is another case, and it's a little bit wierder. The command fsc --langversion:4.7 allows you to use ? to get the list of valid versions and then does an exit 1 The handler is here: And the specification is here: I think it may be a lit bit different from your CONSOLE_ONLY items, because it can also contain real options, as well as the help request. |
@KevinRansom Yep, thanks for the point, I think I will address that separately in a followup. That thing is just ridiculous - the function is called "setLanguageVersion" but actually it sometimes sets the version and sometimes gets the versions. That's like against all the coding principles, so I'll better do a small refactoring and testing around that. |
@abelbraaksma so normally invalid compiler options are reported. Both in console: It's just that you hit a special/reserved case with this So the current implementation will preserve reporting errors in VS for bad options whereas for these special readonly options VS will be just silent. Now as I'm thinking about, I might actually come with a followup to somehow point this out instead of remaining silent - but let this PR just fix the bug itself. |
On the review with@KevinRansom, we've realized that there's an existing mechanism for proper exit from the compiler - using of exiters (with StopProcessing exceptions probably). For example: Lines 77 to 108 inaf0015e
or: fsharp/src/Compiler/Service/service.fs Lines 119 to 129 inaf0015e
Wondering how easy will it be to plug into the cli options, since it is designed for cases like this and is probably the right way of dealing with it. |
@vzarytovskii Good point - I'd say it's a related possible improvement so will do it as a followup. |
Ok, I'm going to merge it, and let's have the one with exiter next. |
I finally had some time actually test this locally. Excellent work@psfinaki, solution works like a charm! |
@abelbraaksma, my pleasure :) |
Uh oh!
There was an error while loading.Please reload this page.
fixes#13549
Changes the notion of help options to the console-only related options, which now include
--help
and--version
.Also added a test (best effort).
Video proof :D
TestCrash.-.Microsoft.Visual.Studio.Int.Preview.2022-08-16.17-46-09.mp4