Skip to content

Commit

Permalink
fix: 修复代码调试 调试状态错误
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Oct 8, 2024
1 parent b4875fd commit 2c3fecf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 26 deletions.
3 changes: 2 additions & 1 deletion ui/src/components/codemirror-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ defineOptions({ name: 'CodemirrorEditor' })
function getRangeFromLineAndColumn(state: any, line: number, column: number, end_column?: number) {
const l = state.doc.line(line)
return { form: l.from + column, to: end_column ? l.from + end_column : l.to }
const form = l.from + column
return { form: form > l.to ? l.to : form, to: end_column ? l.from + end_column : l.to }
}
const regexpLinter = linter(async (view) => {
Expand Down
35 changes: 10 additions & 25 deletions ui/src/views/function-lib/component/FunctionDebugDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,36 +102,21 @@ watch(debugVisible, (bool) => {
})
const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) {
functionLibApi
.postFunctionLibDebug(form.value, loading)
.then((res) => {
showResult.value = true
isSuccess.value = true
result.value = res.data
})
.catch((res) => {
console.log(formEl)
const validate = formEl ? formEl.validate() : Promise.resolve()
validate.then(() => {
functionLibApi.postFunctionLibDebug(form.value, loading).then((res) => {
if (res.code === 500) {
showResult.value = true
isSuccess.value = false
result.value = res.message
} else {
showResult.value = true
isSuccess.value = true
result.value = res.data
})
} else {
await formEl.validate((valid: any) => {
if (valid) {
functionLibApi.postFunctionLibDebug(form.value, loading).then((res) => {
if (res.code === 500) {
showResult.value = true
isSuccess.value = false
result.value = res.message
} else {
showResult.value = true
isSuccess.value = true
result.value = res.data
}
})
}
})
}
})
}
const open = (data: any) => {
Expand Down

0 comments on commit 2c3fecf

Please sign in to comment.