Skip to content

Community wrapper snippets #1998

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

Merged
merged 23 commits into from
Apr 21, 2024
Merged

Community wrapper snippets #1998

merged 23 commits into from
Apr 21, 2024

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Nov 4, 2023

This is the Cursorless side of the community wrapper snippets

talonhub/community#1315

Checklist

  • [-] I have added tests
  • [-] I have updated the docs and cheatsheet
  • [-] I have not broken the cheatsheet

@AndreasArvidsson AndreasArvidsson changed the title Add the Cursorless side of community wrapper snippets Community wrapper snippets Nov 4, 2023
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.

This looks fine but what happens if they're on old version of community? Need to make sure we degrade gracefully

Also, I believe there's now a spoken form ambiguity with "funk wrap", no?

I wonder if it would be better for talon to just tell Cursorless where the snippets are using the new state.json file and let it parse them itself so it can handle disambiguating 🤔

@AndreasArvidsson
Copy link
Member Author

I think it reasonable to expect people to update community before cursorless. I know of no way of using community lists or captures in cursorless that would not show an error in the log if missing.

The ambiguity would be there if we added the command to community as well. You just cant define the same snippet phrase in both places.

I prefer the rpc solution.

@pokey
Copy link
Member

pokey commented Nov 4, 2023

I think it reasonable to expect people to update community before cursorless. I know of no way of using community lists or captures in cursorless that would not show an error in the log if missing.

I completely disagree. We have gone out of our way to make Cursorless talon files easy to update by supporting extensive customization. It is not uncommon for people to go months without updating community, because the fact that the only way to tweak community oftentimes is to directly change it means that upgrades can be quite painful

We should discuss a way to make Cursorless backwards compatible with community. We've done it before, but I believe that was for a new action, so we could easily wrap it in a try-catch

The ambiguity would be there if we added the command to community as well. You just cant define the same snippet phrase in both places.

Not saying it wouldn't, just pointing it out. Could be surprising if you change your function snippet in community and it doesn't update because Cursorless is preferring the Cursorless one

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Nov 4, 2023

Doesn't that mean that we can never utilize new list or captures from community? I know of no mechanism to solve that.

Yes you can't have the same snippet in both. Personally I have totally disabled cursorless snippets. Getting around this problem might be interesting.

@pokey
Copy link
Member

pokey commented Nov 4, 2023

Doesn't that mean that we can never rely on new list or captures from community? I know of no mechanism to solve that.

We could add a context key that we set from community and then match on that?

Yes you cant have the same snippet in both. Personally I have totally disabled cursorless snippets. Getting around this problem might be interesting.

Yeah would be worth discussing. Esp since we ship with a conflicting snippet 🤔 to discuss Plan to discuss at meet-up

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Nov 4, 2023

We could add a context key that we set from community and then match on that?

Unfortunately results in the same problem. If that tag is missing from community because of an older version then cursorless would error in the log.

Yeah would be worth discussing. Esp since we ship with a conflicting snippet 🤔

Agreed.

@pokey
Copy link
Member

pokey commented Nov 4, 2023

No not a tag a context key. Do those have to be declared?

@AndreasArvidsson
Copy link
Member Author

No not a tag a context key. Do those have to be declared?

Not sure I follow. Do you mean like @mod.scope?

Probably same problem

@pokey
Copy link
Member

pokey commented Nov 4, 2023

Not sure. You don't explicitly declare the key for a scope in the same way as you declare a tag, so it seems possible that it won't throw an exception if undefined.

If that doesn't work, we could possibly make an onready in cursorless talon that tries to call some action (wrapped in a try-catch) to see whether it exists, and if it does, sets a tag

Anyways we can discuss if none of these options make sense to you; there's usually a way to make things work, with enough elbow grease 🙂

@pokey pokey marked this pull request as draft November 6, 2023 14:04
@pokey pokey added the to discuss Plan to discuss at meet-up label Nov 6, 2023
@pokey
Copy link
Member

pokey commented Nov 7, 2023

update from meet-up:

  • asked aegis:

We introduced a new list in community, and would like to rely on the list in cursorless-talon. However, we expect users to upgrade cursorless-talon more frequently than community, and thus can’t assume that they have this list already. How can we leverage this list when it’s present, without things breaking when it isn’t?

@pokey pokey removed the to discuss Plan to discuss at meet-up label Nov 7, 2023
@pokey
Copy link
Member

pokey commented Nov 8, 2023

I wonder if it's worth considering sharing the snippets from Talon to Cursorless via .cursorless/state.json. Then we could eg show them in the VSCode Cursorless side bar, handle scope-specific snippets, use them for fancy Cursorless stuff like #446 etc

@AndreasArvidsson AndreasArvidsson marked this pull request as ready for review November 14, 2023 19:56
@AndreasArvidsson
Copy link
Member Author

@pokey updated

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.

left a couple comments

@AndreasArvidsson AndreasArvidsson added the to discuss Plan to discuss at meet-up label Nov 15, 2023
@pokey pokey removed the to discuss Plan to discuss at meet-up label Nov 16, 2023
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.

made minor fix; otherwise looks good! See comments / fix in talonhub/community#1315 as well

@AndreasArvidsson
Copy link
Member Author

Thanks. Community updated with your suggestion

…ippets' of github.com:cursorless-dev/cursorless into community_wrapper_snippets
@pokey
Copy link
Member

pokey commented Dec 18, 2023

Ok looking good. Is there a way to test this? Ie could we activate the use_community tag for part of our tests?

@AndreasArvidsson
Copy link
Member Author

Probably doable?

@pokey
Copy link
Member

pokey commented Jan 2, 2024

update from meet-up:

  • we do want tests
  • @AndreasArvidsson will keep this for now, but if time doesn't allow, @pokey will steal this PR in a week

@pokey
Copy link
Member

pokey commented Jan 30, 2024

There is a spoken form inconsistency here: in community, the spoken form for snippet insertion is "snip", but the default spoken form for snippet insertion in Cursorless is "snippet". So out of the box, it will be "snip funk", but "snippet funk after air". Not entirely sure how to handle that 🤔

@pokey pokey added the to discuss Plan to discuss at meet-up label Jan 30, 2024
@pokey
Copy link
Member

pokey commented Jan 30, 2024

Ok I added tests, but:

@pokey
Copy link
Member

pokey commented Feb 25, 2024

update from meet-up:

@pokey pokey removed the to discuss Plan to discuss at meet-up label Feb 25, 2024
@pokey pokey enabled auto-merge April 16, 2024 14:07
@brief
Copy link

brief commented Apr 20, 2024

Is this not merging because of the failing test?

@pokey
Copy link
Member

pokey commented Apr 20, 2024

Yeah it got caught in that weird windows CI issue; totally unrelated to this PR. Just updated the branch so it gets the fix. Should pass and merge shortly

@pokey pokey added this pull request to the merge queue Apr 21, 2024
Merged via the queue into main with commit 409b3de Apr 21, 2024
14 checks passed
@pokey pokey deleted the community_wrapper_snippets branch April 21, 2024 19:07
cursorless-bot pushed a commit that referenced this pull request Apr 22, 2024
This is the Cursorless side of the community wrapper snippets


talonhub/community#1315


## 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>
Co-authored-by: Pokey Rule <[email protected]>
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