Change/Custom keyword in DataGrip

Answered

Is it possible to declare or modify list of keywords in DataGrip?

Problem is simple:

- Code style configured as "Code Style -> Quotation -> Identifier quotation = quote" (required cause schema, table names, columns... are case sensitive in my database)

- Dialect is PostgreSQL

When i run code adjusting (option+command+L) IDE recognize operator of string concatenation in PostgreSQL || as keyword and quotes it, breaking adjusts, line breaks and making it ugly each time to run find/replace.

I even tried fix it with macros - but macros is broken in case of find/replace feature.

3 comments
Comment actions Permalink

KoNEW,

Could you attach a sample query to reproduce the issue or file a new bug in our bug tracker with details?

0
Comment actions Permalink

Hi, base sample below

Before adjust

CREATE OR REPLACE FUNCTION "test" () RETURNS VOID
AS
$$
DECLARE
"v_var" TEXT;
"v_cur" REFCURSOR;
"v_val" INT;
BEGIN
"v_var" := '1' || '2';

BEGIN
OPEN "v_cur" FOR SELECT 1 FROM generate_series(1, 10);
LOOP
FETCH "v_cur" INTO "v_val";
EXIT WHEN NOT FOUND;
RAISE NOTICE 'val: %', "v_val";
END LOOP;

EXCEPTION
WHEN OTHERS THEN RAISE NOTICE 'exception reason: %', SQLERRM;
END ;
END ;
$$ LANGUAGE "plpgsql";

 

After adjust

CREATE OR REPLACE FUNCTION "test" () RETURNS VOID
AS
$$
DECLARE
"v_var" TEXT;
"v_cur" REFCURSOR;
"v_val" INT;
BEGIN
"v_var" := '1' "||" '2';

BEGIN
OPEN "v_cur" FOR SELECT 1 FROM generate_series(1, 10);
LOOP
FETCH "v_cur" INTO "v_val";
EXIT WHEN NOT "FOUND";
RAISE NOTICE 'val: %', "v_val";
END LOOP;

EXCEPTION
WHEN OTHERS THEN RAISE NOTICE 'exception reason: %', "SQLERRM";
END;
END ;
$$ LANGUAGE "plpgsql";

||/FOUND/SQLERRM - wrapped in quotes

Configs of style coding on screenshot (can send in email exported XML if it would be required)

0
Comment actions Permalink

I reproduced the issue and filed one in our bug tracker https://youtrack.jetbrains.com/issue/DBE-14912

0

Please sign in to leave a comment.