Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
dbc5c74b
o2oa
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa
通知
339
Star
10
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dbc5c74b
编写于
12月 11, 2020
作者:
NoSubject
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix/completion_items' into 'wrdp'
优化代码提示功能 See merge request o2oa/o2oa!2504
上级
020fb18b
6107687b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
9 deletion
+33
-9
o2web/source/o2_core/o2/widget/JavascriptEditor.js
o2web/source/o2_core/o2/widget/JavascriptEditor.js
+29
-5
o2web/source/o2_core/scriptWorker.js
o2web/source/o2_core/scriptWorker.js
+4
-4
未找到文件。
o2web/source/o2_core/o2/widget/JavascriptEditor.js
浏览文件 @
dbc5c74b
...
...
@@ -269,7 +269,8 @@ o2.widget.JavascriptEditor = new Class({
if
(
textPrefix
.
lastIndexOf
(
"
=
"
)
!=-
1
)
textPrefix
=
textPrefix
.
substr
(
textPrefix
.
lastIndexOf
(
"
=
"
)
+
1
);
if
(
textPrefix
.
lastIndexOf
(
"
new
"
)
!=-
1
)
textPrefix
=
textPrefix
.
substr
(
textPrefix
.
lastIndexOf
(
"
new
"
)
+
5
);
//if (preCode.lastIndexOf("{")!=-1) preCode = preCode.substr(preCode.lastIndexOf("{")+1);
debugger
;
var
codeObj
=
{
"
code
"
:
textPrefix
,
"
preCode
"
:
preCode
,
...
...
@@ -299,14 +300,28 @@ o2.widget.JavascriptEditor = new Class({
startColumn
:
1
,
startLineNumber
:
1
};
var
preCode
=
model
.
getValueInRange
(
range
);
preCode
=
model
.
getValueInRange
(
range
);
}
var
sufCode
=
""
;
var
lineCount
=
model
.
getLineCount
();
var
nextLineNumber
=
position
.
lineNumber
+
1
;
if
(
nextLineNumber
<=
lineCount
){
range
=
{
endColumn
:
model
.
getLineMaxColumn
(
lineCount
),
endLineNumber
:
lineCount
,
startColumn
:
1
,
startLineNumber
:
nextLineNumber
};
sufCode
=
model
.
getValueInRange
(
range
);
}
var
word
=
model
.
getWordUntilPosition
(
position
);
var
insertRange
=
{
startLineNumber
:
position
.
lineNumber
,
endLineNumber
:
position
.
lineNumber
,
startColumn
:
word
.
startColumn
,
endColumn
:
word
.
endColumn
};
return
new
Promise
(
function
(
s
){
this
.
getCompletionObject
(
textPrefix
,
preCode
,
insertRange
,
model
.
o2Editor
.
options
.
runtime
,
function
(
o
){
this
.
getCompletionObject
(
textPrefix
,
preCode
+
"
\n
"
+
sufCode
,
insertRange
,
model
.
o2Editor
.
options
.
runtime
,
function
(
o
){
// if (o) {
// var arr = [];
...
...
@@ -350,15 +365,24 @@ o2.widget.JavascriptEditor = new Class({
if
(
x
){
var
endLineNumber
=
(
pos
.
row
>
0
)
?
pos
.
row
-
1
:
-
1
;
var
preCode
=
""
;
if
(
endLineNumber
>-
1
){
var
range
=
session
.
getWordRange
(
0
,
0
);
range
.
setEnd
(
endLineNumber
,
session
.
getLine
(
endLineNumber
).
length
);
preCode
=
session
.
getTextRange
(
range
);
}
var
sufCode
=
""
;
var
lineCount
=
session
.
getLength
()
-
1
;
var
nextLineNumber
=
pos
.
row
+
1
;
if
(
nextLineNumber
<=
lineCount
){
var
range
=
session
.
getWordRange
(
nextLineNumber
,
0
);
range
.
setEnd
(
lineCount
,
session
.
getLine
(
lineCount
).
length
);
sufCode
=
session
.
getTextRange
(
range
);
}
return
new
Promise
(
function
(
s
){
this
.
getCompletionObject
(
x
,
preCode
,
null
,
editor
.
o2Editor
.
options
.
runtime
,
function
(
o
){
this
.
getCompletionObject
(
x
,
preCode
+
"
\n
"
+
sufCode
,
null
,
editor
.
o2Editor
.
options
.
runtime
,
function
(
o
){
callback
(
null
,
o
);
if
(
s
)
s
(
o
);
}.
bind
(
this
));
...
...
o2web/source/o2_core/scriptWorker.js
浏览文件 @
dbc5c74b
...
...
@@ -2,8 +2,8 @@ window = self;
window
.
addEvent
=
function
(){};
self
.
window
=
window
;
window
.
execScript
=
function
(
text
){
return
eval
(
text
)
}
return
eval
(
text
)
;
}
;
if
(
!
this
.
document
)
document
=
{
"
window
"
:
self
,
...
...
@@ -421,9 +421,9 @@ layout.addReady(function(){
code
=
"
return
"
+
code
+
"
;
"
;
if
(
preCode
){
code
=
preCode
+
"
\n
"
+
code
;
code
=
"
try{
\n
"
+
preCode
+
"
\n
}catch(e){}
\n
"
+
"
try{
\n
"
+
code
+
"
\n
}catch(e){return null;}
"
;
}
code
=
"
try {
\n
"
+
code
+
"
\n
}catch(e){return null;}
"
;
//
code = "try {\n"+code+"\n}catch(e){return null;}";
var
o
=
_worker
.
runtimeEnvironment
[
runtime
].
exec
(
code
);
if
(
o
)
{
var
completions
=
(
type
==
"
ace
"
)
?
_worker
.
getAceCompletions
(
o
,
range
,
codeText
)
:
_worker
.
getMonacoCompletions
(
o
,
range
,
codeText
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录