From 762f37777dfc9361d64629572ee74ad81e260006 Mon Sep 17 00:00:00 2001 From: Sonny Vesali <79886185+sonnyvesali@users.noreply.github.com> Date: Sat, 9 Nov 2024 10:37:22 -0600 Subject: [PATCH 1/7] add: the start of dart lang support (#2671) Hello, hopefully I did these first steps right and I would like some rough guidance on adding the subsequent things like snippets or any other essentials for dart support, thanks! ## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- data/fixtures/scopes/dart/ifStatement.scope | 19 ++++++++++++++ data/fixtures/scopes/dart/list.scope | 17 +++++++++++++ data/fixtures/scopes/dart/map.scope | 25 +++++++++++++++++++ data/playground/dart.dart | 9 +++++++ .../common/src/scopeSupportFacets/dart.ts | 11 ++++++++ .../languageScopeSupport.ts | 2 ++ .../src/docs/user/languages/dart.mdx | 5 ++++ queries/dart.scm | 18 +++++++++++++ 8 files changed, 106 insertions(+) create mode 100644 data/fixtures/scopes/dart/ifStatement.scope create mode 100644 data/fixtures/scopes/dart/list.scope create mode 100644 data/fixtures/scopes/dart/map.scope create mode 100644 data/playground/dart.dart create mode 100644 packages/common/src/scopeSupportFacets/dart.ts create mode 100644 packages/cursorless-org-docs/src/docs/user/languages/dart.mdx create mode 100644 queries/dart.scm 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/playground/dart.dart b/data/playground/dart.dart new file mode 100644 index 0000000000..93cc1f6a94 --- /dev/null +++ b/data/playground/dart.dart @@ -0,0 +1,9 @@ +foo() { + if (true) {} + + final list = [1, 2, 3]; + + final map = { + 'hi': 1, + }; +} diff --git a/packages/common/src/scopeSupportFacets/dart.ts b/packages/common/src/scopeSupportFacets/dart.ts new file mode 100644 index 0000000000..9ba7239305 --- /dev/null +++ b/packages/common/src/scopeSupportFacets/dart.ts @@ -0,0 +1,11 @@ +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, +}; 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/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/queries/dart.scm b/queries/dart.scm new file mode 100644 index 0000000000..f9d5e26430 --- /dev/null +++ b/queries/dart.scm @@ -0,0 +1,18 @@ + +;;!! if () {} +;;! ^^^^^^^^ +(if_statement) @ifStatement + +;;!! [ 0 ] +;;! ^^^^^ +[ + (list_literal) + (list_pattern) +] @list + +;;!! { value: 0 } +;;! ^^^^^^^^^^^^ +[ + (set_or_map_literal) + (map_pattern) +] @map From effff0d97646df37cd301e2bfab7422b9d9ad531 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 9 Nov 2024 22:08:12 +0100 Subject: [PATCH 2/7] Update head/tail docs with regards to surrounding pairs (#2676) ## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet --------- Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com> --- cursorless-talon/src/cheatsheet/sections/modifiers.py | 4 ++-- .../cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json | 4 ++-- packages/cursorless-org-docs/src/docs/user/README.md | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) 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/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/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 From 2e2a159909eb851a57e9eae8f8ebfd664814aa43 Mon Sep 17 00:00:00 2001 From: Sonny Vesali <79886185+sonnyvesali@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:00:29 -0600 Subject: [PATCH 3/7] add dart class support (#2677) ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet --------- Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com> --- data/fixtures/scopes/dart/class.scope | 15 ++++++++++ data/fixtures/scopes/dart/className.scope | 29 +++++++++++++++++++ data/playground/dart.dart | 15 +++++++++- .../common/src/scopeSupportFacets/dart.ts | 2 ++ queries/dart.scm | 7 ++++- 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 data/fixtures/scopes/dart/class.scope create mode 100644 data/fixtures/scopes/dart/className.scope 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/playground/dart.dart b/data/playground/dart.dart index 93cc1f6a94..d62599aff9 100644 --- a/data/playground/dart.dart +++ b/data/playground/dart.dart @@ -1,5 +1,14 @@ foo() { - if (true) {} + final hi = ''; + if (hi.isNotEmpty) { + + // + } + + + else if (true) { + // + } final list = [1, 2, 3]; @@ -7,3 +16,7 @@ foo() { 'hi': 1, }; } + +class Something{ + +} \ No newline at end of file diff --git a/packages/common/src/scopeSupportFacets/dart.ts b/packages/common/src/scopeSupportFacets/dart.ts index 9ba7239305..aeb0a213af 100644 --- a/packages/common/src/scopeSupportFacets/dart.ts +++ b/packages/common/src/scopeSupportFacets/dart.ts @@ -8,4 +8,6 @@ export const dartScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, list: supported, map: supported, + class: supported, + className: supported, }; diff --git a/queries/dart.scm b/queries/dart.scm index f9d5e26430..26a6c331b0 100644 --- a/queries/dart.scm +++ b/queries/dart.scm @@ -1,4 +1,3 @@ - ;;!! if () {} ;;! ^^^^^^^^ (if_statement) @ifStatement @@ -16,3 +15,9 @@ (set_or_map_literal) (map_pattern) ] @map + +;;!! class Foo {} +;;! ^^^^^^^^^^^^ +(class_definition + name: (_) @className +) @class @className.domain From 44f74cd74c56dcc5e0b03054e4902f2feefd9d40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 15:21:32 +0100 Subject: [PATCH 4/7] Bump @eslint/plugin-kit from 0.2.0 to 0.2.3 (#2680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [@eslint/plugin-kit](https://github.com/eslint/rewrite) from 0.2.0 to 0.2.3.
Release notes

Sourced from @​eslint/plugin-kit's releases.

plugin-kit: v0.2.3

0.2.3 (2024-11-14)

Dependencies

  • The following workspace dependencies were updated
    • devDependencies
      • @​eslint/core bumped from ^0.8.0 to ^0.9.0

plugin-kit: v0.2.2

0.2.2 (2024-10-25)

Dependencies

  • The following workspace dependencies were updated
    • devDependencies
      • @​eslint/core bumped from ^0.7.0 to ^0.8.0

plugin-kit: v0.2.1

0.2.1 (2024-10-18)

Dependencies

  • The following workspace dependencies were updated
    • devDependencies
      • @​eslint/core bumped from ^0.6.0 to ^0.7.0
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@eslint/plugin-kit&package-manager=npm_and_yarn&previous-version=0.2.0&new-version=0.2.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/cursorless-dev/cursorless/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77e82a0fed..bc65075388 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) @@ -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': @@ -11891,7 +11891,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 @@ -15433,7 +15433,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 +15462,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 +15486,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 +15497,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 @@ -15673,7 +15673,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 From ca313350c8d81a9edc1a9e76cff0fa4eaf9e6819 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:44:11 +0000 Subject: [PATCH 5/7] Bump cross-spawn from 7.0.3 to 7.0.5 (#2682) Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.5.
Changelog

