Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.2k stars 742 forks source link

There is no configuration in VSCode `settings.json` to enable imports #9866

Closed asilverman closed 1 year ago

asilverman commented 1 year ago

Bicep version image

Describe the bug There is no VSCode setting to enable the extensibility features, please add some setting and documentation about how to configure this, for example as shown below:

image

image

Additional Information

Take a look at:

alex-frankel commented 1 year ago

Details here on what properties need to be set in bicepconfig.json: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-config#enable-experimental-features

Your bicepconfig in the bottom right looks correct. You may need to restart VS code (or close all bicep-associated files) for the changes to take effect.

asilverman commented 1 year ago

I restarted VS Code (and closed all bicep-associated files) but unfortunately the changes did not take effect and the issue continues to reproduce after performing these steps

asilverman commented 1 year ago

I discussed the issue with @shenglol and he mentioned that the bicepconfig.json need to be in the same directory level as the bicep file being compiled. This mitigates the problem locally; however it has a negative effect on the user experience.

Consider the following:

  1. The method by which these configurations are set (bicepconfig.json) is not the convention for VSCode extensions (settings.json)
  2. A Bicep user may be attempting to work on a file during an exploration and the information relating bicepconfig.json is not readily available)
  3. It is counter-intuitive to have two separate ways to configure the extension (bicepconfig.json and settings.json)

I filed https://github.com/Azure/bicep/issues/9902 to mitigate the issue in the meantime for a global configuration of the language server but I think that we should still consider what should the settings.json do.

jeskew commented 1 year ago

I agree with all three of your points, but those are the same considerations that led Bicep to standardize on the bicepconfig.json file.

The approach that we've adopted wrt Bicep configuration is that a Bicep file should not be compiled differently based on which tool is being used. A common user experience involves authoring Bicep templates in VS Code (which compiles and lints via the language server) and then deploying those same templates via the az CLI (which compiles via the Bicep CLI). Currently, the VS Code settings.json file is only used to configure how the language server works (e.g., should "paste as Bicep" (which has no equivalent in the CLI) be enabled?) and does not impact how Bicep templates are compiled.

In general, most users shouldn't need to use a bicepconfig.json file, but where they do, the configuration is specific to a template or project. For example, a user may employee different registry aliasing configurations in different projects, or even within a single project, an experimental feature may only be enabled for a subset of templates.

alex-frankel commented 1 year ago

We discussed this and want to keep things separated the way they are now, but we would like to pursue #9902 as a way of avoiding parts of this issue in the future. Closing for now, but happy to continue the discussion.