-
Notifications
You must be signed in to change notification settings - Fork 775
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
adding generate params command #6601
adding generate params command #6601
Conversation
Thanks for the contribution @polatengin! Can you clarify the intended usage of the feature? I looked in the command bar in VS code and tried right-clicking on the file name, but didn't see anything in either location. Is this implemented in the CLI? |
@shenglol and @anthony-c-martin when either of you have time. From my understanding, the updates that were made were to make this command available in the Bicep CLI as well as the Command Pallete. Thank you! Questions for @polatengin,
|
hey @ucheNkadiCode , You're right, GenerateParams implemented in both the CLI and the VSCode Extension (I also added required structures into the Language Server)
Yes, it overwrites the parameters file, if there is already one. if this is not the expected behavior, I can change it.
I didn't implemented telemetry, let me check how can I do it. |
src/Bicep.LangServer/Handlers/BicepGenerateParamsCommandHandler.cs
Outdated
Show resolved
Hide resolved
src/Bicep.LangServer/Handlers/BicepGenerateParamsCommandHandler.cs
Outdated
Show resolved
Hide resolved
…r.cs Co-authored-by: Stephen Weatherford (MSFT) <StephenWeatherford@users.noreply.github.com>
…r.cs Co-authored-by: Stephen Weatherford (MSFT) <StephenWeatherford@users.noreply.github.com>
…r.cs Co-authored-by: Stephen Weatherford (MSFT) <StephenWeatherford@users.noreply.github.com>
Co-authored-by: Stephen Weatherford (MSFT) <StephenWeatherford@users.noreply.github.com>
…r.cs Co-authored-by: Stephen Weatherford (MSFT) <StephenWeatherford@users.noreply.github.com>
…ehavior, updating existing tests
} | ||
|
||
var emitter = new TemplateEmitter(compilation.GetEntrypointSemanticModel(), emitterSettings); | ||
using var fileStream = new FileStream(compiledFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think FileMode.OpenOrCreate
is what you want here - it means you'll potentially only overwrite part of the file if you write fewer bytes than the size of the existing file.
For example, if I run the command to generate the file, add some newlines to pad it a bit, and run the command again, I get the following (note lines 28-30 left behind from the old file after the JSON ends):
…nature of emitparametersfile methods, updating tofile method signature accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for contributing!
Fixes #512
Contributing a feature
/cc: @majastrz , @ucheNkadiCode