In the web project I have been working on, we have string literals all over like
<div class="title">This is Title</div>
<div class="text">This is some text<div>
In order to make the application multilingual, I need to replace all these literals to some helper methods:
<div class="title">#TranslationHelper.Translate("This is Title")</div>
<div class="text">#TranslationHelper.Translate("This is some text")<div>
I want to create a custom shortcut (e.g CTRL + ALT + M) either through Resharper 8.0 or Visual Studio 2012.
When I select the text I want to transform and press the shortcut I defined, Visual studio should replace the selection with the format I defined.
How do I do that?
You can use Resharpers Surround With feature to acheive this. First open the Template Explorer
Resharper -> Template Explorer
then click New Template:
Enter your desired string in the template editor and save (Ctrl-S)
Now place your cursor in the desired text. On another note you can use Resharpers Extend Selection feature to quickly select the text (Shortcut is Ctrl-Alt-RightArrow)
Once the text is selected choose press Ctrl-E,U (Resharper Surround with)
Click More where you can select your new template and ensure you add it to the quicklist so its added to the list for next time
Related
ReSharper offers to add abbreviations to a list, (per computer, per solution team-shared, or per solution personal). But sometimes it doesn't automatically understand which part of identifier comprise an abbreviation. I'd like to be able to manually add a word I need to ReSharper abbreviation list. How to do it?
If I am understanding what you are wanting to do...
This appears to work for ReSharper 2019.2.2 in Visual Studio 2019.
Click Extensions on tool bar
Hover over ReSharper
Click Options...
Open Code Editing
Open C#
Click Naming Style
Click Advanced
Enter abbreviations in Abbreviations text box at the bottom
Click OK then Save
Is it possible to use images inside a ComboBox instead of strings? I've seen post regarding the ImageComboBox control but it seems that I couldn't find any resource how and where to download the said control so I could use it in my project that I'm working on.
Thanks all.
To be able to use the Image Combo Box, you have to do the following:
Insert the control from the Insert menu on the developer tools tab:
If you press the highlighted button, a new menu appears.
Search for "Microsoft ImageComboBox Control, version XX"
Then you are able to insert the desired combobox.
IntelliJ and Android Studio have a great "Translation Editor" where it shows you all the <string> entries of the strings.xml and you can add items and locales on the fly. It also shows which strings are not translated yet and offers a blank box to enter the translation
To use this rapidly, I would like to go from one string entry directly to the next without needing to switch to the mouse, hover around and double-click on the next item. It looks like this:
I think this is something any user would love. I was surprised when I couldn't make it happen. I can move to the next row via Enter but that row is then only focused, not selected and I can't type. I tried Enter again, Shift+Enter, F2 and many many many more keyboard combinations. Still no success
So: How can I either move to the next item directly or select a focused item in the Translation Editor?
My version is 14.1.4
To select a focused item press F2 (working in Translation Editor on Android Studio 2.2)
Is there a keyboard shortcut (or customizable keyboard shortcut) to select text inside a single quote '' and double quotes "" in Visual Studio 2012.
eg:
string name = "John Doe";
instead of dragging the mouse to select all of John Doe, is there a way to just point the cursor inside the double quotes and
press a key combination to select it? Wanting to avoid usage of mouse a much a possible.
I found a similar question
Visual Studio / R# Keyboard shortcuts: select string with or without quotes
but the shortcut given will only select a particular text, not the entire text inside quotes
TIA
In researching this I have found two answers:
Answer the first
Ctrl+Shift+W will select the text of the word that your cursor is on within a string. Press it again to select the text of the entire string without the quotes, again to select the quotes, again to select the next logical container and so on.
Answer the second
If you use ReSharper you can use Ctrl+Alt+Right Arrow to do the same thing as Ctrl+Shift+W. You can also use Ctrl+Alt+Left Arrow to reduce your selection by one logical container.
In Visual Studio 2013 it was Ctrl+Right Click. You can use Ctrl+Shift+] for Visual Studio 2015 ;)
TLDR; CTRL+W+W
I am using visual studio 2017 with ReSharper. I don't know if it is ReSharper that added the command or if it is native to VS2017 but using my set-up it is possible to select the text within quotes by putting the cursor in between the quotes and hitting CTRL+W+W
The first CTRL+W will select the word closest to the cursor. Hitting W again will select everything between the quotes.
As of VS2019, with the cursor inside the string, ALT+SHIFT+= will select the whole string, including the surrounding quotes.
I am not aware of such keyboard shortcut.
The following quick trick uses mouse and includes double quotes.
Just double click left to the first double quote, VS will select the entire string (including the enclosing double quotes).
Apparently the functionality that you're looking for doesn't exists (http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx) For do that I use ctrl+shift+ arrows to select quickly but is not a visual studio functionality is global for all text editors.
regards.
In Visual Studio 2013 I was able to do this by Ctrl+Left Click on the start of the string quote (that is on the left side of the (") sign). Moving to VS 2015 this functionality no longer works for me and I would love to know how to trun it back on.
Use (Ctrl + Shift + W) in Visual studio. just move cursor before " and use this combinations of keys.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed last month.
Improve this question
How can I search and replace a String in all files of my current project?
Let's say I have the string "/sites/default/" now I want it to be "/public/sites/default/", but there are almost 1000 files.
Goto "Search"->"File" from menubar at the top left
Enter text, file pattern and projects
Click "Replace..." button at the bottom
Enter new text click ok
Voilà...
Depending on the file type you are focused on, Ctrl+H will open up different types of search screens.
A more consistent hotkey would be using the Alt method: Tap Alt, then A, then F.
Efficient Order of Operations:
Ctrl+C the text you want to do the replacing (if available)
Highlight the text you want to be replaced
Tap ALT, then A, then F. Brings you to File Search. The selection from (2) will auto-fill the search box
In the “File name patterns” input box, type in “.java” for replacing all Java files or type in "" to replace in all files
Click “Replace…”
Ctrl+V (Paste). Or type in the value you want to do the replacing
Enter
You can find more details in my blog post: http://blog.simplyadvanced.net/android-how-to-findreplace-in-multiple-files-using-eclipse/
Use Ctrl+H for opening Eclipse search dialog, select appropriate search tab and select "Replace..." to get you to the "Search and replace" dialog
Strange but it is a two step task:
Search what you want
In the search tab right click and select replace , or replace all:
A demo at:
http://www.avajava.com/tutorials/lessons/how-do-i-do-a-find-and-replace-in-multiple-files-in-eclipse.html
Tonny Madsen said it right, but sometimes this is too simplistic.
What if you want to be more selective in your replacements since not all replacements are correct for what you're trying to do?
Here's how to get more granularity to do the replacements only in certain folders, files, or instances:
First, do like he said:
Click Search --> File... OR press Ctrl + H and choose the "File Search" tab.
Enter text, file pattern and choose your Workspace or Working Set.
Then:
Click Search
When your results come up, make some folder, file, or instance selections by Ctrl + clicking on the ones you'd like to select. Ex: here's my selection. I've chosen 3 instances, 1 file, and 1 folder:
Now, right-click on your selection and go to --> Replace Selected.... Here's a screenshot of that:
Enter what you'd like to replace it "With". In my case you can see it says it is "Replacing 190 matches in 4 files". Now click OK.
Voilà!
References:
Here's the tutorial I came across that taught me this: http://www.avajava.com/tutorials/lessons/how-do-i-do-a-find-and-replace-in-multiple-files-in-eclipse.html?page=2
ctrl + H will show the option to replace in the bottom .
Once you click on replace it will show as below
There is an option in search => file and shortcut is Ctrl+H. Go for further refer follow link. This is work fine with Eclipse Neon
Is there a way to find/replace across an entire project in Eclipse?
If you want to replace two lines of code with one line, then this does not work. It works in notepad++. I end up open all files in notepad++ and replaced all.
Ctrl+F gives me Find/Replace dialog box.
Or you can,
First Alt+A
Next Alt+F
Then press on Replace button.
If non of them worked:
Goto -> Window -> Preferences -> General -> Keys and search for replace then you will see binding for Find and replace. In the bottom of that window, you can add your key to Binding text box. There you can add or edit any keys as shortcut.
I have tried the following option in Helios Version of Eclipse.
Simply press CTRL+F you will get the "Find/Replace" Window on your screen