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

VSCode - missing ide.talon functionality + re-evaluate #165

Closed
knausj85 opened this issue Jul 2, 2020 · 8 comments
Closed

VSCode - missing ide.talon functionality + re-evaluate #165

knausj85 opened this issue Jul 2, 2020 · 8 comments

Comments

@knausj85
Copy link
Member

knausj85 commented Jul 2, 2020

The following are not yet implemented for VSCode.

  1. Evaluate whether ide.py/ide.talon experiment still make sense. It did help jumpstart the implementation of VSCode, at least.
ide_perfect
ide_toggle_tools

#only some of these have an analog in vscode
ide_extract_variable
ide_extract_field
ide_extract_constant
ide_extract_parameter
ide_extract_interface
ide_extract_method
ide_refactor_move

ide_fix_imports
ide_go_implementation
ide_go_usage
ide_go_type
ide_go_test
ide_find_class
ide_find_in_path
ide_create_template
ide_run_menu
ide_run_again

#requires a macro plugin of some sort
ide_toggle_recording
ide_change_recording
ide_play_recording

#not a thing
ide_go_next_method
ide_go_last_method

#requires a plugin of some sort
ide_clippings

ide_copy_reference
ide_copy_pretty

#require a plugin of some sort
ide_go_task
ide_go_browser_task
ide_switch_task
ide_clear_task

ide_configure_servers

#maybe git should be broken out elsewhere
ide_git_pull
ide_git_commit
ide_git_push
ide_git_log
ide_git_browse
ide_git_get
ide_git_pull_request
ide_git_list_requests
ide_git_annotate
ide_git_menu

ide_toggle_events

ide_toggle_structure
ide_toggle_database
ide_toggle_database_changes
ide_toggle_make

ide_toggle_to_do

#docker would be a plugin
ide_toggle_docker

ide_toggle_favorites
ide_toggle_last

ide_toggle_pinned
ide_toggle_docked

ide_toggle_floating
ide_toggle_windowed
ide_toggle_split

#most of these have analogs
ide_toggle_tool_buttons
ide_toggle_toolbar
ide_toggle_navigation_bar
ide_toggle_power_save
ide_toggle_lone_numbers
ide_toggle_gutter_icons
ide_toggle_parameters

ide_change_scheme
ide_toggle_documentation
ide_toggle_definition
ide_pop_type
ide_pop_parameters

ide_go_breakpoints

ide_toggle_method_breakpoint

ide_run_test
ide_run_test_again
ide_debug_test

ide_step_smart
ide_step_to_line
ide_continue

#these aren't a thing for VSCode
ide_resize_window_right
ide_resize_window_left
ide_resize_window_up
ide_resize_window_down
@brxck
Copy link
Contributor

brxck commented Jul 11, 2020

Some outside perspective: for me, ide.talon has made learning the vscode commands much more difficult to learn. You have to learn the ide.talon commands and how the actions actually map to vscode functions, which isn't always obvious.

@knausj85
Copy link
Member Author

knausj85 commented Jul 12, 2020

@brxck Thanks. Was your issue more the use of actions, rather than e.g. shortcuts directly for commands?

e.g.,

action(user.ide_replace_confirm_all):
  # ,editor.action.replaceAll
  key(cmd-enter)

...

confirm that: user.ide_replace_confirm_all()

vs

confirm that: key(cmd-enter)

I’m not sure this change would help with this too much. (Some of the action names will be renamed/relocated either way).

We’ve got three options for cross-platform support at the moment:

  1. implement the actions entirely in .py, separate .talon for the grammar
  2. implement the actions in separate .talon files, separate .talon for the grammar
  3. Maintain the same grammar in each platform-specific .talon file

#3 reduces the obfuscation, but is a bit klunky. #2 was the recommendation early on, so here we are. 😱

Thoughts?

@brxck
Copy link
Contributor

brxck commented Jul 12, 2020

To put it simply, it's harder to learn when the command and the result aren't colocated. Of course that's not really easily remedied if you want to implement an abstract set of commands... I wonder if the help module could do that sort of thing eventually? Display what the action maps to in the current context, ex:

refactor: user.ide_refactor()

could become

refactor: key(ctrl-shift-r)

I think that would solve the problem I bring up here entirely.


As far as cross-platform support goes: I started working on this for myself today, I wonder what you think of it?

