microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.94k stars 29.18k forks source link

Better UI for Multiline Search & Replace in a single file #15727

Closed anacondaq closed 5 years ago

anacondaq commented 7 years ago

I'm new to VSCode, i like many things in this editor, but i miss a lot of really useful and important options which missing for some reasons at Visual Code. One of such feature is Powerful Search Options.

About what i'm talking about?

What will you see on image above?

  1. Multiline Search which will search in opened document for the text. Also, this feature support searching for multiple lines at once in multiple documents very easy.
  2. Multiline Search when you enter in search fild your lines automatically find in text this text (if it exist) and highlite it
  3. You can manipulate with multiline search the same like with one-line search.
  4. You can select multiple lines via ALT + SHIFT + Arrow Up / Arrow Down multiple lines, then you can click HOME button and all lines will be selected with multiple cursor and you can apply some changes to your multiline search like below:

Multiline Searching And Line Manipulation in search field

Why multiline feature like in sublime text should be implemented?

Because of this feature, time saved in 10-20x times. People like me who working with a lot of patches, reject hunks, etc things and working with a lot of searching things will find this features very useful. Example of usage can be: fixing .rej files, applying patches, big diffs, applying some changes to multiple lines at once.

Please think about it well, this feature is market-killer, and in one day even if you reject the issue today, community will request this feature for sure, no exeptions, just time will show. Because this feature minimize stupid tasks and time for doing the same job, productivty increased, all happy.

More info about feature: http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace.html

sandy081 commented 7 years ago

@anacondaqq VS Code also supports multi line search in a file for which you need to enable regex option and provide eol characters for line separators. But, I see that in your video it makes much easier to copy multiple lines and search for it just by pasting it and I liked it.

anacondaq commented 7 years ago

I saw Electron & VSCode source code, and i think my request will be very hard to implement... This is so bad... 😿

michaelperrin commented 7 years ago

This is one of the features I miss the most indeed.

Finding and replacing chunks of text (I mean multiline text) is really useful. Using \n is not a solution, as you need to make the change the text you have copied before pasting it to the search and replace inputs.

I would therefore really like to get "textareas" instead of "input text" fields for search and replace fields.

tobia commented 7 years ago

I used this feature all the time too: just paste a chunk of code (or data) that you need to search and replace, then iteratively convert it into a regexp (replacing stuff with (.*?) or other capturing groups) and use the captured groups in the replacement string (also multiline)

anacondaq commented 7 years ago

@tobia i don't get you, explain. Can you show any illustration?

ariesy commented 7 years ago

I have been using this feature in sublime text a lot, really need it in vscode so I don't have to use two text editor.

shikkaba commented 7 years ago

Will this be implemented soon? I really miss this feature.

I like how Dreamweaver does multiline search. Haven't used Sublime.

rnemec commented 7 years ago

Looks like it got lost in the #26498 re-scoping. Originally, that was thought to be precursor for this issue, but then they decided (correctly I believe) to take what was already done (horizontal resize) and split it. But not sure where the vertical aspect of the Find Widget landed. And it is now definitely disconnected from this issue.

@rebornix , could you please look into reviving this issue and perhaps relink it with the proper underlying work/issues? Also, if somebody feels that this issue still needs more clarification or justification, please, let us know too. (All the reporters here, we may be under impression that the problem is "obvious, anybody can see it")

soundstep commented 7 years ago

+1 Missing this feature as well!

louy2 commented 7 years ago

I found this thread after I failed to understand how to use multiline regex to match what I want. I wanted to delete blocks of the same HTML that was copied and pasted throughout a document. I did not know that Sublime Text has this feature, and after changing to it, finished the operation in no time.

anacondaq commented 7 years ago

@louy2 this is killer-feature.

ArmorDarks commented 7 years ago

I must admit that VS Code searching UI and UX is total disaster in comparison with Sublime Text. One of the most important aspects of text editor takes a lot of time to do trivial things after Sublime Text, not to mention very unpleasant form — little widget, which you will quickly hate if you need to write often there big chunks of texts, which simply do not fit.

And yeap, lack of Search all button is lackluster too.

Also, would be great to see option to always keep Replace field expanded. Expanding it takes precious time.

louy2 commented 7 years ago

@ArmorDarks To open Replace field directly in VS Code you can use ctrl-shift-h

xuejianxianzun commented 6 years ago

I need this feature too. now i have to use Sublime Text 3.

axlan commented 6 years ago

It's not nearly as good as having native support, but I made an extension that partially adds this functionality. https://marketplace.visualstudio.com/items?itemName=axlan.multiline-find-and-replace It lets you either copy multiline selections as regex to use in the normal find widget, or provides hotkeys to do limited multiline find and replace with text selected from the editor.

Also filed https://github.com/Microsoft/vscode/issues/41050 as a simple change that would streamline the regex find behavior for multiline selections.

mshanemc commented 6 years ago

aww, I was trying all kinds of things to get this to work. Had been loving vscode otherwise, but this is a bit of a problem.

anacondaq commented 6 years ago

I love many features in VCode, but without this feature can't move from sublime to VSCode... 😭

abos5 commented 6 years ago

"without this feature can't move from sublime to VSCode..."

jelofsson commented 6 years ago

Ended up here looking for how to do multiline search in VS code.

vesper8 commented 6 years ago

Really missing this feature too

Jetbrains does Multiline search/replace as well and I use it all the time.. I am having to keep an old editor handy just to be able to do this now

rtpHarry commented 6 years ago

Yep the only editor I have handy that I know with multiline replace is Dreamweaver and I would sooner eat tide pods than load that up...

ypapouin commented 6 years ago

As an alternative for now, I'm using Notepad++ with ToolBucket plugin that contains a multi-line search and replace dialog: http://phdesign.com.au/npptoolbucket/

josephsimony commented 6 years ago

@rtpHarry please don't get me wrong but there are 10+ editors with multiline replace. Btw.: in my case, it's UltraEdit for 20+ years now

rtpHarry commented 6 years ago

Fair enough, no I don't take you wrong. As a developer I appreciate some things may sound simple but not be simple to implement. At the time I was mid project and it was working an a pure html site that didn't use any templating system so I needed to fix things in many files. Not a common task for me.

Probably didn't word it totally accurately, what I meant was that it was only editor that I knew at the time for the quick job of a search and replace. Downloading and comparing editors would have taken longer than manually doing it so I sucked it up and loaded DW.

I just thought I would throw my voice into the crowd to say that this would have been a useful feature for an actual job not just theoretically.

EmmanuelBeziat commented 6 years ago

Agreed, I really miss that.

waldi commented 6 years ago

+1

AkcentChester commented 6 years ago

This feature is very helpful to all coder. I badly miss it. Please add this feature quickly.

joaom182 commented 6 years ago

+1

tkovs commented 6 years ago

+1

tdmalone commented 6 years ago

@jotajotaramirez @tkovs @opensolution @joaom182 @waldi +1 comments are not very useful - please use the reactions on individual messages instead and leave comments for actual discussion. Otherwise, every subscriber to this issue gets notified about your +1, and it risks someone at VSCode locking the issue.

opensolution commented 6 years ago

editplus-multilin-replace This is how it was solved in my "old" Editplus. THere is simple textarea type fields. It has also "Regular expression" as you can notice. It would be great to have it in VSCode.

JunhwanPark commented 6 years ago

I started using vscode instead of sublime. I really need this feature!!

aristocr2t commented 6 years ago

I use vs code about half year and I still wait that feature. Also please change font family to monospace in the searching row! Non-monospace font makes my eyes bleed. (=

myrdd commented 6 years ago

@Aristocr2t Monospace in search results issue: #5192

Maximaximum commented 6 years ago

Pity to find out VS Code does not support this :(

ghost commented 6 years ago

I've ran into this a few times now as well. Just so I'm not repeating what everyone else has said, I think what makes this even more annoying is the fact that VS Code explicitly forbids you from using \n in regexes if you're doing Find/Replace in Files (it gives you an error message).

oderayi commented 6 years ago

+1 I need this.

sturtus commented 6 years ago

Absolutely need. Have been using this feature across multiple files since BBEdit in 2001.

DisasterMan78 commented 6 years ago

One of a variety of small things I find exasperating to have to do without in VS Code. +1

NoriSte commented 6 years ago

+1 until now I still open Sublime Text everytime I need to do that

anacondaq commented 6 years ago

@NoriSte after spending much time with VSCode, I found it very useful and great in so many situations, but every time when need to do searching / replacing I'm forced back to sublime... Darn, installing sublime just for search/replace option it's pretty silly, but no alternatives. Also, a very useful thing in sublime is search results displayed as a text page, which you can scroll down, and via double left click on the text will open a file in the place where the text is found. Super useful feature too.

So, if these 2 will be implemented somewhere in 2020, I will move to VSCode. But as I see how it's going (already almost 2 years old issue) - nobody cares, or have much higher priorities.

NoriSte commented 6 years ago

@anacondaqq I'm a Sublime lover and I switched to VSCode when I forced myself to do that because the first time I tried it I didn't make the move. IMHO: Sublime beats VSCode in everything as a text editor (performance, search/replace, s/r done directly or via shortcuts and many many other things)... BUT VSCode isn't a text editor, it's a dev environment, it (well) integrates everything you need today to develop (tasks, debug, GIT, super-easy do be extended) and in that it's almost unbeatable. So: congrats to the VSCode team, I'll switch to Sublime every now and then :)

jcezarms commented 6 years ago

It is also important to realise that software maintainers (as all vscode users are) don't always get to deal with beautiful, well designed code.

There are legacy code chunks we sometimes have to deal with, and they're usually spread among files in the form of duplicate code. The task of identifying and replacing such code is easy as pie with multiline search/replace, and a pain without it. With this feature you can focus on more meaningful, less mechanical work.

travisfisher commented 6 years ago

This is really the only feature that is keeping me from making the jump from Sublime to VS Code. Please implement it! 🙏🙏🙏

Bahaa-Sobhy commented 6 years ago

+100

miroslaw-dubaj commented 6 years ago

+1

smxdevst commented 6 years ago

+1

lnicola commented 6 years ago

The latest ripgrep release has multiline search support: https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0.

cc https://github.com/Microsoft/vscode/issues/13155, @roblourens.

roblourens commented 6 years ago

I saw that and am very excited about it, but in September we are focusing on reducing bugs and debt: https://github.com/Microsoft/vscode/issues/58224. So I will be working on this in October.

anacondaq commented 6 years ago

@roblourens good to hear that, that at least after 2 years of the issue it got checked, and will begin development. ping me back somewhere in 2020 when the feature will be ready. Thx