|Extension|Author|Version|
|---|---|---|
|python|donjayamanne|0.6.4|
|mssql|ms-mssql|1.0.0|
|csharp|ms-vscode|1.9.0|
|PowerShell|ms-vscode|1.1.0|
|python|tht13|0.2.3|;
Steps to Reproduce:
Works fine for me, I don't understand the problem. Can you be more specific or include a screenshot?
Yeah, I can probably give you a video.
It is very broken, actually.
I'll get back to you.
On Mon, May 22, 2017 at 11:43 AM, Rob Lourens notifications@github.com
wrote:
Works fine for me, I don't understand the problem. Can you be more
specific or include a screenshot?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/27083#issuecomment-303185740,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAo6ZYWGyF_6bUs3yC0RYu3EUVfgB9Tvks5r8ddKgaJpZM4NirPl
.
I'm having a similar issue. I've documented the problem in this Stack Overflow post. Very similar issue with the find/replace tool.
Still works fine for me. Can you try in Insiders? A gif/video would be great.
Here's a video: https://1drv.ms/v/s!AuxdNgJmWJNgl9gePfXS47vKv-pVWw. I haven't tried Insiders, but I'm running 1.12.2 (latest last I checked) on Ubuntu.
Ah I see. We used to enable find in selection automatically when opening the find widget with a selection, but it was too easy to trigger accidentally and produced a lot of complaints. You probably want to set "editor.find.autoFindInSelection": true
which will make it work the way you expect.
What's happening is that you make a selection, open the find widget, then do a search for .
, not in the selection. When you do a search, it selects each result. So the first result after the cursor is selected, and when you go press the find in selection button, it doesn't have the original selection anymore.
Hope that helps.
Works for me! I'll update the SO answer, Hopefully we can get the word out of the "editor.find.autoFindInSelection": true
option.
I've added "editor.find.autoFindInSelection": true
to settings.json
, but I'm getting an "Unknown configuration setting"
warning.
The problem in the video is ONE of the issues, yes.
However...
I can't find 'editor.find.autoFindInSelection' in Settings and when I set
it, nothing happens. (I have the latest and greatest VSCode)
Another thing that happens is:
Even when you have the 'find in selection' icon selected and it replaces
text fine in that selection, you can't repeat the step with another
selection.
Steps:
It seems the focus event on the FIND box triggers a new selection while
CTRL-H doesn't the 2nd time since the focus is set to the REPLACE box.
This is borked. Makes speedy development impossible.
-Jeff
On Wed, Jun 7, 2017 at 12:21 PM, Rob Lourens notifications@github.com
wrote:
Ah I see. We used to enable find in selection automatically when opening
the find widget with a selection, but it was too easy to trigger
accidentally and produced a lot of complaints. You probably want to set
"editor.find.autoFindInSelection": true which will make it work the way
you expect.What's happening is that you make a selection, open the find widget, then
do a search for ., not in the selection. When you do a search, it selects
each result. So then when you go press the find in selection button, it
doesn't have the original selection anymore.Hope that helps.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/27083#issuecomment-306898218,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAo6ZQvOnAiwbg2Wyzw5a7Nj_g3QLkbyks5sBvhTgaJpZM4NirPl
.
@jmounce are you using Stable? We didn't release 1.13 yet (it's coming this week) so right now you can play with this feature in Insider.
Ah I didn't realize that was a brand new option in 1.13, apologies.
I've tried with editor.find.autoFindInSelection = true
, I still find it pretty janky. Find/selection still doesn't work as I would expect it to.
VS Code version | OS
------------------ | ----
1.13.0 | Win x64 pro (french)
I confirm this feature implementation doesn't currently work as expected and is very buggy and inconsistent. I'm surprised there are not more complains and feedback about it as if nobody encountered this issue in their workflow.
The bug occurs when you try to select one and only one line.
"editor.find.autoFindInSelection": true
replace the `\` by a space in line 3 only with select it and use ctrl+H
bla\bla\bla
bla\bla\bla
bla\bla\bla
CTRL+H
and check out that _find in selection_ feature is ON. It is !editor.findRangeHighlightBackground
color is not triggerededitor.inactiveSelectionBackground
color is triggered showing that line 3 is still selected but not affected by the auto _find in selection_ feature that is ON yet.\
editor.rangeHighlightBackground
color\
on line 4 is selected triggering the editor.findMatchBackground
color\
matched in the file trigger the editor.findMatchHighlightBackground
color\
in the file will be replaced and this is not what you wanted.editor.inactiveSelectionBackground
color is triggered showing that line 3 is still selected.Good luck to get out of this loop trying to do a simple thing.
If "editor.find.autoFindInSelection": true
editor.findRangeHighlightBackground
color is triggered on line 3 and only the \
in that line are matched."editor.find.autoFindInSelection": true
editor.findRangeHighlightBackground
color is not triggered on the selected lineseditor.inactiveSelectionBackground
color is triggered showing that line 3 and 4 are still selected but not affected by the auto _find in selection_ feature that is ON yet.\
matched in the file trigger the editor.findMatchHighlightBackground
colorYou can not directly use the replace field to only run the replace command on the selected lines.
Just put the focus on the _search field_ then the selected lines will trigger the editor.findRangeHighlightBackground
color and only the \
in the selection are matched and can be replaced.
"editor.find.autoFindInSelection": true
will enable the button in the search widget but will never work as expected.
This _find in selection_ feature will play with your nerve when you only want to do what is expected:
"editor.find.autoFindInSelection": true
For now, you'd better set "editor.find.autoFindInSelection": false
then manually enable the _find in selection_ feature in the widget ALT+L
.
The ALT+L
key binding won't work if only one line is selected with the gutter method and when enabled with the button, the _find in selection_ feature won't prevent the bug 1 to occur but it is a workaround for the other case when you:
SHIFT+↑
or SHIFT+↓
I would say those are severe bugs since it is a basic feature that every user has to use in its workflow from time to time.
Thanks for the detailed writeup :)
With autoFindInSelection
enabled, if your selection is within a single line, then it will still search outside the selection. If I toggle the 'find in selection' button on and off, then it actually works as expected. That at least is definitely a bug :bug: I'll leave the rest for @rebornix
Related or duplicate issues:
@roblourens How is Replace All supposed to work with find in selection? I don't so much care about what I have to do to enable "find in selection", but it makes no sense to me that even after it is enabled hitting "replace all" will replace every match in the file:
(please open gif in new tab if too tiny to see)
EDIT: Looks like Github has truncated the gif a few months after I first posted this comment, it looks like a 500 ms loop of nonsense now. The original full link to the gif is: https://rlgvlw.by3302.livefilestore.com/y4mXh_4dIcv6Huc1vuGJmJ7rfHzmz7sDC_mPeAwhssnYrKOvLiER7sP9iMkubRJOPUkCpyB5GuLgDmaVTX6GLPot6L1QI5edoJniMzJrjsEG08a-CX2S5mJ4RVAgo2nzRCGnvEp5aRb_VuW3oxrKrBwn6X8mchkBsa64p3QLQMLEuzD-pjWiwaFloIHV-3vjufVhp9Z4Ffjl_UCkoZ4qg93eA/2017-06-15_01-15-30.gif?psid=1
I'm also having trouble with changing the selection blocks when using Find/Replace in Selection. It does not change the search region automatically after I've selected a different block of text. For example, if one has two blocks of code with an unrelated string in between, the experience is lacking.
The number of matches is updated only if the search field (but not the replace field) is focused or the selection button is toggled. This creates a lot of unxpected behavior, like the editor jumping to the first global match.
My current workflow in this scenario is to select the first block and do a replace, then select the second block, focus the search input field and only then does it update the match count and the selection highlight area.
One simple bug I see is:
"editor.find.autoFindInSelection": true does not work for Replace
The Find in Selection icon is highlighted but the highlight in the editor is not there and replace replaces all entries.
Workaround: Press Alt+L (once), or press Ctrl+F before pressing Ctrl+H
Under these conditions the find selection editor highlight IS respected and is kept after doing replace all.
The fact the the icon is highlighted in itself seems wrong, it should be tied 1:1 to the current find mode and getting out of sync should not be possible.
I confirm that find and replace in selection is inconsistent--whether autoFindInSelection
is true or false. That is a red herring.
When you toggle in-selection mode in the S&R dialog, the target replacements might or might not be limited to the selection. In addition, the selected text becomes unselected most of the time.
What's weird to me is that it also happens in Atom. I got so fed up with it there that I downloaded Code today--only to find exactly the same behavior! Is that a clue to the cause?
@aztecrex - That may well be a clue. I have also seen hints that some or all of this behavior is modeled after Sublime Text. I think the idea is that the "Find and Replace in Selection" paradigm many of us are used to or expecting is somehow outdated and inferior.
Incidentally, I have been trying to evaluate both Atom and VS Code. Both are wonky (to my taste) in this regard, but at least in Atom, the dialog always includes Replace, so there isn't the issue of something working differently depending on whether you started with Ctrl+F or Ctrl+H. And the "within current selection" option is at least very obvious, and "sticky" from one invocation to the next.
The main problem is that F/R box doesn't update its find selection context until you focus on the find field. The moment you do that, find count updates and you can do the replacement. So the only way to make speedy multiple selection replacements is to focus the find field every time you want to make a replacement in the selected text.
Voila. It's a bug, that needs fixing, but this mitigates it rather nicely.
@roblourens , @AdamBJ
Big thank you for "editor.find.autoFindInSelection": true
. It saved me from so much frustration.
"editor.find.autoFindInSelection": true
seems to have no effect when only a single line is selected.
@dkent600 , unfortunately yes :(.
But I simply got used to selecting more than one row whenever I want to achieve the result.
It also doesn't work with CTRL+H. So I simply select >1 rows CTRL+F then switch to CTRL+H
"editor.find.autoFindInSelection": true seems to have no effect when only a single line is selected.
This is still a problem.
Is there any progress on this topic? This seems to be a quite essential feature and it's severely broken.
Can confirm this is broken
Silly, this is still broken, so essential and frustrating that it doesn't work properly.
Something as simple as selecting a line with the mouse, CTRL-H, typing a search string should automatically search within the selection, but it searches the entire document.
editor.find.autoFindInSelection does not change this broken behavior.
Just ran into this. Couldn't believe the amount of toggling and re-selecting I had to do just to replace "avg" with "min" and "max" in two identical selections.
The "Find In Selection" button also doesn't light up or otherwise indicate what state it's in. For comparison, NP++ just has this as a permanent toggle in the Find window alongside Match Case, Whole Word, and RegEx.
I'm experiencing the same issue and it is _very_ annoying since a lot of search-and-replaces are done within a selection! Please fix it ASAP!
Just wasted 30 mins trying every permutation to try and successfully find and replace in a selection - can't believe this is broken.
Same problem here with newest version of VSCode - replacing all within a selection doesn't seem to work. Kind of weird that this common function doesn't work correctly.
I have no idea how to do find in selection. Coming from TextMate where it just worked. Is it broken or unintuitive?
same issue - i've been programming since 1981.. have used tons of different editors, never had such a hard time with something that is so commonly used - find/replace in selection. Fix this or I'm outa here.
not working for me. please fix asap.
Let's try to fix issues mentioned above one by one ;)
Above changes will be shipped in tomorrow's Insiders. Can anyone help me understand if I miss anything/bug ?
I'm coming from Geany 1.32 on Ubuntu and I'm loving VSCode so far but this is functionality feels really clunky compared to that of Notepad++, Geany, Atom and others. It's good to see I'm not the only one frustrated with this.
Typically I'd either like to replace all occurrences of text in the open file or I'd like to replace all in the selection.
I've managed to get the first case working with CTRL + h, type old text, TAB, type new text, CTRL + ALT + ENTER
.
Replacing in selection is a little more involved with Select Lines, CTRL + h, ALT + l (to replace in selection) type old text, TAB, type new text, CTRL + ALT + ENTER
A few irritations with this:
ALT + l
toggle out of the replace in selection option and back in again.CTRL + ENTER
and just don't mess with the user selection at all? A "Replace all in Session" to replace in all open documents would be great too. Maybe it's there already, but I'm missing it?CTRL + TAB
'ing every time I want to find something else is yet another step for each new find replace case.@chambead thanks for your feedback, really insightful.
The selection is forgotten if you ALT + l toggle out of the replace in selection option and back in again.
let's track this issue in https://github.com/Microsoft/vscode/issues/50567. Once the Find In Selection is toggled off, we will do another search in the whole document and move the selection to the nearest match so the next Find In Selection toggle can not bring back the search range. That's what we need to investigate into.
A "Replace all in Session" to replace in all open documents would be great too
Feel free to create a feature request for Search Viewlet, Find Widget is focusing on single file.
The find-replace dialog is out of the main area of focus and the controls are tiny and hold little
We can resize the find widget horizontally but not vertically.
The first find field should always be the default focus and it should be selected by default IMO for easy replacement
If we set editor.find.seedSearchStringFromSelection
to false
, then each time when we invoke the replace box, the find input is focused.
Just found this issue and tested the insiders build and I found two main problems:
Also, don't know if this has been mentioned, but it's the thing that bugs me the most:
The only reason it should change is if I closed the dialog then tried to find again with no selection, and even then, I'm not sure if it's better to just use the previous selection or the active line in those cases.
Another way to tackle it might be to allow starting the find dialog in different modes? For example: ctrl+f = regular, ctrl+alt+f = start with selection? I think I'm going to make myself some macros for this. I looked to see if this existed btw, and found a kind of confusing "Find with Selection" shortcut. I feel like maybe it should be called "Seed Find from Selection", though that's minor complaint. Btw, does anything like this exist to seed the replace text? Would be really useful. I could make my workflow:
even after minutes could not replace inside the selection.
verison 1.27.2
I think I have found another workaround. It seems to me that the find in selection works if I highlight my selection from the end to the beginning and leave the cursor before the selection. Otherwise, the selection jumps to whatever is next. I still think that this is wrong behavior, but I hope it might save some people some headache.
i have to add that lately, still with 1.27.2, i am able to replace inside selection without problems. not sure what makes the difference between back than and now. i assume my problem was related to the specific file and file format (typescript, jsx in the problematic case).
This is definitely so horrifically broken it's laughable. I've struggled and struggled to replace in selection and it's infuriating. I will try with the autoFindInSelection
turned on and I hope that will at least help somewhat. It's really frustrating you can't select new selections while the find dialog is open and operate on those sections. It's one really glaring issue in an otherwise stellar product.
Considering that the issue is 2 years old I think it's better to open PR and fix everything rather than waiting for devs to react ...
One thing I'm seeing that I didn't see mentioned here is that when I CTRL+H to replace, with auto find in selection set to true, and then I hit TAB to move from the "Find" field to the "Replace" field, it instead auto completes text in the editor. As if the focus isn't truly in the "Find" field to begin with.
I have another problem with multi-cursor select. It replaces only in the "first" selection (The one where the original cursor is). Should I report a new issue?
https://drive.google.com/open?id=1FfTJ5pk09iU5V-8Xh1NzLeCMFxx_lH6B
I think the option autoFindInSelection
should be changed to just findInSelection
and allow three different values:
always
: always find in selection, even if a single word is selected, equivalent to the current autoFindInSelection:true
optionnever
: never find in selection, always use selected text to autofill the search boxauto
(default value): if one entire line or more lines are selected, use find in selection, otherwise use the selection to autofill the search boxi don't think there's a need for a different findInSelection option.
It never makes sense to 'find in selection' if the find input is initialized with the value of the selection. there's no need for an option to say 'always do something that never makes any sense', just don't do the broken thing.
visual studio proper has always done the right thing here, choosing 'current document' instead of 'selection' when doing a ctrl-f3.
i don't think there's a need for a different findInSelection option.
It never makes sense to 'find in selection' if the find input is initialized with the value of the selection. there's no need for an option to say 'always do something that never makes any sense', just don't do the broken thing.
If you are referring to my soution, I didn't propose any such option that does both things at the same time, as it wouldn't make sense, as you suggest.
I have included always
just to reflect what I reckon is the current behavior when autoFindInSelection
is set to true
. I wanted to keep this behavior because people have asked, and obtained, this in past issues. Obviusly with this option the box should never be autofilled, perhaps I forgot to clarify that.
never
also reflects current false
(with the only addition to _always autofill the box_, which can help search faster, but is innocuous if you wanted to search anything else, since the box is focused and you can just start writing right away to replace the prefilled text).
auto
is just what most people would expect from a smart editor, and what should be the default. This has been asked in different ways in many issues, some of which are referenced above.
Thanks all for your contribution to this topic and thanks @xates for your proposal, it makes perfect sense that for a lot of time you only want to auto find in selection when it's across multiple lines.
It used to be like what's being proposed above but I think years ago when we hear the complains about auto find in selection not working when searching in long lines, we relax it a little bit to support all cases. But it definitely break the experience for single line, especially when using with seedSearchStringFromSelection
.
From next weeks' Insiders, editor.autoFindInSelection
will have a new type of value multiline
, to allow you only use selection as scope only when it's across multiple lines.
I appreciate all the work and attention that has gone into this, but I don't think I will ever be truly comfortable with Find/Replace in VS Code. The issue for me is that the "find in selection" button looks and feels like a toggle switch, not a trigger (or "fire button").
If you flip a toggle switch from one position to the other, and then back to the original position, it should be as though you had never flipped the switch at all. With this mental model, it is always a shock and a disappointment when flipping the switch irreversibly destroys my carefully crafted manual selection.
Most helpful comment
Ah I see. We used to enable find in selection automatically when opening the find widget with a selection, but it was too easy to trigger accidentally and produced a lot of complaints. You probably want to set
"editor.find.autoFindInSelection": true
which will make it work the way you expect.What's happening is that you make a selection, open the find widget, then do a search for
.
, not in the selection. When you do a search, it selects each result. So the first result after the cursor is selected, and when you go press the find in selection button, it doesn't have the original selection anymore.Hope that helps.