Sourced from cross-spawn's changelog.

7.0.5 (2024-11-07)

Bug Fixes

  • fix escaping bug introduced by backtracking (640d391)

7.0.4 (2024-11-07)

Bug Fixes

Commits
  • 0852683 chore(release): 7.0.5
  • 640d391 fix: fix escaping bug introduced by backtracking
  • bff0c87 chore: remove codecov
  • a7c6abc chore: replace travis with github workflows
  • 9b9246e chore(release): 7.0.4
  • 5ff3a07 fix: disable regexp backtracking (#160)
  • 9521e2d chore: fix tests in recent node js versions
  • 97ded39 chore: convert package lock
  • d52b6b9 chore: remove unused argument (#156)
  • 5d84384 chore: add travis jobs on ppc64le (#142)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cross-spawn&package-manager=npm_and_yarn&previous-version=7.0.3&new-version=7.0.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/cursorless-dev/cursorless/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/common/package.json | 2 +- packages/test-harness/package.json | 2 +- pnpm-lock.yaml | 28 +++++++++++++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) 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/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 bc65075388..fdba3933e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 @@ -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'} @@ -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: @@ -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 @@ -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 From d6cc6f924e29c9f0a2307fbd87aa3db546b237d9 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 16 Nov 2024 16:08:47 +0100 Subject: [PATCH 6/7] Proper handing of raw strings in rust (#2681) Fixes #2678 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --- .../scopes/rust/string.singleLine.scope | 30 +++++++++++++++++++ .../rust/textFragment.string.singleLine.scope | 30 +++++++++++++++++++ .../common/src/scopeSupportFacets/rust.ts | 2 ++ queries/rust.scm | 13 +++++--- 4 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 data/fixtures/scopes/rust/string.singleLine.scope create mode 100644 data/fixtures/scopes/rust/textFragment.string.singleLine.scope 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/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/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) From 8cf3464c189808a2ee6e37e2f8566e233ac522fe Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Mon, 18 Nov 2024 08:35:08 +0100 Subject: [PATCH 7/7] Add item scope to JS (#2675) ```js const value = [1, 2]; ``` This example is problematic. Currently we test the language specific implementation before the text based one. This means that if your cursor is inside the curly brackets `item` is `value = [1, 2]`. I don't think this can be solved until we have a better `oneOf` implementation of collection item. Same problem with Java https://github.com/cursorless-dev/cursorless/pull/2674 To fix that above I made a change so that the text based item can be used even if there is a syntax tree one available if it's smaller. This needs to merge before the java pr. ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --- .../languages/typescript/takeItem.yml | 4 +-- .../collectionItem.unenclosed.scope | 33 +++++++++++++++++++ .../src/scopeSupportFacets/javascript.ts | 2 ++ .../modifiers/ContainingScopeStage.ts | 30 +++++++++++++---- queries/javascript.core.scm | 13 ++++++++ 5 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 data/fixtures/scopes/javascript.core/collectionItem.unenclosed.scope 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/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/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/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/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: