oraopensource / language-oracle Goto Github PK
View Code? Open in Web Editor NEWLanguage spec for Atom converted from TextMate bundle
License: Other
Language spec for Atom converted from TextMate bundle
License: Other
Are the snippets useful?
ping @vincentmorneau
Hello,
plugin does not highlight self functions. or procedures
In language-oracle\index.less
:
Starting from Atom v1.13.0, the contents of atom-text-editor
elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host
and ::shadow
pseudo-selectors, and prepend all your syntax selectors with syntax--
. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:
atom-text-editor::shadow .logger.oracle
=> atom-text-editor.editor .logger.syntax--oracle
Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.
Linguist is the repo that maintains what language code files hosted on GitHub are. Currently it references the text mate bundle this repo was based off, as the syntaxes expand in this repo it might be better to reference this instead.
They are referenced as a submodule. Mostly, they are text mate bundles, but there are a couple that are just over a dozen that are referencing atom language grammars, e.g language-python
See: https://github.com/github/linguist/tree/master/vendor/grammars
So far the main change is adding APEX
related words.
Reported in #36
Need to try a few different scenarios and a few different syntaxes to see the behaviour. Also, a recent change added function matching to generic function naming, so the D1 not being highlighted in the example may affect the result here.
Suggest replace the current regex match for
collect
with
(bulk\s+)?collect
I think it would be easier to code and easier to read to have the snippets like that:
".source.plsql.oracle":
"declare l_exists number;":
prefix: "magic-exists-no-data-found"
body: """
declare
l_exists number;
begin
select distinct 1
into l_exists
from $1
where $2;
exception
when no_data_found then
$3;
end;
"""
Notice the double quotes (3x) before and after the body. That make everything realign properly when the code expands.
Just reading up on this, I think it needs to remain as GPLv2.
I already had file-types install and had to modify my config.cson
file to remove those changes:
Was
"file-types":
pkb: "source.sql"
pks: "source.sql"
pls: "source.sql"
plb: "source.sql"
Now
"file-types":
pkb: "source.pks"
pks: "source.pkb"
pls: "source.pks"
plb: "source.pkb"
I think I can remove this plugin (and configuration)
Regarding this ticket, may be good to make note for people that have done the same thing.
SQL files should not always map to PL/SQL.
Some syntax specs seem to have multiple definitions of the same capture
.
e.g
{
captures:
"1":
name: "keyword.other.oracle"
"2":
name: "keyword.other.oracle"
"3":
name: "keyword.other.oracle"
"4":
name: "entity.name.function.oracle"
match: "(?i)\\s*(OVERRIDING)?\\s*(MEMBER|CONSTRUCTOR|STATIC)?\\s*(function|procedure)\\s+([-a-z0-9_]+)"
name: "meta.procedure.oracle"
}
1 through 3 appears to be duplicated. I'm sure this isn't required.
As originally reported in #31 (comment)
Initially based on this discussion
Instead of manually generating the information for oracle packages and their methods we can generate them dynamically.
@tschf pointed out that some of the procedures from the oracle dictionary views may not be supported features. For now I think it's safe to include them as it'll be the easiest thing.
If I have package code, and go to create a new procedure, the new line after the definition (as
or begin
) should be at the same indentation level, but it going back one level of indentation.
e.g.
Expected output:
create or replace package foo
as
procedure foo1(
l_input NUMBER
) as
begin
--todo
end;
end foo;
Actual output:
create or replace package foo
as
procedure foo1(
l_input NUMBER
) as
begin
--todo;
end;
end foo;
Installation:
Places to think about are marked in comments with: ???
Snippet one (package):
CREATE OR REPLACE PACKAGE XYZ AUTHID DEFINER AS -- AUTID DEFINER ???
k1 CONSTANT INTERVAL DAY(0) TO SECOND(0) := TO_DSINTERVAL('0 00:01:00'); -- DAY SECOND ???
PROCEDURE A1;
END XYZ;
/
CREATE OR REPLACE PACKAGE BODY XYZ AS
g1 VARCHAR2(61);
PROCEDURE A1 IS
lDate DATE;
BEGIN
SELECT SYSDATE INTO lDate FROM DUAL;
SELECT abc INTO lAbc FROM ABC WHERE DEF = 1 AND (GHI < 5 OR GHI > 10); -- AND, OR ???
END A1; -- A1 ???
BEGIN
g1 := SYS.ANYDATA.ConvertObject(CType()).GETTYPENAME(); -- SYS... ???
END XYZ;
/
Snippet two (type):
CREATE OR REPLACE TYPE C1 AS OBJECT -- OBJECT ???
(
PId NUMBER(9,0),
CId NUMBER(9,0),
CONSTRUCTOR FUNCTION C1 RETURN SELF AS RESULT -- SELF RESULT ???
)
/
CREATE OR REPLACE TYPE BODY C1 IS
CONSTRUCTOR FUNCTION C1 RETURN SELF AS RESULT IS
BEGIN
SELF.PId := NULL;
SELF.CId := NULL;
RETURN;
END C1; -- C1 ???
END;
/
DDL snippets:
WHENEVER OSERROR EXIT FAILURE ROLLBACK -- WHENEVER OSERROR FAILURE ???
WHENEVER SQLERROR EXIT FAILURE ROLLBACK -- SQLERROR ???
SET TIMING ON
SET ECHO OFF
SET LINESIZE 300
SET SERVEROUTPUT ON
SET TERMOUT OFF
PROMPT Changeset 0.0.1 -- PROMPT ???
ACCEPT gN1 CHAR PROMPT ': ' -- ACCEPT ???
COLUMN ProtokollDate FORMAT A15 Old_Value ProtokollDate -- FORMAT ???
SELECT TO_CHAR(SYSDATE,'YYYYMMDD_HH24MISS') ProtokollDate FROM DUAL;
SET TERMOUT ON
SPOOL A1_&ProtokollDate..log -- SPOOL ???
ALTER TABLE OWNER.TAB1 SHRINK SPACE CASCADE; -- SHRINK ... ???
ALTER TABLE OWNER.TAB1 MODIFY PARTITION TAB1_P01 SHRINK SPACE; -- MODIFY ... ???
ALTER TABLE OWNER.TAB2 ENABLE ROW MOVEMENT; -- ENABLE ... ???
ALTER TABLE OWNER.TAB2 DISABLE ROW MOVEMENT; -- DISABLE ... ???
ALTER TABLE OWNER.TAB3 ADD CONSTRAINT PK_TAB3 PRIMARY KEY (C1); -- ADD ???
DEFINE T1 = &1 -- DEFINE ???
CONNECT user1@db1 -- CONNECT ???
VAR TSystemProviderId NUMBER -- VAR ???
CREATE TABLE TAB4 (
ID1 NUMBER(9, 0) NOT NULL, -- NOT ???
DATETIME DATE NOT NULL,
DAY DATE NOT NULL,
UUID VARCHAR2(36 BYTE) NOT NULL, -- BYTE ???
CONSTRAINT PRIMARY KEY (ID1)
USING INDEX ( -- INDEX ???
CREATE INDEX IXPK_TAB4 ON TAB4 (ID1)
COMPRESS 3 -- COMPRESS ???
LOCAL -- LOCAL (GLOBAL) ???
(
PARTITION PIXPK_TAB4_MAXVAL_MAXVALUE -- PARTITION ???
TABLESPACE INDEX1 -- TABLESPACE
PCTFREE 10 -- PCTFREE ???
INITRANS 2 -- INITRANS ???
STORAGE ( -- STORAGE ???
INITIAL 5M -- INITIAL 5M ???
PCTINCREASE 0 -- PCTINCREASE ???
)
)
NOPARALLEL -- NOPARALLEL (PARALLEL) ???
LOGGING -- LOGGING (NOLOGGING) ???
),
CONSTRAINT CHK_TAB4NOW CHECK (DAY = TRUNC(DATETIME))
DEFERRABLE -- DEFERRABLE ???
INITIALLY DEFERRED -- INITIALLY DEFERRED (IMMEDIATE) ???
)
PARTITION BY RANGE (ID1, DAY) -- BY ???
(
PARTITION PTAB4_MAXVAL_MAXVALUE VALUES LESS THAN (MAXVALUE, MAXVALUE) -- LESS THAN MAXVALUE ???
TABLESPACE DATA1
PCTFREE 10
INITRANS 2
STORAGE (
INITIAL 20M
PCTINCREASE 0
)
)
NOPARALLEL -- NOPARALLEL ???
NOCACHE -- NOCACHE ???
LOGGING -- LOGGING ???
ENABLE ROW MOVEMENT; -- ENABLE (DISABLE) MOVEMENT ???
ALTER INDEX IXPK_TAB4E MODIFY DEFAULT ATTRIBUTES TABLESPACE INDEX1; -- MODIFY ATTRIBUTES ???
CREATE TABLE T2
(P1 VARCHAR2(50 CHAR) NOT NULL
,V1 VARCHAR2(256 CHAR) NOT NULL
,B1 VARCHAR2(256 CHAR)
,CONSTRAINT PK_T2 PRIMARY KEY (P1)
)
ORGANIZATION INDEX -- ORGANIZATION ???
/
CREATE TABLE T3
(M1 NUMBER(5,0) NOT NULL
,GID NUMBER(38,0) NOT NULL
,US BLOB
)
PCTUSED 60 PCTFREE 10 -- PCTUSED PCTFREE ???
TABLESPACE TS1
LOB (US) -- LOB
STORE AS SECUREFILE L_T3_US ( -- STORE SECUREFILE ???
NOCACHE
LOGGING
DISABLE STORAGE IN ROW
TABLESPACE TSL1
)
PARTITION BY LIST (GID) -- LIST (HASH, REFERENCE) ???
(PARTITION T3_GID_P01
VALUES (1, 3)
TABLESPACE TSP1
)
,PARTITION T3_GID_P02
VALUES (2, 4)
TABLESPACE TSP2
)
,PARTITION T3_GID_P00
VALUES (DEFAULT)
TABLESPACE TS_GID_P00
)
/
SPOOL OFF
SET TIMING OFF
Take the following:
select *
from ( -- starting blocking
select 1 from dual
--) -- this is highlighted as the ending block even though it's commented
)
When the cursor is on the first parenthesis, it highlights the ending parenthesis in the comment. Multiline comments experience the same issue.
From https://community.oracle.com/message/14080370#14080370
Would be good to have an option to grey out logger comments. Catch will be how to do this without making it look like commented code. One idea I have is to create a different background color.
I'm not too sure how the coloring system works in Atom but this option (color) may need to be configurable since people use many different themes in Atom.
In language-oracle/index.less
:
Starting from Atom v1.13.0, the contents of atom-text-editor
elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host
and ::shadow
pseudo-selectors, and prepend all your syntax selectors with syntax--
. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:
atom-text-editor::shadow .logger.oracle
=> atom-text-editor.editor .logger.syntax--oracle
Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.
Please add support for the file endings of packages created with PL/SQL Developer from Allround Automations.
For Specs it´s spc and for package bodies it´s bdy (For Functions fnc and procedure prc). Would be nice, so I have not to change pl sql (oracle).cson by myself everytime you update the package...
Thanks!
On large package body Atom will freeze on loading a file. If I disable language-plsql (tried 1.5-1.6.2) the file loads fine. Also tested using language-sql and the file loads fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.