Can NetBeans autoreplace text as I type? - netbeans-8

I have Gedit set up with snippets, so that when I type XXXTab it automatically replaces xxx with exit(__FILE__ . ': ' . __LINE__);. Is there any way to achive the same effect in NetBeans? Searching for autocorrect or ways of replacing text finds me other, unrelated features.

Yes it has , but you should do your owns, there is someones that are already built inside netbeans, go to Tools - Options - Code Templates
There you can edit your owns or just use the default ones, this is the window
if i write Pfm and press tab it auto completes
Side note:
if you want to autoComplete while you are writing just go to the left tab Code Completion

Related

How to use Option in Intellij Keymaps?

I am trying to add Option-i | u for "Find usages" as shown in this dialog (Note that the "i" is lowercase - shift is not depressed):
But after having selected OK and then going back into Actions we see that the setting did not "take":
Note: I do have custom keymap entries to use Option- for accessing Main Menu items. But why is Option not working in this case? Is there a workaround?
On macOS, "Option" is used for typing special characters, thus when editor is focused and you hit Option-I the shortcut you assigned won't work (it will type a character instead).
However, when no editing field is selected, the shortcut should work (e.g. from tool windows).

Vscode "next search result" shortcut does not work

When I use the shortcut associated with "search.action.focusNextSearchResult" in vscode while searching something nothing happens.
This action is initially associated with F4 which is also used for other shortcuts. I thought it may be the problem so I reassigned it to an unused shortcut but it did not help.
I am using the extension "Emacs Friendly Keymap" (don't know if it can cause the problem).
Do you know how I could make it work?
That shortcut, used to go to the next search result, only works in a search editor. It has these context keys:
hasSearchResult || inSearchEditor
Are you using it in a separate search editor? It does work there. Here is one way to open a Search Editor:
If you are using the Find widget then use either of these:
Enter when focus is still in the Find widget or F3 when focus is in the editor.
If you are doing a search across files, then just a downarrow will go to the next result.

How can I enter a literal <TAB> character in IntelliJ/IDEA/PyCharm?

My configuration indents with four spaces, and I want to keep that. Occasionally (e.g. in a Makefile) I want to input a literal TAB character.
How can I force the IntelliJ-IDEs to input a tab or space, when it would not do so when I hit tab or space in that instance?
You seem to be asking two questions here:
1. How do I force IntelliJ IDE to input a tab, when it would not do so when I hit tab?
and
2. How do I force IntelliJ IDE to input a space, when it would not do so when I hit space?
I don't understand how the second case can arise. However, I have provided a solution to it as well.
Case 1. Insert a tab character when an IntelliJ IDE wants to replace it with spaces due to configuration
Solution
Use search and replace.
Details
Place the cursor where you want the tab to be
Press the X key
Select the X you just typed
From the main menu, choose Edit | Find | Replace to bring up the search and replace pane
Make sure there is an X in the search field
Enter \t in the replace field
Be sure the option Regex is checked
Be sure the option In Selection is checked
Click the Replace button
Case 2. Insert a space character when an IntelliJ IDE won't just let you type one (???)
Solution
Use search and replace.
Details
Place the cursor where you want the space to be
Press the X key
Select the X you just typed
From the main menu, choose Edit | Find | Replace to bring up the search and replace pane
Make sure there is an X in the search field
Enter a single space into the replace field
Be sure the option In Selection is checked
Click the Replace button
Install the plugin for Makefile support: https://plugins.jetbrains.com/plugin/9333-makefile-support
When I tried it today, this automatically use hard tabs in the editors for Makefile files.
Open another text editor, type a tab, and then copy and paste into the PyCharm editor. In MacOSX this worked for me using both Sublime Text 2 and TextEdit.
I can't think of any "direct" way. Probably the easiest way that I can think of is to write a Live Template to do it. See the help page on Live Templates for more information. When you write it, you may need to copy and paste a tab character in from another application.
However, when I tried it, IDEA saw it as just empty text and would not save it. So I used a variable with the "capitalize" function to capitalize a tab character.
Here's the template I created that you can paste into your templates. Now I type tab, hit the Tab key and I get a tab character. Of course you can change the abbreviation.
<template name="tab" value="$TAB$" description="Enter a tab Character" toReformat="false" toShortenFQNames="true">
<variable name="TAB" expression="capitalize(" ")" defaultValue=" " alwaysStopAt="false" />
<context>
<option name="OTHER" value="true" />
</context>
</template>
You could extend the idea to have multiple ones that enter multiple tabs. For example tab to enter 1 tab, tab2 for 2 tabs, etc.
Screenshot of it after use:
There may also be a way to hack a macro to do it. You could then assign the macro to a keyboard shortcut. I'll see if I can figure something out and update this if I do.
Use the menu option: Edit -> Convert Indents -> To Tabs.
Whenever I edit a makefile I do the "to tabs" conversion before I save the file.
UPDATE: Really sadly, I think the generated character still gets converted to spaces... Am checking...
There is an Action in JetBrains IDEs to enter a Tab character.
Here are the steps to use the Tab character action: (discovered in PyCharm 2020.3)
Double-tap the Shift key OR Help -> Find Action...
Type the 3 characters tab
Click on the action that is called Tab and shows the icon for the Tab character...
It remembers the last action you did, so if you have several tabs to add, you can get into a quick process by doing ShiftShift then Return each time.
Answer based on #Morfic's comment to the question. I think this is the cleanest and most sensible reply here so I figured it deserves a place as an answer (and needless to say, it worked for me).
If they're different types of files you could configure File -> Settings -> Editor -> Code style -> Tabs and Indents for each one to use either space or tab depending on how you want it.
One way to do this is to copy a TAB character from another text editor, then right click in your PyCharm file and use Copy / Paste Special -> Paste as Plain Text (Ctrl+Alt+Maj+V)
I guess this was not available in older PyCharm versions, because no other answer proposed it. Regular paste (Ctrl+V) doesn't work (replaced by spaces), but this one works. The function will also bypass other automatic formatting.
Inspired of Clare's suggestion,
assign the left tab key after finding 'tab' action.
At Actions tab, search by 'tab' and move your up/down arrow key and place there.
Then type Ctrl+1, you will see a popup. Select as follows and click OK.
Then, you might be asked "Do you want to remove other assignments?" if Tab key was already assigned. Click Leave because your usage won't conflict with the existing setup.

What does the scheme dropdown menu do in Phpstorm?

In the settings window of Phpstorm, there is a dropdown box labelled scheme
What does it do?
What does it do?
You may be surprised .. but it allows you to choose another (different) Code Style scheme for this project.
PhpStorm supports globally defined schemas (by default it provides only one -- "Default") which can be used by any project and project-specific schema called "Project" which available for this project only (and stored together with other project-specific settings).
You can read more in official help page.
The Code Style is used for code formatting: be it automatic as you type / use live templates etc .. or manual reformat via Code | Reformat Code...
It's used to
choose the code style scheme to be used as the base for your custom coding style for the selected language (Source).
In other words: after selecting a scheme, you can set different formatting options, like tabs vs spaces, tab size or line breaks etc. To use those settings in your current project, you need to click Manage, select your edited scheme and click Copy to Project. After this, you can press Ctrl + Alt + L (Code > Reformat Code...) in the editor to reformat a file according to those scheme settings.

Rename using suggested var name with resharper

I'm Using resharper 6 nighty builds and VB.net. I've a big medium project with multiple files that don't follow the code style conventions of my company.
I've configured resharper with my own convenctions and It suggest to me the right name for each variable (perfect!).
But I can't find any automagic way to make the current name to be replaced with the suggested name.
Are there any way to do it? If not ... did you know ane fearure of coderush Xpress to achieve it?
Thanks.
If you've configured ReSharper with your naming conventions, then it should show a warning (blue squiggly underline) under any identifiers that don't comply. If you put the text cursor on one of those misnamed identifiers, you should see a pyramid icon appear near the left margin. Then you can press Alt+Enter (or click the pyramid icon) to drop down a quick-fix menu. There should be an option in the menu to "Rename to '_myField'". Usually it's the first item in the list, so you can just press Enter again to do the rename.
If you want to do this on everything in a source file, you can use the ReSharper > Inspect > Next Issue in File command (or its keyboard shortcut -- F12 in the IDEA keymap) to move the cursor to the next warning in the file. Then, if it's another name warning, you can use Alt+Enter, Enter again to fix it.
Unfortunately, there isn't a way to automatically fix every instance of a warning at once (though it's been requested; please feel free to vote for RSRP-126551 in their issue tracker).