diff --git a/cursorless-talon/src/cheatsheet/sections/modifiers.py b/cursorless-talon/src/cheatsheet/sections/modifiers.py index af8164d312..406e3acbbc 100644 --- a/cursorless-talon/src/cheatsheet/sections/modifiers.py +++ b/cursorless-talon/src/cheatsheet/sections/modifiers.py @@ -64,7 +64,7 @@ def get_modifiers(): "variations": [ { "spokenForm": complex_modifiers["extendThroughStartOf"], - "description": "Extend through start of line", + "description": "Extend through start of line/pair", }, { "spokenForm": f"{complex_modifiers['extendThroughStartOf']} ", @@ -78,7 +78,7 @@ def get_modifiers(): "variations": [ { "spokenForm": complex_modifiers["extendThroughEndOf"], - "description": "Extend through end of line", + "description": "Extend through end of line/pair", }, { "spokenForm": f"{complex_modifiers['extendThroughEndOf']} ", diff --git a/data/fixtures/recorded/languages/typescript/takeItem.yml b/data/fixtures/recorded/languages/typescript/takeItem.yml index 09f6fd5472..d9e43a6ab2 100644 --- a/data/fixtures/recorded/languages/typescript/takeItem.yml +++ b/data/fixtures/recorded/languages/typescript/takeItem.yml @@ -23,5 +23,5 @@ finalState: const value = { a: 1, b: 2, c: 3 }; selections: - - anchor: {line: 1, character: 0} - active: {line: 1, character: 35} + - anchor: {line: 1, character: 6} + active: {line: 1, character: 34} diff --git a/data/fixtures/scopes/dart/class.scope b/data/fixtures/scopes/dart/class.scope new file mode 100644 index 0000000000..9b0eef7978 --- /dev/null +++ b/data/fixtures/scopes/dart/class.scope @@ -0,0 +1,15 @@ +class MyClass { + +} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| +2| } + -< + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/dart/className.scope b/data/fixtures/scopes/dart/className.scope new file mode 100644 index 0000000000..587c9e2102 --- /dev/null +++ b/data/fixtures/scopes/dart/className.scope @@ -0,0 +1,29 @@ +class MyClass { + +} +--- + +[Content] = 0:6-0:13 + >-------< +0| class MyClass { + +[Removal] = 0:6-0:14 + >--------< +0| class MyClass { + +[Leading delimiter] = 0:5-0:6 + >-< +0| class MyClass { + +[Trailing delimiter] = 0:13-0:14 + >-< +0| class MyClass { + +[Domain] = 0:0-2:1 + >--------------- +0| class MyClass { +1| +2| } + -< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/dart/ifStatement.scope b/data/fixtures/scopes/dart/ifStatement.scope new file mode 100644 index 0000000000..09ee23aab9 --- /dev/null +++ b/data/fixtures/scopes/dart/ifStatement.scope @@ -0,0 +1,19 @@ +foo() { + if (true) { } +} +--- + +[Content] = +[Domain] = 1:2-1:15 + >-------------< +1| if (true) { } + +[Removal] = 1:0-1:15 + >---------------< +1| if (true) { } + +[Leading delimiter] = 1:0-1:2 + >--< +1| if (true) { } + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/dart/list.scope b/data/fixtures/scopes/dart/list.scope new file mode 100644 index 0000000000..169cc3d024 --- /dev/null +++ b/data/fixtures/scopes/dart/list.scope @@ -0,0 +1,17 @@ +final list = [1,2,3]; +--- + +[Content] = +[Domain] = 0:13-0:20 + >-------< +0| final list = [1,2,3]; + +[Removal] = 0:12-0:20 + >--------< +0| final list = [1,2,3]; + +[Leading delimiter] = 0:12-0:13 + >-< +0| final list = [1,2,3]; + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/dart/map.scope b/data/fixtures/scopes/dart/map.scope new file mode 100644 index 0000000000..bc293e112f --- /dev/null +++ b/data/fixtures/scopes/dart/map.scope @@ -0,0 +1,25 @@ + final map = { + 'hi': 1, + }; +--- + +[Content] = +[Domain] = 0:14-2:3 + >- +0| final map = { +1| 'hi': 1, +2| }; + ---< + +[Removal] = 0:13-2:3 + >-- +0| final map = { +1| 'hi': 1, +2| }; + ---< + +[Leading delimiter] = 0:13-0:14 + >-< +0| final map = { + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.scope b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.scope new file mode 100644 index 0000000000..703a4b32bb --- /dev/null +++ b/data/fixtures/scopes/javascript.core/collectionItem.unenclosed.scope @@ -0,0 +1,33 @@ +let foo, bar; +--- + +[#1 Content] = +[#1 Domain] = 0:4-0:7 + >---< +0| let foo, bar; + +[#1 Removal] = 0:4-0:9 + >-----< +0| let foo, bar; + +[#1 Trailing delimiter] = 0:7-0:9 + >--< +0| let foo, bar; + +[#1 Insertion delimiter] = ", " + + +[#2 Content] = +[#2 Domain] = 0:9-0:12 + >---< +0| let foo, bar; + +[#2 Removal] = 0:7-0:12 + >-----< +0| let foo, bar; + +[#2 Leading delimiter] = 0:7-0:9 + >--< +0| let foo, bar; + +[#2 Insertion delimiter] = ", " diff --git a/data/fixtures/scopes/rust/string.singleLine.scope b/data/fixtures/scopes/rust/string.singleLine.scope new file mode 100644 index 0000000000..68b4966a86 --- /dev/null +++ b/data/fixtures/scopes/rust/string.singleLine.scope @@ -0,0 +1,30 @@ +"aaa" +r#"bbb"# +r##"ccc"## +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-0:5 + >-----< +0| "aaa" + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:0-1:8 + >--------< +1| r#"bbb"# + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:0-2:10 + >----------< +2| r##"ccc"## + +[#3 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/rust/textFragment.string.singleLine.scope b/data/fixtures/scopes/rust/textFragment.string.singleLine.scope new file mode 100644 index 0000000000..9d115cbc7b --- /dev/null +++ b/data/fixtures/scopes/rust/textFragment.string.singleLine.scope @@ -0,0 +1,30 @@ +"aaa" +r#"bbb"# +r##"ccc"## +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:1-0:4 + >---< +0| "aaa" + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Removal] = +[#2 Domain] = 1:3-1:6 + >---< +1| r#"bbb"# + +[#2 Insertion delimiter] = " " + + +[#3 Content] = +[#3 Removal] = +[#3 Domain] = 2:4-2:7 + >---< +2| r##"ccc"## + +[#3 Insertion delimiter] = " " diff --git a/data/playground/dart.dart b/data/playground/dart.dart new file mode 100644 index 0000000000..d62599aff9 --- /dev/null +++ b/data/playground/dart.dart @@ -0,0 +1,22 @@ +foo() { + final hi = ''; + if (hi.isNotEmpty) { + + // + } + + + else if (true) { + // + } + + final list = [1, 2, 3]; + + final map = { + 'hi': 1, + }; +} + +class Something{ + +} \ No newline at end of file diff --git a/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json b/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json index bbce939c6f..28e3ea93b1 100644 --- a/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json +++ b/packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json @@ -796,7 +796,7 @@ "variations": [ { "spokenForm": "tail", - "description": "Extend through end of line" + "description": "Extend through end of line/pair" }, { "spokenForm": "tail ", @@ -810,7 +810,7 @@ "variations": [ { "spokenForm": "head", - "description": "Extend through start of line" + "description": "Extend through start of line/pair" }, { "spokenForm": "head ", diff --git a/packages/common/package.json b/packages/common/package.json index 5803375623..a072e9f09d 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -23,7 +23,7 @@ "@types/js-yaml": "^4.0.9", "@types/lodash-es": "4.17.12", "@types/mocha": "^10.0.9", - "cross-spawn": "7.0.3", + "cross-spawn": "7.0.5", "fast-check": "3.22.0", "js-yaml": "^4.1.0", "mocha": "^10.7.3" diff --git a/packages/common/src/scopeSupportFacets/dart.ts b/packages/common/src/scopeSupportFacets/dart.ts new file mode 100644 index 0000000000..aeb0a213af --- /dev/null +++ b/packages/common/src/scopeSupportFacets/dart.ts @@ -0,0 +1,13 @@ +import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; +import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; + +export const dartScopeSupport: LanguageScopeSupportFacetMap = { + ifStatement: supported, + list: supported, + map: supported, + class: supported, + className: supported, +}; diff --git a/packages/common/src/scopeSupportFacets/javascript.ts b/packages/common/src/scopeSupportFacets/javascript.ts index 232650fd0d..0b44f2c6c3 100644 --- a/packages/common/src/scopeSupportFacets/javascript.ts +++ b/packages/common/src/scopeSupportFacets/javascript.ts @@ -112,6 +112,8 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = { "value.return": supported, "value.return.lambda": supported, "value.field": supported, + + "collectionItem.unenclosed": supported, }; export const javascriptJsxScopeSupport: LanguageScopeSupportFacetMap = { diff --git a/packages/common/src/scopeSupportFacets/languageScopeSupport.ts b/packages/common/src/scopeSupportFacets/languageScopeSupport.ts index 8e9d706b59..2c05c76c6b 100644 --- a/packages/common/src/scopeSupportFacets/languageScopeSupport.ts +++ b/packages/common/src/scopeSupportFacets/languageScopeSupport.ts @@ -4,6 +4,7 @@ import { clojureScopeSupport } from "./clojure"; import { cppScopeSupport } from "./cpp"; import { csharpScopeSupport } from "./csharp"; import { cssScopeSupport } from "./css"; +import { dartScopeSupport } from "./dart"; import { goScopeSupport } from "./go"; import { htmlScopeSupport } from "./html"; import { javaScopeSupport } from "./java"; @@ -35,6 +36,7 @@ export const languageScopeSupport: StringRecord = cpp: cppScopeSupport, csharp: csharpScopeSupport, css: cssScopeSupport, + dart: dartScopeSupport, go: goScopeSupport, html: htmlScopeSupport, java: javaScopeSupport, diff --git a/packages/common/src/scopeSupportFacets/rust.ts b/packages/common/src/scopeSupportFacets/rust.ts index 125b6a5dd6..c8e7f844a8 100644 --- a/packages/common/src/scopeSupportFacets/rust.ts +++ b/packages/common/src/scopeSupportFacets/rust.ts @@ -7,4 +7,6 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; export const rustScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, disqualifyDelimiter: supported, + "string.singleLine": supported, + "textFragment.string.singleLine": supported, }; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts index 41e12f4efe..6b22f1c783 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts @@ -45,23 +45,39 @@ export class ContainingScopeStage implements ModifierStage { .run(target); } - const containingScope = getContainingScopeTarget( + const containingScopes = getContainingScopeTarget( target, scopeHandler, ancestorIndex, ); - - if (containingScope == null) { - if (scopeType.type === "collectionItem") { - // For `collectionItem`, fall back to generic implementation - return this.modifierStageFactory + if (scopeType.type === "collectionItem") { + // For `collectionItem`, combine with generic implementation + try { + const legacyScopes = this.modifierStageFactory .getLegacyScopeStage(this.modifier) .run(target); + if (containingScopes == null) { + return legacyScopes; + } + if (containingScopes.length === 1 && legacyScopes.length === 1) { + const containingRange = containingScopes[0].contentRange; + const legacyRange = legacyScopes[0].contentRange; + if ( + containingRange.contains(legacyRange) && + !containingRange.isRangeEqual(legacyRange) + ) { + return legacyScopes; + } + } + } catch (_ex) { + // Do nothing } + } + if (containingScopes == null) { throw new NoContainingScopeError(this.modifier.scopeType.type); } - return containingScope; + return containingScopes; } } diff --git a/packages/cursorless-org-docs/src/docs/user/README.md b/packages/cursorless-org-docs/src/docs/user/README.md index f956d0722e..fbf667ee25 100644 --- a/packages/cursorless-org-docs/src/docs/user/README.md +++ b/packages/cursorless-org-docs/src/docs/user/README.md @@ -310,6 +310,8 @@ The modifiers `"head"` and `"tail"` can be used to expand a target through the b - `"take head air"`: selects the mark through to start of the line - `"take tail air"`: selects the mark through to the end of the line +When inside a single-line surrounding pair (eg parentheses, brackets, etc) the head/tail modifier will only expand to the interior of that pair instead of the whole line. You can explicitly say `"head line"` or `"tail line"` to get the line behavior. + When followed by a modifier, they will expand their input to the start or end of the given modifier range. For example: - `"take head funk"`: select from the cursor the start of the containing function diff --git a/packages/cursorless-org-docs/src/docs/user/languages/dart.mdx b/packages/cursorless-org-docs/src/docs/user/languages/dart.mdx new file mode 100644 index 0000000000..fe37a25c4f --- /dev/null +++ b/packages/cursorless-org-docs/src/docs/user/languages/dart.mdx @@ -0,0 +1,5 @@ +import Language from "./Language"; + +# dart + + diff --git a/packages/test-harness/package.json b/packages/test-harness/package.json index 462f482af5..2e403f2111 100644 --- a/packages/test-harness/package.json +++ b/packages/test-harness/package.json @@ -40,7 +40,7 @@ "@types/mocha": "^10.0.9", "@types/tail": "2.2.3", "@vscode/test-electron": "^2.4.1", - "cross-spawn": "7.0.3", + "cross-spawn": "7.0.5", "mocha": "^10.7.3" }, "types": "./out/runners/extensionTestsNeovim.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77e82a0fed..fdba3933e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,7 +45,7 @@ importers: version: 3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-import: specifier: 2.31.0 - version: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + version: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) eslint-plugin-mocha: specifier: 10.5.0 version: 10.5.0(eslint@8.57.1) @@ -224,8 +224,8 @@ importers: specifier: ^10.0.9 version: 10.0.9 cross-spawn: - specifier: 7.0.3 - version: 7.0.3 + specifier: 7.0.5 + version: 7.0.5 fast-check: specifier: 3.22.0 version: 3.22.0 @@ -951,8 +951,8 @@ importers: specifier: ^2.4.1 version: 2.4.1 cross-spawn: - specifier: 7.0.3 - version: 7.0.3 + specifier: 7.0.5 + version: 7.0.5 mocha: specifier: ^10.7.3 version: 10.7.3 @@ -2093,8 +2093,8 @@ packages: resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/plugin-kit@0.2.0': - resolution: {integrity: sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==} + '@eslint/plugin-kit@0.2.3': + resolution: {integrity: sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@fortawesome/fontawesome-common-types@6.6.0': @@ -4369,6 +4369,10 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} + cross-spawn@7.0.5: + resolution: {integrity: sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==} + engines: {node: '>= 8'} + crypto-random-string@2.0.0: resolution: {integrity: sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==} engines: {node: '>=8'} @@ -11891,7 +11895,7 @@ snapshots: '@eslint/object-schema@2.1.4': optional: true - '@eslint/plugin-kit@0.2.0': + '@eslint/plugin-kit@0.2.3': dependencies: levn: 0.4.1 optional: true @@ -14767,6 +14771,12 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + cross-spawn@7.0.5: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + crypto-random-string@2.0.0: {} crypto-random-string@4.0.0: @@ -15433,7 +15443,7 @@ snapshots: eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1))(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.1) eslint-plugin-react: 7.37.1(eslint@8.57.1) eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.57.1) @@ -15462,20 +15472,20 @@ snapshots: debug: 4.3.7(supports-color@8.1.1) enhanced-resolve: 5.17.1 eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -15486,7 +15496,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -15497,7 +15507,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.9.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -15634,7 +15644,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.5 debug: 4.3.7(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -15673,7 +15683,7 @@ snapshots: '@eslint/core': 0.6.0 '@eslint/eslintrc': 3.1.0 '@eslint/js': 9.12.0 - '@eslint/plugin-kit': 0.2.0 + '@eslint/plugin-kit': 0.2.3 '@humanfs/node': 0.16.5 '@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/retry': 0.3.1 @@ -15681,7 +15691,7 @@ snapshots: '@types/json-schema': 7.0.15 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.5 debug: 4.3.7(supports-color@8.1.1) escape-string-regexp: 4.0.0 eslint-scope: 8.1.0 @@ -15786,7 +15796,7 @@ snapshots: execa@5.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.5 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -16016,7 +16026,7 @@ snapshots: foreground-child@3.3.0: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.5 signal-exit: 4.1.0 fork-ts-checker-webpack-plugin@6.5.3(eslint@9.12.0(jiti@1.21.6))(typescript@5.6.3)(webpack@5.95.0(esbuild@0.24.0)): @@ -19652,7 +19662,7 @@ snapshots: address: 1.2.2 browserslist: 4.24.0 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.5 detect-port-alt: 1.1.6 escape-string-regexp: 4.0.0 filesize: 8.0.7 diff --git a/queries/dart.scm b/queries/dart.scm new file mode 100644 index 0000000000..26a6c331b0 --- /dev/null +++ b/queries/dart.scm @@ -0,0 +1,23 @@ +;;!! if () {} +;;! ^^^^^^^^ +(if_statement) @ifStatement + +;;!! [ 0 ] +;;! ^^^^^ +[ + (list_literal) + (list_pattern) +] @list + +;;!! { value: 0 } +;;! ^^^^^^^^^^^^ +[ + (set_or_map_literal) + (map_pattern) +] @map + +;;!! class Foo {} +;;! ^^^^^^^^^^^^ +(class_definition + name: (_) @className +) @class @className.domain diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 41ac239df0..24d55cbee1 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -272,6 +272,19 @@ (#has-multiple-children-of-type? @_dummy variable_declarator) ) +;;!! let foo, bar; +;;! ^^^ ^^^ +( + (lexical_declaration + (variable_declarator)? @_.leading.endOf + . + (variable_declarator) @collectionItem + . + (variable_declarator)? @_.trailing.startOf + ) + (#insertion-delimiter! @collectionItem ", ") +) + (expression_statement [ ;; name: diff --git a/queries/rust.scm b/queries/rust.scm index a49b0aba0f..22dfafefce 100644 --- a/queries/rust.scm +++ b/queries/rust.scm @@ -5,14 +5,19 @@ (if_let_expression) ] @ifStatement +;;!! "hello" ( - [ - (raw_string_literal) - (string_literal) - ] @string @textFragment + (string_literal) @string @textFragment (#child-range! @textFragment 0 -1 true true) ) +;;!! r#"foobar"# +( + (raw_string_literal) @string @textFragment + (#shrink-to-match! @textFragment "r#+\"(?.*)\"#+") + +) + [ (line_comment) (block_comment)