fix: Bicep module ref path — strip bicep/ prefix, lookup by ref_path
Two bugs fixed in BicepModuleCatalog:
1. as_completion_items() generated 'br/modules:bicep/modules/appservice:...'
but bicepconfig modulePath='bicep' means Bicep prepends 'bicep/' automatically.
Fix: store ref_path = path.removeprefix('bicep/') and use it in insertText.
Correct output: 'br/modules:modules/appservice:2.3.x'
2. version/param lookups used get_module_by_name() which only matches the last
path segment ('appservice'). New-style refs capture 'modules/appservice' from
the regex, so lookup returned empty. Fix: add get_module_by_ref() that matches
both ref_path and bare name.
Also fixes _iac_param_map to strip path prefix so IAC source descriptions
still enrich completions for 'modules/appservice' refs.
All 63 tests pass.
This commit is contained in:
@@ -31,9 +31,11 @@ def _completion_response(items: list) -> dict:
|
||||
|
||||
def _make_module(name, versions=None, schema=None):
|
||||
versions = versions or ["1.0.0", "latest"]
|
||||
path = f"bicep/modules/{name}"
|
||||
return {
|
||||
"name": name,
|
||||
"path": f"bicep/modules/{name}",
|
||||
"path": path,
|
||||
"ref_path": f"modules/{name}", # what appears after 'br/modules:' in bicep files
|
||||
"versions": versions,
|
||||
"latest": versions[-1],
|
||||
"registry": "iactemplatereg.azurecr.io",
|
||||
|
||||
Reference in New Issue
Block a user