Open
Description
当 SQL 语句前面存在空白行时,解析结果中的 error.suggestions.token 为null
,导致无法正确提示发生错误的位置,现象如下:
解析结果如下:
{
"success": false,
"ast": null,
"cursorKeyPath": [],
"nextMatchings": [
{
"type": "string",
"value": "UPDATE"
},
{
"type": "string",
"value": "set"
},
{
"type": "string",
"value": "insert"
},
{
"type": "string",
"value": "create"
},
{
"type": "string",
"value": "select"
}
],
"error": {
"suggestions": [
{
"type": "string",
"value": "select"
},
{
"type": "string",
"value": "create"
},
{
"type": "string",
"value": "insert"
},
{
"type": "string",
"value": "set"
},
{
"type": "string",
"value": "UPDATE"
}
],
"token": null,
"reason": "incomplete"
},
"debugInfo": {
"tokens": [
{
"type": "word",
"value": "selec",
"position": [
2,
6
]
}
],
"callVisiterCount": 38,
"costs": {
"lexer": 0,
"parser": 0
}
}
}
Demo 中关于错误提示位置的处理:
syntax-parser/src/demo/monaco-plugin/index.ts
Lines 60 to 72 in 5818f52
期望结果:
未完整的语句,error.suggestion.token 能给出错误位置的token,如{type: "string", value: "selec", position: [1, 6]}
Metadata
Metadata
Assignees
Labels
No labels