You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
When doing a find and replace - a find on a single line, to replace it with multiple other lines - it would be nice if Atom automatically indented the new lines to match the style of surrounding/preceding lines. Similar to how when you go onto a new line, it automatically knows where your cursor should be. It would be nice if this applied to replaces also.
I always have an awful time trying to explain what I mean, so if this isn't clear then please refer to the Additional context section below.
Motivation
In each file, each line of my code has a varying number of tab-indentations, as I'm sure everyone's code does. It seems weird to me that nobody has ever wanted to do a find-and-replace on multiples lines of varying indentation, without having to manually specify a number of tabs.
Describe alternatives you've considered
I've scrolled through all of the issues on this Git and found nothing similar to what I'm trying to do. I've also flicked-through the community packages, and found nothing that works to achieve this.
Additional context
Here's what currently happens...
This is my code:
I'd like to add a comment title line above the var output = get_output(data); (the highlighted line). Instinctively the best way to do this, would be to use regex in the find and replace like so:
Find: var output = get_output(data);
Replace: /* Get response */\r\n\r\nvar output = get_output_new(data);
The reason I'm using find and replace, and the reason why I can't just use \t to add the correct number of tabs, is because this line of code exists in many files, all with different amounts of indentation. So although, in this specific case, \t\t\t\t would be the correct number of tabs to match the indentation, it wouldn't match in other files - 4 tabs may be too many or too little.
Here is what the result should look like after running the find and replace:
But, instead it looks like this:
Like I said, without manually adding \t I don't see how I'd be able to get this to look how I desire.
The text was updated successfully, but these errors were encountered:
Summary
When doing a find and replace - a find on a single line, to replace it with multiple other lines - it would be nice if Atom automatically indented the new lines to match the style of surrounding/preceding lines. Similar to how when you go onto a new line, it automatically knows where your cursor should be. It would be nice if this applied to replaces also.
I always have an awful time trying to explain what I mean, so if this isn't clear then please refer to the Additional context section below.
Motivation
In each file, each line of my code has a varying number of tab-indentations, as I'm sure everyone's code does. It seems weird to me that nobody has ever wanted to do a find-and-replace on multiples lines of varying indentation, without having to manually specify a number of tabs.
Describe alternatives you've considered
I've scrolled through all of the issues on this Git and found nothing similar to what I'm trying to do. I've also flicked-through the community packages, and found nothing that works to achieve this.
Additional context
Here's what currently happens...
This is my code:
I'd like to add a comment title line above the
var output = get_output(data);
(the highlighted line). Instinctively the best way to do this, would be to use regex in the find and replace like so:Find:
var output = get_output(data);
Replace:
/* Get response */\r\n\r\nvar output = get_output_new(data);
The reason I'm using find and replace, and the reason why I can't just use
\t
to add the correct number of tabs, is because this line of code exists in many files, all with different amounts of indentation. So although, in this specific case,\t\t\t\t
would be the correct number of tabs to match the indentation, it wouldn't match in other files - 4 tabs may be too many or too little.Here is what the result should look like after running the find and replace:
But, instead it looks like this:
Like I said, without manually adding \t I don't see how I'd be able to get this to look how I desire.
The text was updated successfully, but these errors were encountered: