Is it possible to turn off SQL highlighting in IntelliJ? - intellij-idea

It seems like IntelliJ is expecting strings to be escaped by the quote-char and not a backslash. Is there a way to change the SQL dialect here, or how can I get rid of the error squiggly in my editor?

You can right-click in the editor and select Change Dialect:
More details at https://www.jetbrains.com/help/idea/settings-languages-sql-dialects.html.

Related

VSCode language extension match parenthesis in quotes

I'm writing a language extension for lisp and have noticed a weird behavior. If I have something like this,
( "(" a b )
VSCode will match the closing parenthesis with the one in quotes. If I have the cursor between the a and the b and do an expand selection, it selects from the quoted open parens to the closing parens.
What controls this behavior? How do I get it to ignore the one in quotes?
I've tried messing with different settings in language-configuration.json, but nothing has worked so far. The only other thing I can think of would be the wordPattern regex, which I copied from somewhere. It's currently set to,
"wordPattern": "[^:()# \t\n\r][^:() \t\n\r]*"

How do I stop SQL splitting string literals when I press Enter in DataGrip or IntelliJ Database Editor?

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

escaping xml in intellij 14

in Intellij, I'm looking for a single keystroke method to transform escaped XML to XML and vice versa I've looked at macros with a file find/replace but they are not doing what I need - any suggestions?
e.g.
<Alpha>
<Beta>3030</Beta>
<Beta>3030</Beta>
</Alpha>
TO
<Alpha>
<Beta>3030</Beta>
<Beta>3030</Beta>
</Alpha>
Take a look at this plugin, it can do what you want and much more in terms of escaping and string manipulation in general.
You can bind some custom shortcut to Escape XML and Unescape XML actions. Or you can hit SHIFT+ALT+M and then 8 to escape or SHIFT+ALT+M and then 9 to unescape by default.
It's probably not the exact solution you're looking for, but hopefully it will help.

Format TSQL onto one line

Our company uses an old app which reads TSQL from a .INI file. Due to how the app process the INI file the TSQL has to be all on one line. I use Poor Mans TSQL Formatter to get everything nice and tidy for things like SPs, but am wondering if there's something out there to do the reverse - take nicely formatted TSQL and shove it all onto one line (removing carriage returns , line breaks etc).
I'm working in SSMS but also use Notepad++, and will happily use some other editor if it has the functionality.
Using Notepad++ (Without any plugin)
After lot's of googling I found that there are no plugins like TextFX and PoorMansTSqlFormatter are available in x64 bit version of notepad++ even not needed.
Notepad++ --> Write Query --> Edit --> Blank Options --> Remove Unnecessary Blank and EOL.
That's it.
Using Notepad++
Select the statement that is over multiple lines then on the menu: TextFX>TextFX Edit>Unwrap Text
And for even greater ease you can assign it to a keyboard shortcut using the shortcut mapper (Settings>Shortcut Mapper)
You can use the minify comment to remove all the unnecessary space in the Poor Mans TSQL Formatter
[minify]
[/minify]
I like Martin's answer and that is probably the way to go. But I'll point out that you can just use string manipulation to turn carriage returns and line feeds into spaces. This is particularly easy in the later versions of SSMS that enable limted use of regex in the find/replace dialog.
In SQL Server 2012:
Highlight the selected text and use 'Find and Replace' (ctrl + h)
Check: use Regular Expressions
Find: \n
Replace with: LEAVE BLANK

PHPStorm disable html-syntax highlighting in PHP string

In PHPStorm 3.0, a PHP string like:
$sString = '<div><span class="someClass">test</span></div>';
has HTML Syntax / opening and closing brackets highlighting.
I would like to disable this behavior and display it as a string only.
Anyone figured out where I can change this?
Alt+Enter on the string, Un-inject Language: