VSCode Inline completion won't show up if there are some trailing text in the line? - vscode-extensions

This one works. Example from vscode-extension-samples.
But won't show up if there are some trailing text in the line.
How to make it display in spite of trailing text? Is there something I'm missing?

Related

Intellij change line spaces

When I add a space for the same code line it has 9 spaces, is there a way to change this? The first image is how I have it and the second is how I want.
In Settings > Editor > Code Style > Java:
Under Tabs and Indents you can change your desired indentations.
I think the 'Use indents relative to expression start' option might do what you are looking for, I am not sure.

How to remove all whitespace from a text file

I am trying to remove all whitespace using Intellij IDEA Ultimate 2019.1.2. I have a simple text file with json data.
I've tried using find and replace with regex enabled, but to no avail.
You can press the CTRL + R to open the replace panel, and enter a whitespace in the first input field, leave the second input field empty.
Then click the replace all button.
If you want remove all whitespace including line break, you can enter \s and enable the regex option.

Intellij IDEA 14 - remove indents on empty lines

I have an annoying bug regarding intellij 14.0.3. The issue is that it keeps indents on empty lines and I can't remove that whitespace in any way. Under code style, I have not checked the checkbox "keep indents on empty lines" and judging from the display how that functionality works I'd say it would do it.
However, it still keeps the indents and that creates bad diffs in git since whitespace is added. Is this a bug? Can I in any way remove them? I have tried to uncheck that checkbox under both the language I use and the main one. None of them seems to change it.
Try enabling the Strip trailing spaces on save option in Settings/Editor/General.
You can choose whether this should be performed for All lines or only the lines you modify to avoid creating unnecessary diffs.
The whitespace is stripped when you explicitly hit CTRL+S or automatically after some period (IntelliJ has autosaving).
One thing to note is that if you have cursor on an empty line and there are some spaces before it, hitting CTRL + S won't strip the whitespace, because this would probably be annoying as your cursor would jump to the beginning of the line if the file was autosaved by IntelliJ (I read somewhere on YouTrack that this was a design decision).
Here is a screenshot of the option I describe:
What I did to strip spaces without having to open & save each file is running a regex in the find and replace window:
Ctrl+Shift+R
Text to find ^ +\n Find every line that starts with (^) one or more spaces ( +) and nothing else (/n).
Replace with: \n A new line.
General > Regular expression (obviously important to check this box)
Eventually you may want to limit the scope because this will be quite the lengthy operation
Find and eventually continue if IDEA warns for the high amount of occurrences.
Click All Files to run the actual replace operation. It might take some time before IDEA to respond.

Intellij Idea Code wrapping when formatted

I am new to Intellij Idea. I didn't find any information on how to wrap the code after certain characters (ex: 150 characters, break the line)
I want to break the code after the vertical line, the following code must come in next line.
Note: I used Reformat code option, but it did just realigned the code with some white spaces etc, but not wrapping up the code. It's difficult to see the end of the code.
You go to Settings (alt+ctrl+s) then select Code Style - General
Here you can configure your margins and if you want the code to wrap after it reaches the end of it

controlP5 textfield contents. Processing

I have a sketch in processing I am working on which contains a textfield and a submit button. When the submit button is pressed, a file with is created using the name given in the textfield. I want to make sure something has been entered into the textfield when the submit button is pressed, however, it appears that by default the string is not empty or contain white space and is not caught by if statements.
Is there any simple way to check that something has been entered in the text field without needing to resort to something like regex?
I am not sure I understood whether by default your string is not empty and also does not contain white space (which would make it an odd example). The best possible check I can think of is to trim whatever the entered string is and then check if it is empty:
if(enteredString.trim().length() > 0) println("The string is valid");
the trim() method trims leading and trailing spaces, so if there are only spaces they will be removed making the string empty. Also, since you are saving files you might want to check for invalid characters. With Processing (Java) you don't necessarily have to resort to regex since you can do stuff like these:
String s = "ashd/ah";
println(s.contains("/"));
println(s.replace("/","-"));
which will print:
true
ashd-ah