I'm mapping to the command ids and activating them using the command palette, which has a couple benefits:

  • This should be entirely across platform
  • Will play nice no matter the keyboard mapping
  • Allows using commands which aren't mapped to keyboard shortcuts
  • Has the added benefit of making the command results really explicit, if you don't have all of VSCode's chorded keyboard shortcuts memorized

By inserting text with the clipboard, it functions just as quickly as the keyboard shortcuts. In my experience, the command palette is never even visible. The only problem I've run into is with contextual commands. If you try to use one outside of its context it will stick in the command palette which reads "No available commands." Doesn't happen often, but not ideal.

@knausj85
Copy link
Member Author

I'll poke around on the help suggestion, I think that's a great idea.

Re: your vscode re-write

Yeah, I've been using the command palette for more stuff recently, so I agree that's likely a better way to go wherever possible.

(So much is common between the IDEs that I don't want to give up on ide.talon just yet, but I'm close)

@knausj85
Copy link
Member Author

knausj85 commented Jul 14, 2020

@brxck I'm liking your approach more.

I think some combo of
(1) modularizing ide.talon, and moving to ide-specific files for things outside the new modules.
(2) your version of VSCode support

is likely the best approach.

For (1), I've done this:

The last pieces I'm thinking about are:

  • git (maybe some common grammar between ide & commandline is feasible?)
  • debug/breakpoint stuff.

I think this approach is probably more reasonable now that we have tags.

@brxck
Copy link
Contributor

brxck commented Jul 14, 2020

Awesome. Modularizing using tags is a really great idea.

VSCode's git commands are pretty extensive, it could be possible to combine those... but sharing CLI commands could be complicated by the integrated terminal.

Also one thing I will say about my approach is that utilizing the clipboard can be sort of flaky. I haven't yet asked @lunixbochs if there's a better way to handle the need for immediate text insertion, but that would be worth pursuing.

@knausj85
Copy link
Member Author

knausj85 commented Jul 25, 2020

Notes to self

The following can probably be broken out of ide.talon in a useful way via tags.

  • Search/replace, at least for the basics?
find (everywhere | all): user.ide_find_everywhere()
(search | find) file: user.ide_find_file()
(search | find) path: user.ide_find_in_path()

replace it: user.ide_replace_local()
replace (everywhere | all): user.ide_replace_everywhere()
[replace] confirm that: user.ide_replace_confirm_current()
[replace] confirm all: user.ide_replace_confirm_all()
toggle [find by] case : user.ide_find_match_by_case()
toggle [find by] word : user.ide_find_match_by_word()
toggle [find by] expression : user.ide_find_match_by_regex()
  • breakpoints/debugging stuff
go breakpoints: user.ide_go_breakpoints()
toggle [line] breakpoint: user.ide_toggle_breakpoint()
toggle method breakpoint: user.ide_toggle_method_breakpoint()
run test: user.ide_run_test()
run test again: user.ide_run_test_again()
debug test: user.ide_debug_test()
step over: user.ide_step_over()
step into: user.ide_step_into()
step out: user.ide_step_out()
step smart: user.ide_step_smart()
step to line: user.ide_step_to_line()
continue: user.ide_continue()
  • git stuff(???)

  • macro stuff

toggle recording: user.ide_toggle_recording()
change (recording | recordings): user.ide_change_recording()
play recording: user.ide_play_recording()
  • folding stuff
expand deep: user.ide_expand_deep()
expand all: user.ide_expand_all()
expand that: user.ide_expand_region()
collapse deep: user.ide_collapse_deep()
collapse all: user.ide_collapse_all()
collapse that: user.ide_collapse_region()

Also, code.toggle_comment should replace ide_toggle_comment. Should take a moment to re-assess what's in Talon's code namespace

once the above is done, jetbrains and vscode should probably go their separate ways (i.e., ide.talon is no more)

knausj85 added a commit that referenced this issue Aug 6, 2020
- Move much of the VSCode grammar over to brxck's (https://github.com/brxck/talon-config)
- Cross-platform support enabled via the use of vscode's command palette for most things.
- Switch to brxck's grammar for multi-cursor support.

Addresses #165.
@knausj85
Copy link
Member Author

knausj85 commented Aug 6, 2020

@brxck - FWIW, I moved over to your implementation for VSCode, including the majority of your grammar for vscode. Thanks for sharing that, I think it's much better.

@knausj85 knausj85 closed this as completed Aug 6, 2020
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

No branches or pull requests

2 participants