microsoft / vscode-azurearmtools

Azure Resource Manager Tools for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools
MIT License
135 stars 81 forks source link

Should we automatically switch to JSONC or arm-template in a parameter file? (was: Add comment in parameter file marked as error) #933

Open yeswps opened 4 years ago

yeswps commented 4 years ago

When add comment in parameter file, it mark as an error under Problems section.

Looks like it's not recognizing it's a ARM parameter file, rather treated it as a regular JSON file

image

StephenWeatherford commented 4 years ago

@yeswps Thanks for taking the time to enter this issue. We do recognize the file but for various reasons don't currently change the language ID for parameter files. You can get rid of the errors by manually changing the language id to "JSONC" (click on "JSON" in the status bar).

Leaving open to consider automatically changing to JSONC for parameter files.

yeswps commented 4 years ago

@StephenWeatherford I've tried to switch the format to JSON with comment, it works in current session, but if I close the JSON file and reopen it, it came back been recognized as plan JSON file.

StephenWeatherford commented 4 years ago

@yeswps Thanks, I had thought vs code remembered the setting, but apparently not once it's closed. In that case I think we should definitely add the ability to automatically convert to jsonc.

In the meantime, I suggest adding this to your settings file:

"files.associations": {
    "*.parameters.json": "jsonc",
    "*.params.json": "jsonc"
}
jodavis commented 4 years ago

We are leaning toward changing the language ID to JSONC for these files.

StephenWeatherford commented 3 years ago

https://github.com/microsoft/vscode-azurearmtools/tree/saw/language-server-dotnet-acquisition-changebacktojson