Worksheet Editor bringing last character to newline when typing too fast - oracle-sqldeveloper

When i'm writing sql in sql developer and typing out a query quickly and do a new line, it'll bring the last character over to the new line and put my cursor behind the character.
SELECT *
SELECT
//cursor is here *

Related

SQL developer shortcut of duplicate line

When I'm using shortcut ctrl+shift+D to duplicate line, sometimes the new line will be created in the next line, but sometimes it just append in the same line. I just want to it always to be created in the new line.
Well, it depends on your selection. If your selected line containes a new line character then duplicated line will be the new line else duplicated text will be created as a continuation of the same line:
if you select the line below (without CR)
select
result of duplication will be
selectselect
if there is a new line char at the end of your line and
your selection captures it too
select
then the result will be
select
select
Regards...

In VSCode, how can I turn a multi-line comment into a paragraph with no line breaks?

What's an easy way to convert a multi-line comment (e.g. JSDoc with each line separated by line breaks) into a paragraph without any line breaks that I can copy into an email or another document?
I know I can use search & replace with regular expressions, but is there a more ergonomic way to do it?
You probably knew that you can use multiple cursors to change multiple lines at once, but did you know you can also use them to remove line breaks? Assume you start with this comment:
/**
* Returns a new `Temporal.LocalDateTime` instance representing the first
* valid time during the current calendar day and time zone of `this`.
*
* The local time of the result is almost always `00:00`, but in rare cases it
* could be a later time e.g. if DST starts at midnight in a time zone. For
* example:
* ```
* const ldt = Temporal.LocalDateTime.from('2015-10-18T12:00-02:00[America/Sao_Paulo]');
* ldt.startOfDay; // => 2015-10-18T01:00-02:00[America/Sao_Paulo]
* ```
*/
First part: use multiple cursors to remove the prefix characters on each line.
Click on the upper-left corner of the comment (the /**).
Now hold down Cmd+Shift (Alt+Shift on PC) and click after the */ on the last line of the comment section.
This will create a columnar, multi-line selection that includes the non-text prefix characters on each line. If the selection doesn't include all the prefix characters, you can hold down the Shift key and use the left or right arrow keys to adjust the width of the selection.
Press the Delete key to remove prefix characters on all lines.
Second part: it's time to delete the line breaks and replace them with spaces. I discovered today that you can use multiple cursors for this part too!
After you've deleted the prefix text above, but before you've pressed any other keys, press the backspace key. It will delete the line breaks but leave each cursor in the same place!
Type the spacebar once to insert one space to replace each line break.
Press ESC to clear multiple selections, and delete the extra space at the start of the line. You may have an extra space(s) at the end of the line too that may need trimming.
Copy the resulting one-line text.
Use Cmd+Z (Ctrl+Z on Windows) to undo the last few changes so your code comment will be back to normal.
Now you can paste the copied text into an email!
The same solution works to replace line breaks with spaces in any multi-line text, not only code comments.
I'm sure that many of you already knew how to do this trick, but I found it so easy and so cool that I thought it was worth sharing as a Q&A here so others can learn about this trick too.
Here's what the steps look like in the VSCode IDE:
Before deleting, you should see something like this:
After deleting prefix characters:
After deleting line breaks (note the multiple cursors are still there):
After inserting spaces in place of the deleted line breaks:
I usually select the first line break, then hit/hold command+D repeatedly to add cursors at all line endings I want to edit. Then, just hit space once.

vscode multicursor reorder lines how to

I am finding a common issue I have with vscode multi-cursor editing mode is how to deal with "fields" of different lengths. To give an example:-
I have an sql file which contains multiple lines of the form
INSERT INTO settings (name,value) VALUES('key_for_value', 'value_to_set'); -- a comment about this setting
Which I want to turn into
UPDATE settings SET name = 'value_to_set' WHERE name = 'key_for_value'; -- a comment about this setting
Obviously each 'key_for_value' and 'value_to_set' are different lengths in each line.
Its fairly easy to grab a bit of the first line of INSERT INTO... and with a control-D get multiple cursors from there, and edit the lines to to get to UPDATE settings SET name = but then I am stuck - I can't find a key binding to (for instance) jump to the next comma - then start a selection and jump the next closing round bracket. I could then do a multiline cut, move the cursor back to start of line, more forward to after the = sign and do a multiline paste.
Is this sort of thing possible?
you can do it with a regex search replace
Search for
INSERT INTO (\w+) \((\w+),(\w+)\) VALUES\('([^']+)', '([^']+)'\);(.*)
replace with
UPDATE $1 SET $2 = '$5' WHERE $2 = '$4';$6

How to Find or Replace New Line Character in ORACLE SQL Developer

When I press Ctrl + F in SQL Developer the Find/Replace tool comes up. I need to replace a new line with ',' . I can't figure out how to search for a new line. In SSMS I could hit Ctrl+F and enter \n in the find or replace field if I wanted to find or replace a new line. How do I do this with ORACLE SQL Developers Find and Replace tool?
When you open Find/Replace, then:
enter \n into the search field
enter , into the replace field
push the Regular expresssion button in the toolbar (it is 4th in my 18.3 version, after Match Case, Whole word, Highlight)
push the "Replace all" button in the toolbar

Eclipse shortcut to select or remove all spaces up to (but excluding) the next word

For years I was working with Netbeans and the following is one of the very few features that I cannot find in eclipse:
How can I select or remove all trailing or preceding spaces up to (but excluding) the next or previous word respectively, in one keystroke combination.
In netbeans Ctrl+Shift+Right / Ctrl+Shift+Left and Ctrl+Backspace / Ctrl+Delete would just do this.
In eclipse,
Shift+Ctrl+Left = Select previous word
Shift+Ctrl+Right = Select next word
Use Ctrl+Right or Ctrl+Left = To jump to end or start of a word.
Then pressing
Shift+Ctrl+Right or Shift+Ctrl+Left twice selection will select white spaces between two words.