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

add cursorless.private.logQuickActions internal command #2136

Merged
merged 4 commits into from
Dec 16, 2023

Conversation

pokey
Copy link
Member

@pokey pokey commented Dec 14, 2023

Useful for development as we add new Cursorless actions based on VSCode quick actions. We should prob put this in #1775 once that exists, but until then, seems harmless here

Checklist

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

@pokey pokey marked this pull request as ready for review December 14, 2023 17:06
@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Dec 15, 2023

I don't quite follow the purpose of this. Why not just called the quick fix command and get the ui with available actions instead of printing them in the log? First I was thinking that it was just a simpler way to get the command, but you don't actually print that.

@pokey
Copy link
Member Author

pokey commented Dec 15, 2023

I print the ids and titles in the log. I can then use the id when automatically triggering a quick action. The things in the quick fix popup don't have ids. Unless I'm missing something?

@AndreasArvidsson
Copy link
Member

Is it the kind you are after? Because I got confused that you can actually pass the kind as an argument in.

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Dec 15, 2023

If we print the command instead we could just call that directly and possibly don't have to bother with the quick fix menu?

@pokey
Copy link
Member Author

pokey commented Dec 15, 2023

Is it the kind you are after? Because I got confused that you can actually pass the kind as an argument in.

I don't actually pass that in. It's optional. You can pass that if you want to pass a general kind and see all the specific sub-kinds. But I could prob just drop that arg if it's confusing

@pokey
Copy link
Member Author

pokey commented Dec 15, 2023

If we print the command instead we could just call that directly and possibly don't have to bother with the quick fix menu?

Is there a command? Didn't realise that was returned. I could just print exactly what comes back; I believe the filtering was from when I was trying to show it in a notification in an earlier draft and then just switched to debug console

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Dec 15, 2023

Is it the kind you are after? Because I got confused that you can actually pass the kind as an argument in.

I don't actually pass that in. It's optional. You can pass that if you want to pass a general kind and see all the specific sub-kinds. But I could prob just drop that arg if it's confusing

Got it. Not that obvious that you can pass in a general/prefix. I can a thought that why would you pass the exact kind to then have just that printed back. Maybe the comment can be updated to better reflect this?

If we print the command instead we could just call that directly and possibly don't have to bother with the quick fix menu?

Is there a command? Didn't realise that was returned. I could just print exactly what comes back; I believe the filtering was from when I was trying to show it in a notification in an earlier draft and then just switched to debug console

Yes The code action class has an optional command field. Probably best to just print the entire return value.

I do wonder if we should name this command something else; showQuickActions kinda sounds like it will show the quick pick ui. logQuickActions or something like that would make it more obvious what it's actually doing.

@pokey
Copy link
Member Author

pokey commented Dec 15, 2023

Got it. Not that obvious that you can pass in a general/prefix. I can a thought that why would you pass the exact kind to then have just that printed back. Maybe the comment can be updated to better reflect this?

Done

Yes The code action class has an optional command field. Probably best to just print the entire return value.

I just tried that, and the command field is always either not present, or points to an internal command. For example:

{
  "title": "Extract to inner function in function 'logQuickActions'",
  "kind": {
    "value": "refactor.extract.function"
  },
  "command": {
    "title": "Extract to inner function in function 'logQuickActions'",
    "command": "_typescript.didApplyRefactoring",
    "arguments": [
      {
        "action": "function_scope_0"
      }
    ]
  },
  "isPreferred": false
}

I would be inclined to keep it the way it is, where I retain only the useful information (kind.value, title and isPreferred)

I do wonder if we should name this command something else; showQuickActions kinda sounds like it will show the quick pick ui. logQuickActions or something like that would make it more obvious what it's actually doing.

Done

@pokey pokey changed the title add showQuickActions internal command add cursorless.private.logQuickActions internal command Dec 15, 2023
@pokey pokey enabled auto-merge December 16, 2023 14:34
@pokey pokey added this pull request to the merge queue Dec 16, 2023
Merged via the queue into main with commit 77cc4b2 Dec 16, 2023
13 checks passed
@pokey pokey deleted the pokey/add-showquickactions-internal-command branch December 16, 2023 15:02
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.

2 participants