diff options
| author | Rider Linden <rider@lindenlab.com> | 2026-08-19 12:14:50 -0700 |
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2026-08-19 12:14:50 -0700 |
| commit | ece8b732d963afe257b4ba7396c9deb340dbf47c (patch) | |
| tree | 4f1ef12b83848938f954422c904368c797407296 /indra/newview/llscripteditorws.cpp | |
| parent | 7af436c43d8bb7027c146e9a57bb19c3c89c5d3e (diff) | |
Extract the correct compile error location from message.
Diffstat (limited to 'indra/newview/llscripteditorws.cpp')
| -rw-r--r-- | indra/newview/llscripteditorws.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/indra/newview/llscripteditorws.cpp b/indra/newview/llscripteditorws.cpp index e33e18bcd4..f886be819f 100644 --- a/indra/newview/llscripteditorws.cpp +++ b/indra/newview/llscripteditorws.cpp @@ -1542,13 +1542,48 @@ LLSD LLScriptEditorWSServer::saveScript(LLViewerObject* prim, LLInventoryItem* i if (!cb_result["compiled"].asBoolean() && cb_result.has("errors")) { response["diagnostics"] = LLSD::emptyArray(); + + const bool is_lua = + compile_target == "luau" || + compile_target == "lsl-luau"; + for (const auto& error : llsd::inArray(cb_result["errors"])) { + boost::smatch match; LLSD diagnostic; - diagnostic["row"] = 0; - diagnostic["column"] = 0; diagnostic["level"] = "ERROR"; - diagnostic["message"] = error.asString(); + + if (is_lua && + boost::regex_match( + error.asString(), + match, + LUAU_LOCATION_PATTERN)) + { + diagnostic["row"] = std::stoi(match[2].str()); + diagnostic["column"] = 0; + diagnostic["message"] = match[3].str(); + } + else if (!is_lua && + boost::regex_match( + error.asString(), + match, + LSL_LOCATION_PATTERN)) + { + diagnostic["row"] = + std::stoi(match[1].str()) + 1; + diagnostic["column"] = + std::stoi(match[2].str()) + 1; + diagnostic["level"] = match[3].str(); + diagnostic["message"] = match[4].str(); + diagnostic["format"] = "lsl"; + } + else + { + diagnostic["row"] = 0; + diagnostic["column"] = 0; + diagnostic["message"] = error.asString(); + } + response["diagnostics"].append(diagnostic); } } @@ -2043,7 +2078,6 @@ void LLScriptEditorWSServer::sendRuntimeEvent( } LLSD message; - message["script_id"] = script_id; message["object_id"] = event.mRootID; message["prim_id"] = event.mPrimID; message["item_id"] = event.mItemID; |
