Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fully compositional modifiers #672

Merged
merged 334 commits into from
Jun 7, 2022

Conversation

pokey
Copy link
Member

@pokey pokey commented May 12, 2022

Fixes #69
Fixes #675
Fixes #625
Fixes #688
Fixes #242
Fixes #693
Fixes #199
Fixes #209
Fixes #697
Fixes #210
Fixes #309
Fixes #681

Started on #202 - Should we close this one and create a new with the additional parts?
Started on #254 - Let's go through the checkboxes there to see what's left after this one merges

  • Support composable modifiers
    take token after line
  • Supports every prefix for all scope types
    take every line
    take every token in funk
  • Supports scope specific delimiters for clone, drink, pour
    drink arg
    clone arg

Note: Although this PR was originally opened by @pokey, about 90% of the work ended up being done by @AndreasArvidsson 😊

Checklist

  • Check DFA on public
  • Remove pre-extension publication provenance files from VSCode ignore
  • Add / ensure there are tests for "drink", "pour", "puff", "float", and "drop" with empty line, empty line with indent, and nonempty line with indent
  • Add test for "float" / "puff" / "drop" when line is at beginning / end of file
  • Figure out "paste to to" (solution?: in csv_overrides.py, if identifier is our paste action, then remove any trailing " to")
  • Support Mocha's --grep feature for running single test. prob use env var for simplicity when using launch.json
  • Add test for "pour" when target is in opposite split
  • Test "float" and "drop" before / after an indented line, ensuring it doesn't add padding
  • Add setSelectionsWithoutFocusingEditor and use it
  • Deduplicate selections in setSelections
  • Add a test for "pour line" when it should indent (eg top of function), after we've fixed behaviour
  • Add tests for "bring state air to after bat" with new newline insertion
  • Fix bug with "drink every arg"
  • "bring air before just bat" inserts a space
  • "drink just bat" inserts a newline
  • I have added tests

AndreasArvidsson and others added 30 commits May 16, 2022 16:37
… github.com:pokey/cursorless-vscode into pokey/issue69-Support-fully-compositional-modifiers
@pokey pokey force-pushed the pokey/issue69-Support-fully-compositional-modifiers branch from dcd3eb3 to 6066ce0 Compare June 6, 2022 19:07
@pokey pokey force-pushed the pokey/issue69-Support-fully-compositional-modifiers branch from 6fdd57d to 6ee45f5 Compare June 6, 2022 20:02
@pokey pokey marked this pull request as ready for review June 6, 2022 20:55
@pokey pokey merged commit 2ee7ca1 into main Jun 7, 2022
@pokey pokey deleted the pokey/issue69-Support-fully-compositional-modifiers branch June 7, 2022 12:58
cursorless-bot pushed a commit that referenced this pull request Jun 7, 2022
* Fixed bug in removal range for range target

* A dead delimiter highlight to range target

* Added token context to all marks

* Added correct token context too regex

* Don't unifi ranges on content only removal

* Update the test

* Added feature to run single recorded test

* Updated tests

* Fallback on token context for containing scope

* Updated target inference

* general refactoring of removable ranges

* Updated unify removal targets

* Fixed that mark bug on set selection

* Fixed is reverse bug on vertical range targets

* Fixed is reverse bug on vertical range targets

* Set empty delimiter on end of and start of positions

* Updated test

* Fixed last tests

* Added description to run single recorded test

* At dead tests for bring before and after file

* Update to removal ranges

* Mark cleanup

* Added interior only and exclude interior as proper modifiers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added support for every line

* Only select lines with content

* Added take every paragraph

* Added every file line and block tests

* Added take every token

* Added every too regex stages

* Cleanup

* Moved example of custom test transformation to docs

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/commandV1.types.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added OO targets

* Fixed merge conflict

* Reversed order of migration modifiers

* Default to array

* Cleaned up inference code

* Added paragraph target

* Better updates of new range

* oo targets past all test

* Added line and paragraph tests

* Highlight update

* Added script to show unused exports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added line 2 unused export

* Default modifiers to empty array

* Don't use hat map

* Modifiers default to undefined

* Fixed is implicit inference

