Hi all,
Is there any way to get the udl files used to build SQL and PL/SQL code intel? I use PL/SQL a lot and would like to enhance the CI's support for it (and for sure give back to the community)?
@gsalem: Are you talking about *syntax coloring* or some of the full-blown codeintel features (like autocomplete/calltips, showing up in the code browser, etc.)?
.udl files just define the lexing of content for syntax coloring. For codeintel support you need to define a number of pieces (which can be a fair amount of work).
Some notes:
- Currently SQL syntax coloring in Komodo is *not* using the UDL system. The SQL lexer is pure C++ code (part of the Scintilla project).
- Currently these isn't any codeintel support for SQL so the support files for this would have to be started from scratch -- though I'm happy to try to help you along with that.
Thanks for the reply.
As the subject says, I'm mainly interested in syntax coloring. As I'm only using the editor (and not the IDE) for writing SQL and PL/SQL code, it would be nice to have syntax coloring.
I'll begin by trying this using the udl for other languages, and see where I can go.
If you have any sample files for codeintel support that I can start with, that would help a lot.
Hi,
I tried creating a udl file for PL/SQL syntax coloring, It seems to have a bug somewhere. It would be fantastic if you can help me figure it out. Can I email it to you (and where)?
Now install the XPI into Komodo -- I drag it from the File manager onto
Komodo, and Komodo will bring up the extension installer automatically.
Restart Komodo, and create a ".pssql" file. I chose this extension,
because the builtin SQL lexer is configured to handle .sql files.
It handles the keywords in your UDL file correctly, but only when
they're upper-case.
UDL currently doesn't support case-insensitive keywords outside markup.
This is because all the languages in Komodo's core feature set use
case-sensitive keywords (namely Perl, Python, Ruby, Tcl, JavaScript).
It wouldn't be too hard to add case-insensitive keywords to UDL, but it
isn't near the top of the priority list.
I am using Komodo 4.3.2 build 1263 on Windows XP. I have a strange problem: the colors erratically disappear. I am editing a 165 lines long SQL script. The first 60 lines are correctly colored, but in the last 100 lines, the SQL keywords aren't recognized any more. Strings and numbers are colored, though.
If I edit anything (like adding a new line or a blank) in any of the first 60 lines, the colors disappear from the line above the line I edited and all lines below. The only way to restore colors (until line 60) is to add a new line before or after the very first line. If I create a new edit tab and paste the whole script in it, it is completely colored.
The coloring does not stop at the end of a statement, I sometimes get the SELECT colored, but not the FROM or not the WHERE.
The line 60 limit seems isn't stable: when I started editing this file, I managed to get 100 lines colored, but I can't reproduce this any more.
I got this behaviour sometimes, what I found out is that if I use the menu to tell komodo that the file is a pl/sql, it properly highlights all the file.
I'm not sure the problem is in my extension, as it does not by itself do any highlithing, it's just a declaration of the things to highlight.
... but coloring breaks as soon as I change anything in the source. Not really user-friendly :-) I edit also some php with Komodo and I never saw this issue elsewhere. But you are right, I don't see how a template mistake could trigger such a bug.
which is probably what is going to happen, I suggest you post a bug report to Komodo. I think you are in a better position to tell them it is a Komodo bug than I am.
BTW, I found a more user-friendly workaround: I use the built-in SQL language setting. I hadn't found it before (I don't know how I missed the "Other" sub-menu), but it suits my needs. Thanks for making me discover it. The built-in PL-SQL language setting does not work at all for me. Did they mean something else than PL/SQL or is this a bug?
This is not the usual lexer that does this, and it only supports SQL, not the Oracle full set of reserved SQL and PL/SQL words. That's why I wrote mine.
I just sent my source file to activestate support asking for help. I think the problem is in there, but being a novice could not find it.
I will update this thread when I make some progress
The "PL/SQL" support that ships with Komodo is a combination of
the LexSQL.cxx lexer that comes with Scintilla, and the
koSQLLanguage.py language service that we wrote (and you can find
in /lib/mozilla/components/koSQLLanguage.py).
I'm only looking at the source, but
it looks like it does folding on comments, ( ... ), and the BEGIN/
LOOP/IF ... END constructs. If the main difference is that you
want it to handle the extra keywords, you can add them to
the list of keywords in class koSQLLanguage.py::koPLSQLLanguage
-- watch out, this file defines classes for both koSQLLanguage
and koPLSQLLanguage.
I will have a look at the UDL file, as I'm curious whether the
problem is in the UDL itself or the engine, but it seems to me
that we should add this list of keywords to the existing
language service.
Is there anything else you're looking for in PL/SQL editing?
Is there a good reason why the PL-SQL lexer behaved as a test lexer for my SQL script? I thought a PL-SQL lexer should recognize the standard SQL keywords.
Which PL-SQL lexer do you mean? The one that ships with Komodo, or the one
that gsalem wrote?
I'm not an expert on SQL, but my understanding is that there's a core
set of keywords, and then each vendor has extended the language in
their own way. Could you list any keywords that are missing?
There are problems with the existing koSQLLanguage.py file:
There is no extension for PL/SQL files. I've added "*.plsql"
There is no color scheme at all for PL/SQL files. I've
refactored the class so *.sql and *.plsql files share the
same scheme.
The synonym for "REM" comments wasn't handled, so I added that,
using Scintilla's "InListAbbrev" functionality, so any prefix
of "remark" beginning with "rem" will match, case-insensitively.
gsalem, I'll email you the new koSQLLanguage.py I'm about to check in,
could you tell me if it works?
GSalem tested the new koSQLLanguage.py module, and reports that it's working fine.
I have to admit that we in the Komodo group don't have much experience with
Oracle. MySQL, Postgres, SQLite, and even ODBC/Access, yes. We figured that
the PL-SQL module was working fine in the field, since no one had complained.
After a quick look, I saw it was flawed, and not just in the way it's missing
a few hundred keywords.
We'll be shipping the fixed version in the next alpha of Komodo 4.4, both IDE
and Edit.
As for the question about code-completion that started this discussion, with
over 1100 keywords in the language, I can see simple three-character completion
like we have for many other languages might deliver enough.
Hmmm, maybe raising that subject doesn't close this thread. Please reply on
other kinds of completion you'd like to see.
Hi,
it would be very nice to have, although not a big issue. What would be much better is code folding. I started looking at other .py to see how it can be done. Surely you're more knowledgeable than myself to do it. But if I can help in any way, just drop me a note.
I looked at the lexer, and it looks like it's making the right noises about
supporting folding. Then I had a look at the language service file
koSQLLanguage.py, and saw this line:
self._lexer.supportsFolding = 0
I changed the '0' to a '1', restarted Komodo, and it's folding fine.
@gsalem: Are you talking about *syntax coloring* or some of the full-blown codeintel features (like autocomplete/calltips, showing up in the code browser, etc.)?
.udl files just define the lexing of content for syntax coloring. For codeintel support you need to define a number of pieces (which can be a fair amount of work).
Some notes:
- Currently SQL syntax coloring in Komodo is *not* using the UDL system. The SQL lexer is pure C++ code (part of the Scintilla project).
- Currently these isn't any codeintel support for SQL so the support files for this would have to be started from scratch -- though I'm happy to try to help you along with that.
Thanks for the reply.
As the subject says, I'm mainly interested in syntax coloring. As I'm only using the editor (and not the IDE) for writing SQL and PL/SQL code, it would be nice to have syntax coloring.
I'll begin by trying this using the udl for other languages, and see where I can go.
If you have any sample files for codeintel support that I can start with, that would help a lot.
regards
Hi,
I tried creating a udl file for PL/SQL syntax coloring, It seems to have a bug somewhere. It would be fantastic if you can help me figure it out. Can I email it to you (and where)?
thanks in advance
Feel free to send it to support [at] activestate [dot] com as an attachment, we'll take a look at it.
--
JeffG
Here's the process I followed:
1. cd "c:/Program Files/ActiveState Komodo IDE 4.2/lib/sdk", read the README.txt file, do what it says about setting up path variables. 2. cd to my own experimental area -- I call this ~/lab/komodo/play Make a "pssql" directory. 3. Run these commands > koext startext pssql > cd pssql > koext startlang pssql --ext .pssql Finish udl/pssql-mainlex.udl -- with one change, I appended your UDL file to the rest of this file. The only change I made was to comment out the line "language OracleSQL". > koext build You should see output like this: koext: running 'rd /s/q build' koext: mkdir build\components koext: running 'copy /y components\kopssql_UDL_Language.py build\components' 1 file(s) copied. koext: mkdir build\lexers yacc: Generating SLR parsing table... yacc: 59 shift/reduce conflicts koextlib: compile `udl\pssql-mainlex.udl' to `build\lexers\pssql.lexres' koext: mkdir build\xpi koext: running 'copy /y install.rdf build\xpi' 1 file(s) copied. koext: running 'xcopy /e/i/y/q build\components build\xpi\components' 1 File(s) copied koext: running 'xcopy /e/i/y/q templates build\xpi\templates' 2 File(s) copied koext: running 'zip -r pssql-1.0.0-ko.xpi *' in 'build\xpi' adding: components/ (232 bytes security) (stored 0%) adding: components/kopssql_UDL_Language.py (152 bytes security) (deflated 63%) adding: install.rdf (152 bytes security) (deflated 60%) adding: templates/ (232 bytes security) (stored 0%) adding: templates/All Languages/ (232 bytes security) (stored 0%) adding: templates/All Languages/pssql.pssql (152 bytes security) (stored 0%) adding: templates/Common/ (232 bytes security) (stored 0%) adding: templates/Common/pssql.pssql (152 bytes security) (stored 0%) koext: running 'copy /y build\xpi\pssql-1.0.0-ko.xpi pssql-1.0.0-ko.xpi' 1 file(s) copied. 'pssql-1.0.0-ko.xpi' created.The lexres file didn't get into the xpi, so we'll do that by hand:
> cp -r templates install.rdf build # msys/cygwin cmd because xcopy is broken
> cd build
>zip -r pssql-1.0.0-ko.xpi components install.rdf lexers templates
adding: components/ (232 bytes security) (stored 0%)
adding: components/kopssql_UDL_Language.py (152 bytes security) (deflated 63%)
adding: install.rdf (152 bytes security) (deflated 60%)
adding: lexers/ (232 bytes security) (stored 0%)
adding: lexers/pssql.lexres (152 bytes security) (deflated 62%)
adding: templates/ (232 bytes security) (stored 0%)
adding: templates/All Languages/ (232 bytes security) (stored 0%)
adding: templates/All Languages/pssql.pssql (152 bytes security) (stored 0%)
adding: templates/Common/ (232 bytes security) (stored 0%)
adding: templates/Common/pssql.pssql (152 bytes security) (stored 0%)
# This is what you should see:
>unzip -l pssql-1.0.0-ko.xpi
Archive: pssql-1.0.0-ko.xpi
Length Date Time Name
------ ---- ---- ----
0 01-21-08 14:09 components/
1826 01-21-08 14:03 components/kopssql_UDL_Language.py
1029 01-21-08 14:12 install.rdf
0 01-21-08 14:09 lexers/
14855 01-21-08 14:09 lexers/pssql.lexres
0 01-21-08 14:12 templates/
0 01-21-08 14:12 templates/All Languages/
0 01-21-08 14:12 templates/All Languages/pssql.pssql
0 01-21-08 14:12 templates/Common/
0 01-21-08 14:12 templates/Common/pssql.pssql
------ -------
17710 10
Now install the XPI into Komodo -- I drag it from the File manager onto
Komodo, and Komodo will bring up the extension installer automatically.
Restart Komodo, and create a ".pssql" file. I chose this extension,
because the builtin SQL lexer is configured to handle .sql files.
It handles the keywords in your UDL file correctly, but only when
they're upper-case.
UDL currently doesn't support case-insensitive keywords outside markup.
This is because all the languages in Komodo's core feature set use
case-sensitive keywords (namely Perl, Python, Ruby, Tcl, JavaScript).
It wouldn't be too hard to add case-insensitive keywords to UDL, but it
isn't near the top of the priority list.
Hope this helps.
It worked like a charm
Question as above - could you please publish this PL/SQL extension?
Just did the upload
I've just installed it.
If you have any problems with it, just leave me a note, I'll try my best
Hello
I am using Komodo 4.3.2 build 1263 on Windows XP. I have a strange problem: the colors erratically disappear. I am editing a 165 lines long SQL script. The first 60 lines are correctly colored, but in the last 100 lines, the SQL keywords aren't recognized any more. Strings and numbers are colored, though.
If I edit anything (like adding a new line or a blank) in any of the first 60 lines, the colors disappear from the line above the line I edited and all lines below. The only way to restore colors (until line 60) is to add a new line before or after the very first line. If I create a new edit tab and paste the whole script in it, it is completely colored.
The coloring does not stop at the end of a statement, I sometimes get the SELECT colored, but not the FROM or not the WHERE.
The line 60 limit seems isn't stable: when I started editing this file, I managed to get 100 lines colored, but I can't reproduce this any more.
I got this behaviour sometimes, what I found out is that if I use the menu to tell komodo that the file is a pl/sql, it properly highlights all the file.
I'm not sure the problem is in my extension, as it does not by itself do any highlithing, it's just a declaration of the things to highlight.
regards
... but coloring breaks as soon as I change anything in the source. Not really user-friendly :-) I edit also some php with Komodo and I never saw this issue elsewhere. But you are right, I don't see how a template mistake could trigger such a bug.
to see if there are any mistakes I've done in there
which is probably what is going to happen, I suggest you post a bug report to Komodo. I think you are in a better position to tell them it is a Komodo bug than I am.
BTW, I found a more user-friendly workaround: I use the built-in SQL language setting. I hadn't found it before (I don't know how I missed the "Other" sub-menu), but it suits my needs. Thanks for making me discover it. The built-in PL-SQL language setting does not work at all for me. Did they mean something else than PL/SQL or is this a bug?
This is not the usual lexer that does this, and it only supports SQL, not the Oracle full set of reserved SQL and PL/SQL words. That's why I wrote mine.
I just sent my source file to activestate support asking for help. I think the problem is in there, but being a novice could not find it.
I will update this thread when I make some progress
Thanks
The "PL/SQL" support that ships with Komodo is a combination of
the LexSQL.cxx lexer that comes with Scintilla, and the
koSQLLanguage.py language service that we wrote (and you can find
in /lib/mozilla/components/koSQLLanguage.py).
I'm only looking at the source, but
it looks like it does folding on comments, ( ... ), and the BEGIN/
LOOP/IF ... END constructs. If the main difference is that you
want it to handle the extra keywords, you can add them to
the list of keywords in class koSQLLanguage.py::koPLSQLLanguage
-- watch out, this file defines classes for both koSQLLanguage
and koPLSQLLanguage.
I will have a look at the UDL file, as I'm curious whether the
problem is in the UDL itself or the engine, but it seems to me
that we should add this list of keywords to the existing
language service.
Is there anything else you're looking for in PL/SQL editing?
Thanks,
Eric
Is there a good reason why the PL-SQL lexer behaved as a test lexer for my SQL script? I thought a PL-SQL lexer should recognize the standard SQL keywords.
Which PL-SQL lexer do you mean? The one that ships with Komodo, or the one
that gsalem wrote?
I'm not an expert on SQL, but my understanding is that there's a core
set of keywords, and then each vendor has extended the language in
their own way. Could you list any keywords that are missing?
It's easy for us to ship a proper set of keywords. I've created
a public bug at http://bugs.activestate.com/show_bug.cgi?id=76743
Another advantage of going with the existing lexer: it handles case-insensitivity
of keywords, but UDL only does case-sensitive keywords.
I'll try to see if I can "enhance" it with more reserved words.
thanks
Hope you don't feel you spent too much time on UDL.
I'll still look at the file to see if there's a bug
somewhere.
- Eric
It would be very nice of you
but how to make it into a .pyo? if I try python -O it gives an error about not finding module xpcom.
thanks
There are problems with the existing koSQLLanguage.py file:
There is no extension for PL/SQL files. I've added "*.plsql"
There is no color scheme at all for PL/SQL files. I've
refactored the class so *.sql and *.plsql files share the
same scheme.
The synonym for "REM" comments wasn't handled, so I added that,
using Scintilla's "InListAbbrev" functionality, so any prefix
of "remark" beginning with "rem" will match, case-insensitively.
gsalem, I'll email you the new koSQLLanguage.py I'm about to check in,
could you tell me if it works?
Am I right?
It looks like your question was cut off in the title.
- Eric
The question is that there is no need to generate the pyo. And you already answered it.
Thanks a lot
GSalem tested the new koSQLLanguage.py module, and reports that it's working fine.
I have to admit that we in the Komodo group don't have much experience with
Oracle. MySQL, Postgres, SQLite, and even ODBC/Access, yes. We figured that
the PL-SQL module was working fine in the field, since no one had complained.
After a quick look, I saw it was flawed, and not just in the way it's missing
a few hundred keywords.
We'll be shipping the fixed version in the next alpha of Komodo 4.4, both IDE
and Edit.
As for the question about code-completion that started this discussion, with
over 1100 keywords in the language, I can see simple three-character completion
like we have for many other languages might deliver enough.
Hmmm, maybe raising that subject doesn't close this thread. Please reply on
other kinds of completion you'd like to see.
Hi,
it would be very nice to have, although not a big issue. What would be much better is code folding. I started looking at other .py to see how it can be done. Surely you're more knowledgeable than myself to do it. But if I can help in any way, just drop me a note.
Thanks again
I looked at the lexer, and it looks like it's making the right noises about
supporting folding. Then I had a look at the language service file
koSQLLanguage.py, and saw this line:
self._lexer.supportsFolding = 0
I changed the '0' to a '1', restarted Komodo, and it's folding fine.
Instabug at http://bugs.activestate.com/show_bug.cgi?id=76875