Skip to content

Commit 5e25865

Browse files
Add support for if and for statements in Talon-script (#3274)
1 parent 2a5155a commit 5e25865

15 files changed

Lines changed: 1501 additions & 1206 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 2026
44

5+
- 2026-05-03: Add support for if and for statements in Talon-script. [`#3274`](https://github.com/cursorless-dev/cursorless/pull/3274)
56
- 2026-03-12: Added `userColor3` and `userColor4` as additional user-configurable hat colors. They are disabled by default until you enable and name them. ([#3206](https://github.com/cursorless-dev/cursorless/pull/3206))
67
- 2026-03-11: Moved scope tests out of VSCode so they can run as regular unit tests with faster local and CI feedback. ([#3210](https://github.com/cursorless-dev/cursorless/pull/3210))
78
- 2026-03-11: Git actions can now stage and unstage entire files, not just partial selections. ([#3209](https://github.com/cursorless-dev/cursorless/pull/3209))

packages/app-web-docs/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
"build": "docusaurus build --out-dir out"
2424
},
2525
"dependencies": {
26-
"@algolia/client-search": "^5.51.0",
26+
"@algolia/client-search": "^5.52.0",
2727
"@cursorless/lib-common": "workspace:*",
2828
"@docsearch/react": "^4.6.3",
29-
"@docusaurus/core": "^3.10.0",
30-
"@docusaurus/faster": "^3.10.0",
31-
"@docusaurus/preset-classic": "^3.10.0",
32-
"@docusaurus/theme-classic": "^3.10.0",
33-
"@docusaurus/theme-common": "^3.10.0",
34-
"@docusaurus/theme-search-algolia": "^3.10.0",
29+
"@docusaurus/core": "^3.10.1",
30+
"@docusaurus/faster": "^3.10.1",
31+
"@docusaurus/preset-classic": "^3.10.1",
32+
"@docusaurus/theme-classic": "^3.10.1",
33+
"@docusaurus/theme-common": "^3.10.1",
34+
"@docusaurus/theme-search-algolia": "^3.10.1",
3535
"@mdx-js/react": "^3.1.1",
3636
"bootstrap": "^5.3.8",
3737
"docusaurus-plugin-sass": "^0.2.6",
@@ -43,8 +43,8 @@
4343
},
4444
"devDependencies": {
4545
"@cursorless/lib-node-common": "workspace:*",
46-
"@docusaurus/module-type-aliases": "^3.10.0",
47-
"@docusaurus/types": "^3.10.0",
46+
"@docusaurus/module-type-aliases": "^3.10.1",
47+
"@docusaurus/types": "^3.10.1",
4848
"@types/mdast": "^4.0.4",
4949
"@types/mocha": "^10.0.10",
5050
"@types/node": "^24.12.2",

packages/lib-common/src/scopeSupportFacets/talon.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,34 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = {
1414

1515
"comment.line": supported,
1616

17+
"condition.if": supported,
18+
1719
"interior.command": supported,
20+
"interior.if": supported,
21+
"interior.foreach": supported,
1822

1923
"name.assignment": supported,
2024
"name.command": supported,
2125
"name.variable.initialized": supported,
26+
"name.foreach": supported,
2227
"name.iteration.block": supported,
2328
"name.iteration.document": supported,
2429

2530
"statement.command": supported,
2631
"statement.variable.initialized": supported,
2732
"statement.assignment": supported,
2833
"statement.functionCall": supported,
34+
"statement.if": supported,
35+
"statement.foreach": supported,
2936
"statement.iteration.block": supported,
3037
"statement.iteration.document": supported,
3138

39+
ifStatement: supported,
40+
3241
"value.assignment": supported,
3342
"value.command": supported,
3443
"value.variable": supported,
44+
"value.foreach": supported,
3545
"value.iteration.block": supported,
3646
"value.iteration.document": supported,
3747

@@ -231,15 +241,11 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = {
231241
"name.argument.catch": notApplicable,
232242
"type.argument.catch": notApplicable,
233243

234-
// If statement
235-
ifStatement: notApplicable,
236-
"statement.if": notApplicable,
244+
// If statement branches
237245
"branch.if": notApplicable,
238246
"branch.if.elif.else": notApplicable,
239247
"branch.if.else": notApplicable,
240248
"branch.if.iteration": notApplicable,
241-
"condition.if": notApplicable,
242-
"interior.if": notApplicable,
243249

244250
// Switch statement
245251
"statement.switch": notApplicable,
@@ -251,7 +257,7 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = {
251257
"interior.switchCase": notApplicable,
252258
"value.switch": notApplicable,
253259

254-
// Loop
260+
// Loop branches
255261
"branch.loop": notApplicable,
256262
"branch.loop.iteration": notApplicable,
257263

@@ -260,13 +266,6 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = {
260266
"condition.for": notApplicable,
261267
"interior.for": notApplicable,
262268

263-
// For-each loop
264-
"statement.foreach": notApplicable,
265-
"interior.foreach": notApplicable,
266-
"name.foreach": notApplicable,
267-
"type.foreach": notApplicable,
268-
"value.foreach": notApplicable,
269-
270269
// While loop
271270
"statement.while": notApplicable,
272271
"condition.while": notApplicable,
@@ -358,6 +357,7 @@ export const talonScopeSupport: LanguageScopeSupportFacetMap = {
358357
"type.iteration.document": notApplicable,
359358
"functionCall.generic": notApplicable,
360359
"functionCallee.generic": notApplicable,
360+
"type.foreach": notApplicable,
361361

362362
// Type alias
363363
"type.alias": notApplicable,

packages/lib-engine/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
"@cursorless/lib-common": "workspace:*",
2121
"@cursorless/lib-node-common": "workspace:*",
2222
"@cursorless/lib-sentence-parser": "workspace:*",
23-
"@cursorless/talon-tools": "^0.10.2",
23+
"@cursorless/talon-tools": "^0.11.0",
2424
"immer": "^11.1.4",
2525
"immutability-helper": "^3.1.1",
2626
"itertools": "^2.6.0",
2727
"lodash-es": "^4.18.1",
2828
"moo": "^0.5.3",
2929
"nearley": "^2.20.1",
3030
"uuid": "^14.0.0",
31-
"zod": "^4.3.6"
31+
"zod": "^4.4.2"
3232
},
3333
"devDependencies": {
3434
"@types/js-yaml": "^4.0.9",

packages/test-runner/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"tail": "^2.2.6"
3030
},
3131
"devDependencies": {
32-
"@cursorless/tree-sitter-wasms": "^0.8.1",
32+
"@cursorless/tree-sitter-wasms": "^0.9.0",
3333
"@types/cross-spawn": "^6.0.6",
3434
"@types/mocha": "^10.0.10",
3535
"@types/tail": "^2.2.3",

0 commit comments

Comments
 (0)