Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ssssssss-team
magic-api
提交
ca20cec3
M
magic-api
项目概览
ssssssss-team
/
magic-api
12 个月 前同步成功
通知
41
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
magic-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ca20cec3
编写于
10月 28, 2021
作者:
M
mxd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化代码提示
上级
df03cc0c
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1505 addition
and
10 deletion
+1505
-10
magic-editor/src/console/src/components/resources/magic-api-list.vue
...r/src/console/src/components/resources/magic-api-list.vue
+10
-0
magic-editor/src/console/src/components/resources/magic-function-list.vue
.../console/src/components/resources/magic-function-list.vue
+8
-0
magic-editor/src/console/src/scripts/editor/completion.js
magic-editor/src/console/src/scripts/editor/completion.js
+35
-2
magic-editor/src/console/src/scripts/editor/dark-theme.js
magic-editor/src/console/src/scripts/editor/dark-theme.js
+3
-0
magic-editor/src/console/src/scripts/editor/default-theme.js
magic-editor/src/console/src/scripts/editor/default-theme.js
+3
-0
magic-editor/src/console/src/scripts/editor/high-light.js
magic-editor/src/console/src/scripts/editor/high-light.js
+1
-1
magic-editor/src/console/src/scripts/editor/java-class.js
magic-editor/src/console/src/scripts/editor/java-class.js
+17
-1
magic-editor/src/console/src/scripts/editor/magic-script.js
magic-editor/src/console/src/scripts/editor/magic-script.js
+6
-0
magic-editor/src/console/src/scripts/editor/mybatis.js
magic-editor/src/console/src/scripts/editor/mybatis.js
+1420
-0
magic-editor/src/console/src/scripts/parsing/parser.js
magic-editor/src/console/src/scripts/parsing/parser.js
+2
-6
未找到文件。
magic-editor/src/console/src/components/resources/magic-api-list.vue
浏览文件 @
ca20cec3
...
...
@@ -105,6 +105,7 @@ import MagicGroupChoose from '@/components/resources/magic-group-choose.vue'
import
{
replaceURL
,
download
as
downloadFile
,
requestGroup
,
goToAnchor
,
deepClone
}
from
'
@/scripts/utils.js
'
import
contants
from
'
@/scripts/contants.js
'
import
Key
from
'
@/scripts/hotkey.js
'
import
JavaClass
from
"
@/scripts/editor/java-class.js
"
export
default
{
name
:
'
MagicApiList
'
,
...
...
@@ -882,6 +883,15 @@ export default {
}
},
mounted
()
{
JavaClass
.
setApiFinder
(()
=>
{
return
this
.
listChildrenData
.
filter
(
it
=>
!
it
.
folder
).
map
(
it
=>
{
return
{
path
:
replaceURL
(
it
.
groupPath
+
'
/
'
+
it
.
path
),
name
:
replaceURL
(
it
.
groupName
+
'
/
'
+
it
.
name
),
method
:
it
.
method
}
})
})
this
.
bus
.
$on
(
'
logout
'
,
()
=>
this
.
tree
=
[])
this
.
bus
.
$on
(
'
opened
'
,
item
=>
{
this
.
currentFileItem
=
item
...
...
magic-editor/src/console/src/components/resources/magic-function-list.vue
浏览文件 @
ca20cec3
...
...
@@ -836,6 +836,14 @@ export default {
},
mounted
()
{
JavaClass
.
setupOnlineFunction
(
this
.
doFindFunction
);
JavaClass
.
setFunctionFinder
(()
=>
{
return
this
.
listChildrenData
.
filter
(
it
=>
!
it
.
folder
).
map
(
it
=>
{
return
{
path
:
replaceURL
(
it
.
groupPath
+
'
/
'
+
it
.
path
),
name
:
replaceURL
(
it
.
groupName
+
'
/
'
+
it
.
name
),
}
})
})
this
.
bus
.
$on
(
'
logout
'
,
()
=>
this
.
tree
=
[]);
this
.
bus
.
$on
(
'
opened
'
,
item
=>
{
this
.
currentFileItem
=
item
...
...
magic-editor/src/console/src/scripts/editor/completion.js
浏览文件 @
ca20cec3
import
JavaClass
from
'
./java-class.js
'
import
tokenizer
from
'
../parsing/tokenizer.js
'
import
{
TokenStream
,
TokenType
}
from
'
../parsing/index.js
'
import
{
TokenStream
}
from
'
../parsing/index.js
'
import
{
Parser
}
from
'
../parsing/parser.js
'
import
*
as
monaco
from
'
monaco-editor
'
import
RequestParameter
from
"
@/scripts/editor/request-parameter
"
;
...
...
@@ -22,7 +22,40 @@ const completionImport = (suggestions, position, line, importIndex) => {
}))
return
;
}
let
keyword
=
line
.
trim
().
substring
(
importIndex
+
6
).
trim
().
replace
(
/
[
'|"
]
/g
,
''
).
toLowerCase
();
let
text
=
line
.
trim
().
substring
(
importIndex
+
6
).
trim
().
replace
(
/
[
'|"
]
/g
,
''
);
if
(
text
.
startsWith
(
'
@
'
)){
if
(
text
.
indexOf
(
'
'
)
>
-
1
){
return
;
}
let
finder
=
JavaClass
.
getApiFinder
();
(
finder
&&
finder
()
||
[]).
forEach
(
it
=>
{
let
label
=
'
@
'
+
it
.
method
+
'
:
'
+
it
.
path
suggestions
.
push
({
sortText
:
label
,
label
:
label
,
kind
:
monaco
.
languages
.
CompletionItemKind
.
Reference
,
filterText
:
label
,
detail
:
it
.
name
,
insertText
:
label
,
insertTextRules
:
monaco
.
languages
.
CompletionItemInsertTextRule
.
InsertAsSnippet
})
})
finder
=
JavaClass
.
getFunctionFinder
();
(
finder
&&
finder
()
||
[]).
forEach
(
it
=>
{
let
label
=
'
@
'
+
it
.
path
suggestions
.
push
({
sortText
:
label
,
label
:
label
,
kind
:
monaco
.
languages
.
CompletionItemKind
.
Reference
,
filterText
:
label
,
detail
:
it
.
name
,
insertText
:
label
,
insertTextRules
:
monaco
.
languages
.
CompletionItemInsertTextRule
.
InsertAsSnippet
})
})
return
;
}
let
keyword
=
text
.
toLowerCase
();
let
importClass
=
JavaClass
.
getImportClass
();
if
(
start
!==
0
&&
keyword
&&
(
len
=
importClass
.
length
)
>
0
)
{
let
set
=
new
Set
();
...
...
magic-editor/src/console/src/scripts/editor/dark-theme.js
浏览文件 @
ca20cec3
...
...
@@ -8,6 +8,9 @@ export default {
{
token
:
'
number
'
,
foreground
:
'
6897BB
'
},
{
token
:
'
string
'
,
foreground
:
'
6A8759
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
6A8759
'
},
{
token
:
'
tag.sql
'
,
foreground
:
'
E8BF6A
'
},
{
token
:
'
attribute.name.sql
'
,
foreground
:
'
BABABA
'
},
{
token
:
'
attribute.value.sql
'
,
foreground
:
'
6A8759
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
A9B7C6
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
predefined.magicscript
'
,
foreground
:
'
A9B7C6
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
key
'
,
foreground
:
'
9876AA
'
},
...
...
magic-editor/src/console/src/scripts/editor/default-theme.js
浏览文件 @
ca20cec3
...
...
@@ -7,6 +7,9 @@ export default {
{
token
:
'
number
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
keyword
'
,
foreground
:
'
000080
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
008000
'
},
{
token
:
'
tag.sql
'
,
foreground
:
'
0033B3
'
},
{
token
:
'
attribute.name.sql
'
,
foreground
:
'
174AD4
'
},
{
token
:
'
attribute.value.sql
'
,
foreground
:
'
067D17
'
},
{
token
:
'
predefined
'
,
foreground
:
'
000000
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
000080
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
660E7A
'
},
...
...
magic-editor/src/console/src/scripts/editor/high-light.js
浏览文件 @
ca20cec3
...
...
@@ -35,7 +35,7 @@ export const HighLightOptions = {
{
token
:
'
regexp
'
,
bracket
:
'
@open
'
,
next
:
'
@regexp
'
}
],
[
/
[
;,.
]
/
,
'
delimiter
'
],
[
/"""/
,
{
token
:
'
string
'
,
next
:
'
@string_multi_embedded
'
,
nextEmbedded
:
'
sql
'
}],
[
/"""/
,
{
token
:
'
string
'
,
next
:
'
@string_multi_embedded
'
,
nextEmbedded
:
'
mybatis
'
}],
[
/"
([^
"
\\]
|
\\
.
)
*$/
,
'
string.invalid
'
],
[
/'
([^
'
\\]
|
\\
.
)
*$/
,
'
string.invalid
'
],
[
/"/
,
'
string
'
,
'
@string_double
'
],
...
...
magic-editor/src/console/src/scripts/editor/java-class.js
浏览文件 @
ca20cec3
...
...
@@ -254,6 +254,16 @@ const getOnlineFunction = (path) => {
return
onlineFunctionFinder
&&
onlineFunctionFinder
(
path
);
}
const
getDefineModules
=
()
=>
Object
.
keys
(
scriptClass
).
filter
(
it
=>
scriptClass
[
it
].
module
)
let
apiFinder
;
const
setApiFinder
=
(
finder
)
=>
{
apiFinder
=
finder
;
}
let
functionFinder
;
const
setFunctionFinder
=
(
finder
)
=>
{
functionFinder
=
finder
;
}
const
getApiFinder
=
()
=>
apiFinder
const
getFunctionFinder
=
()
=>
functionFinder
const
exportValue
=
{
findEnums
,
findAttributes
,
...
...
@@ -273,6 +283,12 @@ const exportValue = {
setupOnlineFunction
,
setExtensionAttribute
,
getSimpleClass
,
getDefineModules
getDefineModules
,
setApiFinder
,
setFunctionFinder
,
getApiFinder
,
getFunctionFinder
,
}
export
default
exportValue
;
magic-editor/src/console/src/scripts/editor/magic-script.js
浏览文件 @
ca20cec3
...
...
@@ -4,9 +4,11 @@ import CompletionItemProvider from './completion.js';
import
FoldingRangeProvider
from
'
./folding.js
'
;
import
SignatureHelpProvider
from
'
./signature.js
'
;
import
HoverProvider
from
'
./hover.js
'
;
import
{
initMybatis
}
from
'
./mybatis.js
'
const
Beautifier
=
require
(
'
../beautifier/javascript/beautifier
'
).
Beautifier
export
const
initializeMagicScript
=
()
=>
{
initMybatis
();
const
language
=
'
magicscript
'
;
// 注册语言
monaco
.
languages
.
register
({
id
:
language
});
...
...
@@ -63,6 +65,10 @@ export const initializeMagicScript = () => {
{
open
:
'
[
'
,
close
:
'
]
'
},
{
open
:
'
(
'
,
close
:
'
)
'
},
{
open
:
'
"""
'
,
close
:
'
"""
'
,
notIn
:
[
'
string.multi
'
]},
{
open
:
'
<where>
'
,
close
:
'
</where>
'
},
{
open
:
'
<if
'
,
close
:
'
test=""></if>
'
},
{
open
:
'
<set>
'
,
close
:
'
</set>
'
},
{
open
:
'
<foreach
'
,
close
:
'
collection=""></foreach>
'
},
{
open
:
'
"
'
,
close
:
'
"
'
,
notIn
:
[
'
string
'
]},
{
open
:
'
\'
'
,
close
:
'
\'
'
,
notIn
:
[
'
string
'
]},
{
open
:
'
/**
'
,
close
:
'
*/
'
,
notIn
:
[
'
string
'
]
}
...
...
magic-editor/src/console/src/scripts/editor/mybatis.js
0 → 100644
浏览文件 @
ca20cec3
此差异已折叠。
点击以展开。
magic-editor/src/console/src/scripts/parsing/parser.js
浏览文件 @
ca20cec3
...
...
@@ -110,11 +110,8 @@ export class Parser {
...
JavaClass
.
getAutoImportModule
(),
'
@import
'
:
[]
}
// todo 赋值、async、import 未处理
if
(
nodeLen
>
1
){
for
(
let
i
=
0
;
i
<
nodeLen
-
1
;
i
++
)
{
await
nodes
[
i
].
getJavaType
(
env
)
}
for
(
let
i
=
0
;
i
<
nodeLen
;
i
++
)
{
await
nodes
[
i
].
getJavaType
(
env
)
}
return
env
}
...
...
@@ -319,7 +316,6 @@ export class Parser {
}
else
{
varDefine
=
new
VarDefine
(
new
Span
(
opening
,
this
.
stream
.
getPrev
().
getSpan
()),
token
.
getText
(),
null
);
}
this
.
defines
.
push
(
varDefine
);
return
varDefine
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录