editor: Limit `CopyHighlightJson` to selection (#46555)

Closes https://github.com/zed-industries/zed/issues/36618

I'm not sure if there is a specific issue for this, but I noticed it
while working on some other PRs, as have some other people:
https://github.com/zed-industries/zed/issues/20525#issuecomment-2469507157

Cause: when running `copy highlight JSON` from the command palette,
input was disabled due to the modal, and the selection method call
always returns `None`. This most likely works as expected when bound to
a keyboard shortcut, but since there is no default shortcut most people
probably don't execute this action that way.

Fix: just grab the selection directly; I don't think this command needs
to be IME-aware, so it doesn't need to use `selected_text_range`.

NOTE: There still seems to be an issue where `VISUAL LINE` mode doesn't
select anything, even when I called `selections.newest_adjusted`, so I
opted to try and keep the implementation closest to what it was doing
before. (edit: actually this might just be the same as #45799?).

Release Notes:

- Fixed `editor: copy highlight JSON` not limiting to the current
selection
361428a450Ian Chamberlain committed on 3/31/2026, 8:39:44 AM· committed by GitHubparentebb451e
2 files changedLine totals unavailable