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.
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
anthony-c-martin
left a comment
There was a problem hiding this comment.
Looks good, thanks for contributing!
Fixes #512
Contributing a feature
/cc: @majastrz , @ucheNkadiCode