When programming in Go, I tend to use assignment statement using the operator := often.
But I find it difficult to type these two characters :=. Is there any short cut or a autocomplete way to type := ?
GoLand or IntelliJ IDEA with Go plugin has a handy shortcut to declare a new variable:
Type : where do you want to define a variable.
Press Tab to apply Live Template.
You can configure an abbreviation or expand shortcut via Preferences/Settings | Editor | Live Templates | Go | Variable declaration.
Related
IDEA have function for find and replace text in file (Ctrl + R) and supports regular expressions.
For example I write replace 1 to 2 and after this I need do it again, but I don't want write every time to fields what I want to replace.
Can I save it in list like live templates or bind on some key?
When my cursor is after an open quote in a SQL statement in an IntelliJ database console and I press Enter, it closes the quote on the current line and adds a concatenation symbol with an open quote on the newline.
I disabled formatting the SQL code style settings but that didn't fix it for me.
UPDATE blah SET blah2 = 'something<pressed enter>' ||
'<argh!>...';
Is there a way to disable this autoformatting?
This request was addressed in 2017.1 version, as a result, Insert string concatenation on Enter setting was added specifically for SQL:
This can be archived since IntelliJ 13. You simply need to wrap your code with
// #formatter:off
your code goes here
// #formatter:on
Since IntelliJ Idea 15-16(pardon if i'm wrong), you can also make permanent set up by Preferences > Editor > Code Style option
Hope it helps
When I select some text, for example form-col and press [ I want to get [form-col] but WebStorm replace selected text with [. Is there a way to configure it?
I don't think that functionality exist. However you can use the Live template functionality. It's very useful and it does pretty much the same thing.
To do this, go on : [File]->[Settings]->[Editor]->[Live Templates]->user, Click button + and add a live template like:
In you html file when you write the abbreviation what you are added, press Tab and it generate you [] and place the cursor after the first [and now you can write your html tag [form-col]
Settings/Preferences
Editor | General | Smart Keys
Ensure that Surround selection on typing quote or brace option is enabled
I am coming from Dreamweaver into PhpStorm 8.0.2 (on Windows 8.1).
How do you set it up so that when selecting a variable, you do not select the dollar ($)? This needs to include variables separated by underscores.
I have tried the various settings to do with CamelHumps, and had mixed results, but still not ideal.
For example, double-clicking the variable $foo_bar, I would like it to select foo_bar.
With "Honor CamelHumps", it will select $foo_bar.
Without "Honor CamelHumps", it will select foo or bar depending on which word you double-click on.
File | Settings | Editor | General | Smart Keys | PHP -> Select variable name without '$' sign on double click
It's now fixed - there is an option to allow selecting of $ in variable names - see https://stackoverflow.com/a/42624161/4879058
you should click exactly underscore sign when double clicking to select foo_bar
I have the following gray line that limits the number of characters a single line can accomodate:
I'd like to change the line length (this fill probably affect where this line is currently shown right now) for different files: for js, php files etc one line length, for HTML template files another. Is it possible? If not, how can I change at least for all file types?
This is now possible as the bug linked by #LazyOne has been resolved. You can now set different right margins for different programming languages.
The setting is under Settings | Editor | Code Style | <Your language> on the Wrapping and Braces tab at the very top of the list.
Default value can be set at
Settings/Preferences | Editor | Code Style --> Right margin (columns)
Since end of 2014 (after IDEA-59662 ticket was implemented) most languages have an option to adjust that value in language-dedicated section. For example: PHP
For unsupported languages .. or those that do not have such option -- you may try going with .editorconfig file and EditorConfig Support plugin -- should work.
For those who are from 2018:
Settings/Preferences | Editor | Code Style | Hard Wrap At
Or Settings/Preferences | Editor | Code Style | Your Technology(ex. PHP) | Hard wrap at