IntelliJ IDEA code completion not work in Node app as Java - java

I just started to learning Node.js and I prefer to use the same IDE (IntelliJ IDEA) that I use for a long time. However, some code completion features does not seem to work.
For example:
In java, when I write something like System.out.println(getName()) and press semicolon when the cursor (|) is on System.out.println(getName()|) it add semicolon at the end of the statement.
However, when I write something in a node project on app.js file console.log(files) and press press semicolon when the cursor (|) is on `console.log(files|), it adds semicolon to the current cursor position instead of at the end of the statement.
So, how can I make IntelliJ to behave as it is on a Java file?
I tried some settings as on the screenshot, but does not make any sende :(
enter image description here

Please vote for WEB-54481 to be notified on any progress with it

Related

IntelliJ method name wrapping

Hy all,
In IntelliJ I have set the "Hard wrap at" limit to 100 lines and want all lines that are longer then that to be wrapped by IntelliJ (including Indentation of course) when I reformat the file.
This works for everything except long method names in one of my interfaces (Note: Purple underline is checkstyle which also says its too long):
This alone would not be a huge issue, I can just make a line break myself.
The main issue is, that a manual line break puts the method name on the same indentation level as the method description (which again checkstyle correctly does not like) and when I indent it manually, a reformat of the file moves the line back to this level. So IntelliJs reformat file moves it to the wrong location.
Does somebody have any idea, which setting this is and what I have to change to at least have the correct indentation and at best also the corret wrapping?
Greets
Chris

Eclipse doesn't split string at line width when formatting

I'm currently working on an application in Eclipse where I'm running a really huge SQL statement that spans about 20 lines when splitting it in notepad to fit on the screen. Thus I want the string for the query also to be formatted somewhat more readable than a single line. All the time autoformatting normally worked when I used Eclipse but somehow now neither Ctrl + Alt + F nor rightclicking and selecting the "Format" option from the menu doesn't work to get a line break after a certain amount of characters.
I already checked the preferences where I already tried running my own profile with 120 and 100 characters line width but that didn't fix anything so far. I really don't know why Eclipse won't let me format this anymore. Normally Eclipse would be splitting the string into several lines in this case but I don't really know why this doesn't work anymore.
However other formatting is being fixed when executing autoformatting (e.g. if(xyz){ still becomes if (xyz) {.
Thank you for your help in advance.
As far as I can tell, autoformat as you described was never supported (at least as far back as 2008). And I have been using Eclipse much longer than that
You can do one of several things.
Simply insert the cursor in the string and hit a return.
Toggle word wrap Alt-Shift-Y
Try writing a regex to do what you want(not certain if this will work).

How to set color of Java comment in latex/Lyx?

I need to insert Java/Android code into Latex/Lyx, and I would like to highlight Java comments with a certain colour. I have done it earlier in the document, but now when I try the same code, it is not working for some reason. One difference between the codes are, that the one I'm now trying to insert is Android Java-code, and the former was pure Java, could that have an affect? The settings I'm using in the both cases are these:
\def\listingsfont{\ttfamily}
\lstset{language=Java}
\lstset{basicstyle=\ttfamily\scriptsize}
\lstset{keywordstyle=\color{blue}\ttfamily}
\lstset{stringstyle=\color{red}\ttfamily}
\lstset{commentstyle=\color{green}\ttfamily}
\lstset{breaklines=true}
\lstset{tabsize=2}
\begin{lstlisting}[frame=single] % Start your code-block
So first time working, second time not any more. What happens is, that all comment marks (//) appear as blue, but only the marks, not the whole comments with them. Strings are highlighted correctly.
EDIT: I have gained some new information what is happening. After the first time, when this code was working, I have a latex code where language is set as R. If I insert this code before the code that is written in R, all is working as it should. But if I insert the code after the code that is written in R, then it is no longer working. So something weird happens there.
EDIT2: For testing purposes, I changed the settings for the R-code as (language=Java). What happened was, that after that, all the Java code in the latex appeared correctly. So apparently, setting language as R breaks Lyx/Latex somehow to not being able to highlight other languages.
If you use \lstset, this is the default for the whole document. Try setting the language of each listing in LyX separate instead (through the settings you reach in the context menu of the program listing)

Intellij IDEA: equivalent of Eclipse's "Complete Current Statement" (Ctrl+Shift+Enter)?

I've been using Intellij IDEA, now switched to Eclipse. And I'm looking for an alternative for Ctrl+Shift+Enter in Eclipse which completes the current statement by putting semicolon and goes to the next line. However, when I use this shortcut in Eclipse it goes to the upper line. How can I change the settings to match with Intellij.
I'm using Intellij key schema for Eclipse.
Found an equivalent plugin for eclipse here
https://marketplace.eclipse.org/content/complete-current-statement-eclipse
Only issue I found so far is that it does not obey the code formatting rules. (I like placing curly braces on new line for if statements). Otherwise seems to be similar to the IntelliJ version.
Is this Feature present in Eclipse ( at least even as a plugin will be fine ) . I use Ctrl+Shift+enter in IntelliJ a lot . Some of the things it will do are
if it is normal statement then it will format the current line and add semicolon ( also the cursor position will be end of the line )
if it is a loop/conditional like for,if etc
if -> if ([cursor position]) { } -> if() { [cursor position]}
[ -> means ctrl + shift + enter command ]
If statement is already completed then it will format the current line and goes to next line indented position.
people might think these things are very trivial/not important but only when you try to use this you will find how useful this small feature will be and how much you miss in eclipse .

Eclipse shortcut to insert variable in string literal

When I need to interpolate a String variable into a quoted string literal in the Eclipse java editor, I generally type "++" and eclipse usually inserts another " after the latter one, so I then have to go past it with arrow keys and then backspace to remove the duplicate, then go insert some spaces in between the "++" and type my variable name.
This seems like a lot of work. I have found Practically Macro, but I thought there might be something built in for this situation which is very common for me.
I'm not sure if this shortcut exists, try doing CTRL+SHIFT+L when the string is selected.
Also there is this link which has a whole bunch of nice keyboard shortcuts, I know it may not answer the question completely but maybe it'll get you one step closer. :)
**** Edit: In that link the "Ctrl-2 something" post looks promising.****
The most relevant built-in feature is maybe the "Pick out part of a string" quick assist:
insert a space (or anything else) where you want to add a variable,
select it,
press Ctrl+1,
select the "Pick out part of a string" quick assist,
insert your variable name.
Reference: "Pick out part of a string" section in this post.

Categories