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

Fallback to Talon actions when focus is not on the text editor #2235

Merged
merged 36 commits into from
Mar 19, 2024
Merged

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Feb 10, 2024

Edit operations supported by community will now work in vscode outside of the text editor. eg the search widget
take line
chuck token

Everything appears to be working when I have tested it. With that said I have not tested on community and we should probably have a discussion about some of the finer details of this.

Checklist

@AndreasArvidsson AndreasArvidsson added the to discuss Plan to discuss at meet-up label Feb 10, 2024
@pokey
Copy link
Member

pokey commented Feb 11, 2024

notes from meet-up:

  • Add tests by adding field called fallback to recorded test case fixture
  • Return untouched modifier list from extension rather than creating a whole new modifier representation. Some tweaking might be necessary to handle things like implicit destination and auto-token expansion
  • Add modifier called eg expandToTokenIfEmpty
  • Return actions from createCommandRunner so that we can call getText action directly instead of running it as a command

@AndreasArvidsson
Copy link
Member Author

* [ ]  Return `actions` from `createCommandRunner` so that we can call `getText` action directly instead of running it as a command

I bailed on this. We don't even have the complete target, just a partial one. Since we're not inside the pipeline yet using the api probably is the sensible thing. I did switch to a fixed version numbers we don't have to keep updating this for every new api version.

@AndreasArvidsson
Copy link
Member Author

@pokey Recording test was unfortunately not as easy as we assumed. We never actually run the command runner when we do a fallback. ergo the test case recorder is never called.

if (fallback != null) {
return { fallback };
}
}
const returnValue = await commandRunner.run(commandComplete);

@AndreasArvidsson
Copy link
Member Author

so we'll just delete nextHomophone

done

@AndreasArvidsson
Copy link
Member Author

@pokey to do some timestamps to see what's causing slowness on his computer

I haven't noticed any problems

@pokey pokey removed the to discuss Plan to discuss at meet-up label Feb 25, 2024
@saidelike
Copy link
Collaborator

@pokey to do some timestamps to see what's causing slowness on his computer

I haven't noticed any problems

I haven't noticed any problem either fwiw

@saidelike
Copy link
Collaborator

Not sure if you want to include it in this PR but I added support for

@AndreasArvidsson
Copy link
Member Author

this is already supported

def containing_token_if_empty():

@AndreasArvidsson
Copy link
Member Author

pre and post fallback actions added

@pokey
Copy link
Member

pokey commented Mar 19, 2024

Ok I did some profiling, and it's actually my select_word that's slow. Prob has to do with my character dance

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@pokey pokey added this pull request to the merge queue Mar 19, 2024
@pokey pokey removed this pull request from the merge queue due to a manual request Mar 19, 2024
@pokey pokey enabled auto-merge March 19, 2024 15:20
@pokey pokey added this pull request to the merge queue Mar 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 19, 2024
@pokey pokey added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 1c18476 Mar 19, 2024
14 checks passed
@pokey pokey deleted the fallback branch March 19, 2024 16:37
cursorless-bot pushed a commit that referenced this pull request Mar 19, 2024
Edit operations supported by community will now work in vscode outside
of the text editor. eg the search widget
`take line`
`chuck token`

Everything appears to be working when I have tested it. With that said I
have not tested on community and we should probably have a discussion
about some of the finer details of this.


## 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)
- [x] I have not broken the cheatsheet

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Pokey Rule <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Apr 21, 2024
pokey added a commit that referenced this pull request Apr 26, 2024
This was not caught by our tests because we mock away command server. Not sure how to prevent this sort of thing in the future
pokey added a commit that referenced this pull request Apr 26, 2024
This was not caught by our tests because we mock away command server. Not sure how to prevent this sort of thing in the future
pokey added a commit that referenced this pull request Apr 26, 2024
This was not caught by our tests because we mock away command server. Not sure how to prevent this sort of thing in the future
pokey added a commit that referenced this pull request Apr 26, 2024
This was not caught by our tests because we mock away command server. Not sure how to prevent this sort of thing in the future
github-merge-queue bot pushed a commit that referenced this pull request Apr 28, 2024
This was not caught by our tests because we mock away command server.
Not sure how catch this sort of thing in our tests; it's one of the
hazards of mocking

This PR introduces a more robust approach, where `undefined` means that
we don't know which element is focused, either because there is no
command server, or we have not been called by the command server

- See also cursorless-dev/command-server#25

## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants