From 02c09f1d18df1790f2deb99d2a41453f1953dfac Mon Sep 17 00:00:00 2001 From: Henrik Jess Nielsen Date: Mon, 11 May 2026 11:37:50 +0200 Subject: [PATCH] fix(bicep): always suppress LS noise in version/param/param_value contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the 'if lru_items:' guard meant that when our catalog returned an empty list (e.g. a param with no allowed enum values), the Bicep LS completions (Bicep keywords, schema types) would leak through unchanged. Now the replace is unconditional for version/param/param_value contexts. The Bicep LS has no knowledge of our private ACR registry so its output in these positions is always noise — suppress it even when we have nothing better to show. --- ilsp/bicep_lsp/proxy.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ilsp/bicep_lsp/proxy.py b/ilsp/bicep_lsp/proxy.py index 258b339..ec2fa64 100644 --- a/ilsp/bicep_lsp/proxy.py +++ b/ilsp/bicep_lsp/proxy.py @@ -201,25 +201,25 @@ def _inject_completions(msg: dict[str, Any], context: dict | None = None) -> byt # Default: module name completions lru_items = BicepModuleCatalog.as_completion_items() - if lru_items: - if ctx_type in ("version", "param", "param_value"): - # Replace LS completions entirely — the Bicep LS doesn't know about - # the private registry, so its suggestions here are noise/random. - if isinstance(result, list): - msg["result"] = lru_items - else: - result["items"] = lru_items - result["isIncomplete"] = False + if ctx_type in ("version", "param", "param_value"): + # Always replace LS completions for private-registry contexts — the + # Bicep LS doesn't know about our ACR, so anything it returns is noise. + # Even if lru_items is empty (no enum values for a param), suppress LS. + if isinstance(result, list): + msg["result"] = lru_items else: - # module_path / unknown: keep LS completions below ours - for item in items: - st = item.get("sortText", item.get("label", "")) - item["sortText"] = f"1_az_{st}" - if isinstance(result, list): - msg["result"] = lru_items + items - else: - result["items"] = lru_items + items - result["isIncomplete"] = True + result["items"] = lru_items + result["isIncomplete"] = False + elif lru_items: + # module_path / unknown: keep LS completions below ours + for item in items: + st = item.get("sortText", item.get("label", "")) + item["sortText"] = f"1_az_{st}" + if isinstance(result, list): + msg["result"] = lru_items + items + else: + result["items"] = lru_items + items + result["isIncomplete"] = True return json.dumps(msg).encode()