[editor] Add multiple snippet support to the statement parser
@@ -3128,10 +3128,15 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
}, HUE_PUB_SUB_APP);
huePubSub.subscribe('editor.active.statement.changed', function (statementDetails) {
+ var foundSnippet = viewModel.selectedNotebook().snippets().filter(function (snippet) {
+ return snippet.ace() && snippet.ace().container.id === statementDetails.id;
+ });
+ if (foundSnippet.length == 1) {
if (statementDetails.activeStatement) {
- viewModel.selectedNotebook().snippets()[0].positionStatement(statementDetails.activeStatement.statement);
+ foundSnippet[0].positionStatement(statementDetails.activeStatement.statement);
} else {
- viewModel.selectedNotebook().snippets()[0].positionStatement('');
+ foundSnippet[0].positionStatement('');
+ }
}
}, HUE_PUB_SUB_APP);
