Обсуждение: automatic sql formating ?
Hi, just a thought ... Is there a way to extend the syntax highlighting to setting sql commands in upper ? E.g. you type " select * from mytable; " and the editor reformats it to SELECT * FROM mytable;
Le 02/10/2010 00:52, Andreas a écrit : > Hi, > just a thought ... > > Is there a way to extend the syntax highlighting to setting sql commands > in upper ? > > E.g. you type " select * from mytable; " > and the editor reformats it to > > SELECT * FROM mytable; > I keep getting asked to have that kind of functionalities. It would be a really great feature to add. It's also a really difficult one to code. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com
Le 02/10/2010 02:14, Andreas a écrit : > Am 02.10.2010 01:04, schrieb Guillaume Lelarge: >> Le 02/10/2010 00:52, Andreas a écrit : >>> Is there a way to extend the syntax highlighting to setting sql commands >>> in upper ? >>> >>> [...] >> I keep getting asked to have that kind of functionalities. It would be a >> really great feature to add. It's also a really difficult one to code. >> > But pgAdmin does right this everywhere on it's sql-fields e.g. when it > displays the create command for a table. So I suppose the algorithm to > parse sql code exists allready somewhere. > You're right. And as a matter of fact, it's quite easy. Here is the diff to handle this: diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp index 3cd5577..26cdb9c 100644 --- a/pgadmin/ctl/ctlSQLBox.cpp +++ b/pgadmin/ctl/ctlSQLBox.cpp @@ -114,6 +114,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons StyleSetFont(i, fntSQLBox); } + StyleSetCase(5, wxSTC_CASE_UPPER); + // Margin style StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour()); But I think we should have an option to activate this. I'm gonna work on it, unless someone wants to do it before :) > Probaply it's hard to do it on the fly in the editor. > A editor command would do, though. So one writes the code in the rough > and when it works push some key or icon and the text in the editor gets > reformatted. > > But this would be just something for the nice-to-have list. :) > Yeah, I added a ticket (#250) for this. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com
Le 06/10/2010 11:42, Guillaume Lelarge a écrit : > Le 02/10/2010 02:14, Andreas a écrit : >> Am 02.10.2010 01:04, schrieb Guillaume Lelarge: >>> Le 02/10/2010 00:52, Andreas a écrit : >>>> Is there a way to extend the syntax highlighting to setting sql commands >>>> in upper ? >>>> >>>> [...] >>> I keep getting asked to have that kind of functionalities. It would be a >>> really great feature to add. It's also a really difficult one to code. >>> >> But pgAdmin does right this everywhere on it's sql-fields e.g. when it >> displays the create command for a table. So I suppose the algorithm to >> parse sql code exists allready somewhere. >> > > You're right. And as a matter of fact, it's quite easy. Here is the diff > to handle this: > > diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp > index 3cd5577..26cdb9c 100644 > --- a/pgadmin/ctl/ctlSQLBox.cpp > +++ b/pgadmin/ctl/ctlSQLBox.cpp > @@ -114,6 +114,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID > id, const wxPoint& pos, cons > StyleSetFont(i, fntSQLBox); > } > > + StyleSetCase(5, wxSTC_CASE_UPPER); > + > // Margin style > StyleSetBackground(wxSTC_STYLE_LINENUMBER, > settings->GetSQLMarginBackgroundColour()); > > But I think we should have an option to activate this. I'm gonna work on > it, unless someone wants to do it before :) > Done. >> Probaply it's hard to do it on the fly in the editor. >> A editor command would do, though. So one writes the code in the rough >> and when it works push some key or icon and the text in the editor gets >> reformatted. >> >> But this would be just something for the nice-to-have list. :) >> > > Yeah, I added a ticket (#250) for this. > Commited. Thanks for your suggestion. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com
Am 14.10.2010 13:48, schrieb Guillaume Lelarge: >> I'm gonna work on it, unless someone wants to do it before :) > Done. :-) > Thanks for your suggestion. > Suggestions are nothing when there is noone who actually does the hard work. Thanks for your commitment. :) Will there be a 1.12.1 binary release or are there binary nightlies somewhere? Regards Andreas
Le 15/10/2010 09:45, Andreas a écrit : > Am 14.10.2010 13:48, schrieb Guillaume Lelarge: >>> I'm gonna work on it, unless someone wants to do it before :) >> Done. > > :-) > > >> Thanks for your suggestion. >> > Suggestions are nothing when there is noone who actually does the hard > work. > Thanks for your commitment. :) > You're welcome :) > Will there be a 1.12.1 binary release or are there binary nightlies > somewhere? > New feature, new release. So 1.14. There are no binary nightlies. You'll need to compile it if you want to use this new feature. -- Guillaumehttp://www.postgresql.frhttp://dalibo.com