Author Topic: Lexar for PostgreSQL SQL (plpgsql)  (Read 586 times)

DanClark

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Lexar for PostgreSQL SQL (plpgsql)
« on: May 12, 2023, 04:07:42 AM »
Hi.  Many years ago, (about V1.0), I wrote the lexar for SQL Server.  Back then, it was just a file, formatted in a certain way to color code TSQL code.  After a while, SlickEdit used my file and integrated it into the SlickEdit editor and I happily let them support it.    Over time, I used several different code editors in combination with SlickEdit to used some of it's unique features.

Now I'm writing an app with a PostgreSQL back end.   It does not appear that SlickEdit can handle the plpgsql query language.   So I'd like to add that to SlickEdit.   Is there a utility that will allow me to do that?

Thanks,

Dan.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Lexar for PostgreSQL SQL (plpgsql)
« Reply #1 on: May 12, 2023, 02:00:40 PM »
You should be able to do it from within SlickEdit now.  The color coding is configurable within the editor, and allows nesting of token regexes.  See Tools -> Options -> Languages -> Database Languages -> PL/SQL -> Color Coding, and go to the Tokens tab and look at the Doc Comment entry for /*+ */ for an example of that sort of nesting.

So what you can do is:
1) Go to Tools -> Options -> Languages -> Language Manager  and click on Add Language
2) You'll get a dialog box allowing you to give a mode name, and file extensions.  You've got a couple of choices here. If you think PL/SQL is close enough to PL/pgSQL, you can choose to copy the settings from PL/SQL, and then you may have less work in editing existing color coding settings to match the Postgres language.  This would also give you smart indent, although small differences in the languages may make it so it may not recognize some contexts where it should be indenting.  On the other hand, if you want to start from a clean slate, then leave the "Copy settings from" checkbox unchecked.

Once it's created, you can add tokens to the color coding configuration, and when you open files with the extensions you associated with it, it should automatically go into your new language mode.