JetBrains IDEs live templates - place multiple carets - intellij-idea

In IntelliJ live templates one can use $END$ to specify where the cursor should be placed once the template is expanded.
Is there a way to place multiple carets? Specifying multiple $END$ locations doesn't work. I sometimes need to type the same text into several places for what can be an auto-generated piece and that would be a nice expansion of functionality.
Currently as a solution I use "surround templates" where I can first type some text and then use $SELECTION variable.

Related

IntelliJ constants.getProperty() autocomplete field

I have a large constants.properties file.
When reading properties from it with constants.getProperty("PROPERTY_NAME") I often have to copy/paste the property names which is rather long.
I see that IntelliJ is able to detect when properties are used inside the code, is it be possible to have auto-completion of property names when I type the name in getProperty()?
Yes, IntelliJ IDEA provides the completion for the Java Properties, use Ctrl+Space to get the hints:

How to move cursor to Vue methods, computeds, data quickly in VS Code?

I already tried using the symbol explorer in VSCode (CTRL+P then write #). It allows me to jump to data (because it's a method) but it won't jump to normal properties like "computed:" or "methods:"?
This would be useful when eg. I look at my component and think "Aha! I need to add a computed, so let's jump to computeds". I could just CTRL+F but this sometimes doesn't work if another variable or comment has 'computed' in its name
Currently, you can
use Ctrl+R to open Go To Symbol in Editor,
then enter some words like data, computed or methods and etc.,
then press Enter
The cursor would be moved to the selected symbol. Tested in Win10/v1.48.2
The easiest way how to do that is probably using Bookmarks extension.
I am using them and also I haven't find a better way how to solve same problem as you have.

Abbreviations in PhpStorm

IntelliJ comes with 2 abbreviations that I have used a lot in the past, but cannot find in PhpStorm:
iter Iterate (for each..in)
itar Iterate elements of array (traditional loop)
So whenever I typed iter and pressed tab, it generated an enhanced for-loop. How can I achieve this in PhpStorm?
PHPStorm has live template so you can use it to generate several types of code snippets.
Live templates can be used to insert frequently-used constructs into your source code, for example, loops, conditions, various declarations, print statements, tags, and so on. To expand a code snippet, type the corresponding template abbreviation and press Tab. Keep pressing Tab to jump from one variable in the template to the next. Press Shift+Tab to move to a previous variable
I think this link is useful and also suggest that you read this link
for creating a new snippet you can go settings > Editor > Live Template

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.

Where is the live templates for Java in Intellij-IDEA?

I could not find the live templates for Java! Who can tell me how to set? Thanks.
They're inside all the nodes that are not specific to another language than Java: iterations, output, plain, surround, etc.
As JB Nizet wrote there is not a special node for Java (but you can create one). If you want your own Live Template for Java created do the following.
Open Settings window (File -> Settings)
Click on Editor -> Live Templates
Choose Template Group in which you want to add your Live Template
(you can create your own Template Group if you wish)
Click on + icon and choose Live Template
Specify the Abbreviation, Description and Template text.
Do not forget to define the context (in your case Java)
Example
Here is an example of how to create your own TODO text
Open the Setting window with Live Templates editor (as specified above).
Click on + icon and select Template Group.
Name this group Java.
Click on + icon again and select Live Template.
Specify your Live Template and DEFINE CONTEXT.
In my case writing mtodo and pressing enter will result in:
// TODO myName
You can even use variables. Write in your Template text e.g. $DATE$ and $TIME$
// TODO myName $DATE$ $TIME$
Click on Edit variables button and assign to each variable (defined by dollar sign) and expression (predefined function).
Now mtodo will result in
// TODO myName 13.10.2015 15:39
Predefined functions could be found here. The example was created using IntelliJ IDEA 15 EAP.
For those of you who have taken Postfix completion for Live templates, it is worth mentioning they are different. from not-choosing pretty good answers from #JB Niznet and #vitfo, I guess that's the case for OP writer. The document, here, says:
Postfix code completion is similar to live templates, it transforms the current expression without selecting it. For example, you can type .if after an expression to invoke the corresponding postfix completion and wrap the expression with an if statement.
You can check out a list of postfix completions:
Open the Preferences window
Click on Editor -> General -> Postfix completion
By default, there is no JAVA group in this setting page.
However, these default settings distribute on each feature group. For example, iterations:
IntelliJ IDEA 2019.2.4 (Ultimate Edition)