From 7d35cce8813cedb362f2c032dc154ee39727cdc8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:38:22 +0000 Subject: [PATCH 1/4] Initial plan From 36e4f91e313a41ea9ec2740b0acf603001200ebf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:45:24 +0000 Subject: [PATCH 2/4] Add sidebar with example cases to playground Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com> --- samples/language-service-sample/app.js | 142 +++++++++++++++++++++ samples/language-service-sample/index.html | 15 ++- samples/language-service-sample/styles.css | 109 ++++++++++++++++ 3 files changed, 265 insertions(+), 1 deletion(-) diff --git a/samples/language-service-sample/app.js b/samples/language-service-sample/app.js index 09d0b17..1bb9e89 100644 --- a/samples/language-service-sample/app.js +++ b/samples/language-service-sample/app.js @@ -43,6 +43,148 @@ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) initTheme(); +// Examples data +const exampleCases = [ + { + id: 'math', + title: 'Mathematical Expression', + description: 'Basic math operations with variables', + expression: '(x + y) * multiplier + sqrt(16)', + context: { + x: 10, + y: 5, + multiplier: 3 + } + }, + { + id: 'arrays', + title: 'Working with Arrays', + description: 'Array functions like sum, min, max', + expression: 'sum(numbers) + max(numbers) - min(numbers)', + context: { + numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + values: [15, 25, 35] + } + }, + { + id: 'objects', + title: 'Object Manipulation', + description: 'Access nested object properties', + expression: 'user.profile.score * level.multiplier + bonus.points', + context: { + user: { + name: "Alice", + profile: { + score: 85, + rank: "Gold" + } + }, + level: { + current: 5, + multiplier: 1.5 + }, + bonus: { + points: 100, + active: true + } + } + }, + { + id: 'map-filter', + title: 'Map and Filter Functions', + description: 'Transform and filter data with callbacks', + expression: 'sum(map(filter(items, item => item > 3), x => x * 2))', + context: { + items: [1, 2, 3, 4, 5, 6, 7, 8], + threshold: 3 + } + }, + { + id: 'complex', + title: 'Complex Objects', + description: 'Work with deeply nested data structures', + expression: 'company.departments[0].employees.length * company.settings.bonusRate + sum(map(company.departments, d => d.budget))', + context: { + company: { + name: "TechCorp", + departments: [ + { + name: "Engineering", + budget: 500000, + employees: ["John", "Jane", "Bob"] + }, + { + name: "Marketing", + budget: 200000, + employees: ["Alice", "Carol"] + } + ], + settings: { + bonusRate: 0.15, + fiscalYear: 2024 + } + } + } + } +]; + +// Render examples sidebar +function renderExamplesSidebar() { + const examplesList = document.getElementById('examplesList'); + if (!examplesList) return; + + examplesList.innerHTML = exampleCases.map(example => ` + + `).join(''); + + // Add click handlers + examplesList.querySelectorAll('.example-item').forEach(button => { + button.addEventListener('click', () => { + const exampleId = button.dataset.exampleId; + const example = exampleCases.find(e => e.id === exampleId); + if (example) { + loadExample(example); + } + }); + }); +} + +// Load example into editors +function loadExample(example) { + if (typeof expressionEditor !== 'undefined' && expressionEditor) { + expressionEditor.getModel().setValue(example.expression); + } + if (typeof contextEditor !== 'undefined' && contextEditor) { + contextEditor.getModel().setValue(JSON.stringify(example.context, null, 2)); + } +} + +// Initialize sidebar +renderExamplesSidebar(); + // Split pane resizing (function() { const resizer = document.getElementById('resizer'); diff --git a/samples/language-service-sample/index.html b/samples/language-service-sample/index.html index 3599fa1..64a550b 100644 --- a/samples/language-service-sample/index.html +++ b/samples/language-service-sample/index.html @@ -53,8 +53,21 @@