* Removed get tokens function

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/commandV1.types.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update src/core/inferFullTargets.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* General cleanup

* Added notebook cell target

* Support delimiter based edit newline (#684)

* Added delimiter based edit line

* Added support for arbitrary delimiters

* Added tests

* Renamed is above to is before

* Better handling of empty lines

* Cleanup

* Added default delimiters for some common scope types

* Run yarn

* Attempt to fix raw delimiter

* Fixed delimiter

* Revert "Attempt to fix raw delimiter"

This reverts commit 0de0798.

* Revert "Fixed delimiter"

This reverts commit a035390.

* Use low dash unique with

* Made base target abstract

* Updated tests

* Added return type

* Fixed compilation errors

* Updated position

* Add empty string as default delimiter for sub tokens

* Updated bugs

* Cleanup

* Added tests

* Updated inference of implicit target

* Updated spoken forms in test

* Utilize getters

* Refactored getters and setters for targets

* Implemented get final stages

* Added final stages to process targets

* Cleanup

* Converted command action into object with associated arguments

* Switch to complex scope types

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove scope type type from base target

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated to edit new context

* Added bring statement test

* Change behavior of pour line

* Use weak containing line stage for edit new

* Updated edit new

* Get targets in correct order

* Updated selection for editor

* Cleanup

* New attempt at EditNew

* Added rich targets

* Updated edit new with proper line handling

* Only used single edit

* Added comment

* Added comment

* Cleanup

* Added derived target

* Moved weak target into base target class

* Cleanup

* Updated action form

* Updated scope type for tests

* Fix upgrade path with ordinal range

* Pass leading and trailing delimiters to super constructor

* Learn to spell

* Updated more tests

* Cleanup

* Fixed bug taking matching pair in error code

* Added block tests

* Fixed test

* Added support for custom delimiters in copy lines

* Fix package json

* Fix one test

* Updated tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Disabled phrase snapshot on recorded test runner

* Updated test and upgrade path

* Fixed failing hat map tests

* Added sleep option to recorded tests

* Verbosity for the win

* Tweak modify of week stage

* Minor python cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Don't de duplicate that mark

* Use utility function to set selection that deduplicates

* Make document content range the entire file including white lines

* Added source mark to wrap action

* Added source mark to actions wrap and rewrap

* Updated error messages

* Updated tests

* Don't focus editor on notebook cell insertion

* Cleanup

* Don't update selection on notebook cell insertion

* Add comment

* Various fixes

* More renames and stuff

* Fix bug with missing delimiters in weak targets

* Update src/processTargets/processTargets.ts

Co-authored-by: Will Sommers <will.sommers@gmail.com>

* Unify implementation of copy lines and edit new actions

* Rename

* Started working on lazy removal

* Clarify processPrimitiveTarget

* Tweak

* Tweak again

* Imports fix

* All tests pass

* Updated highlights

* Highlight updates on continuous range target

* Moved edit decorations into graph

* Added decorations to test recorder and runner

* Updated to highlight recorder test

* Added decorations test

* Added decorations test

* Added leading and trailing delimiters as separate stage and target

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create edits in actual targets

* Use object oriented targets to construct edits

* Enabled bring before and after without to

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

* Support fully compositional modifiers
Fixes #69

* Getting started

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Start using InsertionRemovalBehavior

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Cleanup

* Tweak

* More cleanup

* More tweaks

* Tweaks

* More cleanup

* Cleanup

* Removed padding from float and drop

* Updated that mark on pour action

* Lots of stuff

* Fixed removal behavior on scope type target

* Hide panel on recorded test sweet startup

* More stuff

* More stuff

* Cleanup

* Some stuff clean up whatever don't care

* Committed some stuff

* Stuff

* Updated tests

* Support chuck after and chuck before

* Add hack for "paste to to"

* Add run single test launch config

* Add comment about running a single test to contributing docs

* Update cursorless-talon/src/csv_overrides.py

* Update cursorless-talon/src/positional_target.py

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update cursorless-talon/src/positional_target.py

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Use plain target in clear action

* Initial modifier unification work

* Unify simple modifiers

* docstring

* Clean up position code

* At a couple comments

* Creates separate file for target descriptor types

* Separate notebook cell edit new from regular edit new

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed that mark on notebook cells

* Cleanup

* More positional tweaks on talon side

* Removes support for chuck after and chuck before

* Clean up names

* Use proper error for syntax scope not found

* Record tests for leading trailing before and after

* Add chuck before after to upgrade

* Failed attempt at trying to simplify edit new

* Revert "Failed attempt at trying to simplify edit new"

This reverts commit 52193ae.

* Cleanup vscode ignore

* Fixed regression in vertical range target (#735)

* Revert generic insert empty lines code

* Add broken float and puff tests

* Add working puff float drop tests

* Switch to mocha grep syntax for running subset of tests

* Make subdir for insert empty lines tests

* Support updating fixture decorations

* Add decorations to float drop puff tests

* Cleanup test case recorder docs

* Add bunch of clone tests

* Move files

* More cleanup

* `PartialTargetDesc` => `PartialTargetDescriptor`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Re-add provenance file

* Comments

* Bump package version

* Attempt to fix docs link

Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Sommers <will.sommers@gmail.com>
@pokey pokey restored the pokey/issue69-Support-fully-compositional-modifiers branch June 7, 2022 15:58
@pokey pokey deleted the pokey/issue69-Support-fully-compositional-modifiers branch July 7, 2022 12:58
thetomcraig-aya pushed a commit to thetomcraig/cursorless that referenced this pull request Mar 27, 2024
* Fixed bug in removal range for range target

* A dead delimiter highlight to range target

* Added token context to all marks

* Added correct token context too regex

* Don't unifi ranges on content only removal

* Update the test

* Added feature to run single recorded test

* Updated tests

* Fallback on token context for containing scope

* Updated target inference

* general refactoring of removable ranges

* Updated unify removal targets

* Fixed that mark bug on set selection

* Fixed is reverse bug on vertical range targets

* Fixed is reverse bug on vertical range targets

* Set empty delimiter on end of and start of positions

* Updated test

* Fixed last tests

* Added description to run single recorded test

* At dead tests for bring before and after file

* Update to removal ranges

* Mark cleanup

* Added interior only and exclude interior as proper modifiers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added support for every line

* Only select lines with content

* Added take every paragraph

* Added every file line and block tests

* Added take every token

* Added every too regex stages

* Cleanup

* Moved example of custom test transformation to docs

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/commandV1.types.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added OO targets

* Fixed merge conflict

* Reversed order of migration modifiers

* Default to array

* Cleaned up inference code

* Added paragraph target

* Better updates of new range

* oo targets past all test

* Added line and paragraph tests

* Highlight update

* Added script to show unused exports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added line 2 unused export

* Default modifiers to empty array

* Don't use hat map

* Modifiers default to undefined

* Fixed is implicit inference

* Removed get tokens function

* Update src/core/commandVersionUpgrades/upgradeV1ToV2/commandV1.types.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update src/core/inferFullTargets.ts

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* General cleanup

* Added notebook cell target

* Support delimiter based edit newline (cursorless-dev#684)

* Added delimiter based edit line

* Added support for arbitrary delimiters

* Added tests

* Renamed is above to is before

* Better handling of empty lines

* Cleanup

* Added default delimiters for some common scope types

* Run yarn

* Attempt to fix raw delimiter

* Fixed delimiter

* Revert "Attempt to fix raw delimiter"

This reverts commit 0de0798.

* Revert "Fixed delimiter"

This reverts commit a035390.

* Use low dash unique with

* Made base target abstract

* Updated tests

* Added return type

* Fixed compilation errors

* Updated position

* Add empty string as default delimiter for sub tokens

* Updated bugs

* Cleanup

* Added tests

* Updated inference of implicit target

* Updated spoken forms in test

* Utilize getters

* Refactored getters and setters for targets

* Implemented get final stages

* Added final stages to process targets

* Cleanup

* Converted command action into object with associated arguments

* Switch to complex scope types

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove scope type type from base target

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated to edit new context

* Added bring statement test

* Change behavior of pour line

* Use weak containing line stage for edit new

* Updated edit new

* Get targets in correct order

* Updated selection for editor

* Cleanup

* New attempt at EditNew

* Added rich targets

* Updated edit new with proper line handling

* Only used single edit

* Added comment

* Added comment

* Cleanup

* Added derived target

* Moved weak target into base target class

* Cleanup

* Updated action form

* Updated scope type for tests

* Fix upgrade path with ordinal range

* Pass leading and trailing delimiters to super constructor

* Learn to spell

* Updated more tests

* Cleanup

* Fixed bug taking matching pair in error code

* Added block tests

* Fixed test

* Added support for custom delimiters in copy lines

* Fix package json

* Fix one test

* Updated tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Disabled phrase snapshot on recorded test runner

* Updated test and upgrade path

* Fixed failing hat map tests

* Added sleep option to recorded tests

* Verbosity for the win

* Tweak modify of week stage

* Minor python cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Don't de duplicate that mark

* Use utility function to set selection that deduplicates

* Make document content range the entire file including white lines

* Added source mark to wrap action

* Added source mark to actions wrap and rewrap

* Updated error messages

* Updated tests

* Don't focus editor on notebook cell insertion

* Cleanup

* Don't update selection on notebook cell insertion

* Add comment

* Various fixes

* More renames and stuff

* Fix bug with missing delimiters in weak targets

* Update src/processTargets/processTargets.ts

Co-authored-by: Will Sommers <will.sommers@gmail.com>

* Unify implementation of copy lines and edit new actions

* Rename

* Started working on lazy removal

* Clarify processPrimitiveTarget

* Tweak

* Tweak again

* Imports fix

* All tests pass

* Updated highlights

* Highlight updates on continuous range target

* Moved edit decorations into graph

* Added decorations to test recorder and runner

* Updated to highlight recorder test

* Added decorations test

* Added decorations test

* Added leading and trailing delimiters as separate stage and target

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create edits in actual targets

* Use object oriented targets to construct edits

* Enabled bring before and after without to

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

* Support fully compositional modifiers
Fixes cursorless-dev#69

* Getting started

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Start using InsertionRemovalBehavior

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Cleanup

* Tweak

* More cleanup

* More tweaks

* Tweaks

* More cleanup

* Cleanup

* Removed padding from float and drop

* Updated that mark on pour action

* Lots of stuff

* Fixed removal behavior on scope type target

* Hide panel on recorded test sweet startup

* More stuff

* More stuff

* Cleanup

* Some stuff clean up whatever don't care

* Committed some stuff

* Stuff

* Updated tests

* Support chuck after and chuck before

* Add hack for "paste to to"

* Add run single test launch config

* Add comment about running a single test to contributing docs

* Update cursorless-talon/src/csv_overrides.py

* Update cursorless-talon/src/positional_target.py

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Update cursorless-talon/src/positional_target.py

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>

* Use plain target in clear action

* Initial modifier unification work

* Unify simple modifiers

* docstring

* Clean up position code

* At a couple comments

* Creates separate file for target descriptor types

* Separate notebook cell edit new from regular edit new

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed that mark on notebook cells

* Cleanup

* More positional tweaks on talon side

* Removes support for chuck after and chuck before

* Clean up names

* Use proper error for syntax scope not found

* Record tests for leading trailing before and after

* Add chuck before after to upgrade

* Failed attempt at trying to simplify edit new

* Revert "Failed attempt at trying to simplify edit new"

This reverts commit 52193ae.

* Cleanup vscode ignore

* Fixed regression in vertical range target (cursorless-dev#735)

* Revert generic insert empty lines code

* Add broken float and puff tests

* Add working puff float drop tests

* Switch to mocha grep syntax for running subset of tests

* Make subdir for insert empty lines tests

* Support updating fixture decorations

* Add decorations to float drop puff tests

* Cleanup test case recorder docs

* Add bunch of clone tests

* Move files

* More cleanup

* `PartialTargetDesc` => `PartialTargetDescriptor`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Re-add provenance file

* Comments

* Bump package version

* Attempt to fix docs link

Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Sommers <will.sommers@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment