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

"Variable ${selectedText} can not be resolved" when run command search.action.openNewEditor from diff editor #141051

Closed
Binly42 opened this issue Jan 20, 2022 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders search-editor verified Verification succeeded
Milestone

Comments

@Binly42
Copy link

Binly42 commented Jan 20, 2022

Issue Type: Bug

The full detail error/warning message is: Variable ${selectedText} can not be resolved. Make sure to have some text selected in the active editor.
And finally not open a new search editor yet.

repro

  1. add a keybinding like:
  {
      "key": "ctrl+e ctrl+f",
      "command": "search.action.openNewEditor",
      "args": {
          "query": "${selectedText}",
      },
  },
  1. in a normal editor, select some text, emit the shorcut, the command works fine
  2. in a diff editor, select some text, emit the shorcut, the result said top above appears
    • no matter select in left side or right side, or even both ...

VS Code version: Code 1.63.2 (899d46d, 2021-12-15T09:40:02.816Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.80GB (0.62GB free)
Process Argv --crash-reporter-id aef19635-1b79-4f09-9c0d-1ff29d49308d
Screen Reader yes
VM 50%
Extensions: none
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30425749
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263cf:30335440
vscoreces:30384385
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30424896
pythonvs932:30410667
vscop804:30404766
vscop940:30404999
vsrem710cf:30416617
vsbas813:30426126

@Binly42
Copy link
Author

Binly42 commented Jan 20, 2022

Another point might not related.

From #95582 (comment) , I got that ${selectedText} would throw if there's no selected text.
As a result, currently it is not able to open a search editor, which should be with a complex query based on selectedText (like "query": "foobar${selectedText}",), when not selected anything.

Maybe it is not simple to make the query arg support full-feature snippet.
But it would be great to support when not selected anyting...

IMO it would be more great to support the $0, with that we could easily edit the text to be search when not selected text (by using something like ${0:${selectedText}})

@JacksonKearl JacksonKearl added bug Issue identified by VS Code Team member as probable bug search-editor labels Jan 20, 2022
@JacksonKearl JacksonKearl added this to the Backlog milestone Jan 20, 2022
@JacksonKearl JacksonKearl modified the milestones: Backlog, February 2022 Feb 4, 2022
@mjbvz
Copy link
Contributor

mjbvz commented Feb 24, 2022

@JacksonKearl This works for me when I select text in a normal editor or on the right hand side of a diff view, but not when my selection is on the left hand side (to repro, make sure nothing is selected on the right)

@mjbvz mjbvz reopened this Feb 24, 2022
@mjbvz mjbvz added the verification-found Issue verification failed label Feb 24, 2022
@JacksonKearl JacksonKearl removed the verification-found Issue verification failed label Mar 3, 2022
@alexr00 alexr00 added the verified Verification succeeded label Mar 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders search-editor verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@JacksonKearl @mjbvz @Binly42 @alexr00 and others