Step 137: composition builder

This commit is contained in:
Bill
2026-02-09 17:32:17 -07:00
parent 60f3131ed9
commit 4bfaaa6cce
8 changed files with 238 additions and 2 deletions

View File

@@ -307,6 +307,7 @@ int main(int, char**) {
&state.showTerminalPanel);
ImGui::MenuItem("Dependencies", nullptr, &state.showDependencyPanel);
ImGui::MenuItem("Libraries", nullptr, &state.showLibraryBrowserPanel);
ImGui::MenuItem("Compose", nullptr, &state.showCompositionPanel);
ImGui::MenuItem("Settings", nullptr, &state.showSettingsPanel);
ImGui::MenuItem("LSP Servers...", nullptr, &state.showLspSettings);
if (state.active()) {
@@ -588,6 +589,27 @@ int main(int, char**) {
ImGui::End();
}
if (state.showCompositionPanel) {
ImGui::Begin("Compose", &state.showCompositionPanel);
ImGui::PushFont(uiFont);
std::string nodeId;
if (state.activeAST()) {
ASTNode* scopeNode = findNodeAtPosition(state.activeAST(),
std::max(0, state.active()->cursorLine - 1),
std::max(0, state.active()->cursorCol - 1));
if (scopeNode) nodeId = scopeNode->id;
}
std::vector<PrimitiveSymbol> primitives;
auto funcs = state.primitives.getAvailableFunctions(nodeId);
primitives.insert(primitives.end(), funcs.begin(), funcs.end());
std::string code;
if (renderCompositionPanel(state.compositionPanel, primitives, code, state.outputLog)) {
state.insertTextAtCursor(code);
}
ImGui::PopFont();
ImGui::End();
}
// ---------------------------------------------------------------
// Find / Replace bar (floating at top of editor)
// ---------------------------------------------------------------