Skip to content

Commit 4f9b04b

Browse files
committed
Add helper package to generate underlying data
1 parent 5252839 commit 4f9b04b

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

util/provider_data.pkb

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
create or replace PACKAGE BODY PROVIDER_DATA
2+
AS
3+
4+
type t_keyword_list is table of varchar2(50)
5+
index by PLS_INTEGER;
6+
7+
function get_keywords
8+
return t_keyword_list
9+
as
10+
l_keys t_keyword_list;
11+
begin
12+
13+
select
14+
'"'||keyword||'",'
15+
bulk collect into
16+
l_keys
17+
from
18+
v$reserved_words res_words
19+
left outer join all_procedures procs on (procs.owner = 'SYS' and procs.object_name = 'STANDARD' and procs.procedure_name = res_words.keyword)
20+
where
21+
res_words.keyword not in (
22+
'!',
23+
'!=',
24+
'&',
25+
'(',
26+
')',
27+
'*',
28+
'+',
29+
',',
30+
'-',
31+
'.',
32+
'/',
33+
':',
34+
';',
35+
'<',
36+
'<<',
37+
'<=',
38+
'=',
39+
'=>',
40+
'>',
41+
'>=',
42+
'@',
43+
'A',
44+
'[',
45+
']',
46+
'^',
47+
'{',
48+
'|',
49+
'}'
50+
)
51+
and procs.object_id is NULL
52+
order by keyword;
53+
54+
return l_keys;
55+
end get_keywords;
56+
57+
58+
procedure keywords AS
59+
l_keys t_keyword_list;
60+
BEGIN
61+
l_keys := get_keywords();
62+
63+
dbms_output.put_line('{');
64+
dbms_output.put_line(chr(9) || '"keywords": [');
65+
66+
for i in 1..l_keys.COUNT
67+
loop
68+
69+
70+
if i = l_keys.COUNT
71+
then
72+
dbms_output.put_line(chr(9)||chr(9) || rtrim(l_keys(i), ','));
73+
else
74+
dbms_output.put_line(chr(9)||chr(9) || l_keys(i));
75+
end if;
76+
77+
end loop;
78+
79+
dbms_output.put_line(chr(9) || ']');
80+
dbms_output.put_line('}');
81+
82+
83+
END keywords;
84+
85+
END PROVIDER_DATA;
86+
/

util/provider_data.pks

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Package: provider_data
3+
Purpose: Generate the data as a JSON feed that Atom will use to aid in
4+
its code completions.
5+
Notes: Must be run as sys to gain access to DBA dictionary views
6+
Status:
7+
[*] - keywords
8+
[ ] - Packages
9+
[ ] - Package procedures
10+
[ ] - Procedure arguments
11+
[ ] - Package types
12+
13+
14+
*/
15+
create or replace package provider_data
16+
as
17+
18+
procedure keywords;
19+
20+
end provider_data;
21+
/

0 commit comments

Comments
 (0)