fix(actor): read lsp_binding from NodeDefinition field instead of config dict in compiler

The _extract_lsp_bindings() function now reads from the dedicated typed
node.lsp_binding (NodeLspBinding) field and converts it to LspBinding records.
Also maintains backward compatibility by checking the config dict for legacy
lsp_bindings configuration.

Fixes the issue where per-node LSP bindings configured via the lsp_binding:
YAML key were being silently ignored during actor graph compilation.

ISSUES CLOSED: #1432
This commit is contained in:
2026-04-27 11:50:10 +00:00
committed by drew
parent fc9d66a450
commit 726f48ad39
+27 -1
View File
@@ -156,11 +156,36 @@ def _map_edge(edge: EdgeDefinition) -> lg_nodes.Edge:
def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]:
"""Extract LSP bindings from a node config block."""
"""Extract LSP bindings from a node's dedicated lsp_binding field.
Reads from the typed ``node.lsp_binding`` (NodeLspBinding) field and
converts to LspBinding records. Also checks config dict for backward
compatibility with legacy ``lsp_bindings`` config key.
Args:
node: The node definition to extract bindings from.
Returns:
List of LspBinding records for this node.
"""
bindings: list[LspBinding] = []
# Primary path: read from the dedicated typed field (NodeLspBinding)
if node.lsp_binding is not None:
bindings.append(
LspBinding(
node_name=node.id,
lsp_server_name=node.lsp_binding.server or "",
languages=node.lsp_binding.languages or [],
auto_detect=node.lsp_binding.auto if node.lsp_binding.auto is not None else True,
)
)
# Fallback path: check config dict for backward compatibility
raw_bindings = node.config.get("lsp_bindings", [])
if not isinstance(raw_bindings, list):
return bindings
for entry in raw_bindings:
if not isinstance(entry, dict):
continue
@@ -175,6 +200,7 @@ def _extract_lsp_bindings(node: NodeDefinition) -> list[LspBinding]:
auto_detect=entry.get("auto_detect", True),
)
)
return bindings