Get pregenerated config files from the simulator cap and make them available through the websocket.#5739
Get pregenerated config files from the simulator cap and make them available through the websocket.#5739Rider-Linden wants to merge 7 commits intoproject/lua_editorfrom
Conversation
…cap when available to retrieve all language definition files and cache them locally. Retrieve the default definition files from the LSL definitions precompiled library.
There was a problem hiding this comment.
Pull request overview
Adds viewer-side support for fetching LSL/Luau syntax definition files from the simulator (new ScriptDefinitions capability), caching them locally, and exposing both the in-memory keyword data and cached files to external editors via the JSON-RPC WebSocket server.
Changes:
- Introduces
LLSyntaxDefCacheto manage per-region syntax ID tracking, downloading, caching, and keyword access for both LSL and Luau. - Extends the external editor JSON-RPC API to list and fetch cached syntax definition files (
language.syntax.cache,language.syntax.get) and updates protocol documentation accordingly. - Packages default syntax definition files into
app_settings/syntax_defaultand removes the legacytypes_lua_default.xml.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| indra/newview/viewer_manifest.py | Packages default syntax definition files into app_settings/syntax_default. |
| indra/newview/llviewerregion.cpp | Adds the ScriptDefinitions capability name. |
| indra/newview/llsyntaxid.h | Replaces prior syntax managers with LLSyntaxDefCache API surface (keywords + cache access). |
| indra/newview/llsyntaxid.cpp | Implements capability detection, download coroutines, caching, and keyword loading. |
| indra/newview/llscripteditorws.h | Adds JSON-RPC handlers for syntax cache listing and file retrieval. |
| indra/newview/llscripteditorws.cpp | Registers new JSON-RPC methods and advertises syntax_cache feature flag in handshake. |
| indra/newview/llscripteditor.cpp | Switches keyword initialization to LLSyntaxDefCache. |
| indra/newview/llpreviewscript.cpp | Switches syntax ID change callback wiring to LLSyntaxDefCache. |
| indra/newview/app_settings/types_lua_default.xml | Removes the legacy Lua types definition file. |
| indra/llmessage/llcorehttputil.h | Minor whitespace change. |
| indra/llmessage/llcorehttputil.cpp | Updates LLSD response parsing to use LLSDSerialize::deserialize(). |
| doc/external-editor-json-rpc.md | Documents new syntax cache methods and updates protocol details. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); | ||
|
|
||
| setKeywords(memcached_keywords["lsl_keywords.xml"], memcached_keywords["lua_keywords.xml"]); | ||
| LLAppViewer::instance()->postToMainCoro( | ||
| [this]() | ||
| { | ||
| mSyntaxIDChangedSignal(); | ||
| }); |
| bool responseToLLSD(HttpResponse * response, bool log, LLSD & out_llsd) | ||
| { | ||
| // Convert response to LLSD | ||
| BufferArray * body(response->getBody()); | ||
| if (!body || !body->size()) | ||
| size_t body_size(body ? body->size() : 0); |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Fixed in d3fa87f. Added (void)log; to suppress the unused-parameter warning and updated the comment to accurately describe that LLSDSerialize::deserialize() handles XML, binary, and notation LLSD encodings (not just XML).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Pull request overview
Adds viewer-side support for fetching LSL/Luau syntax definition assets from simulator capabilities, caching them on disk, and exposing both in-memory keyword LLSD and raw cached files to external editors via the JSON-RPC WebSocket server.
Changes:
- Package default syntax definition files into
app_settings/syntax_defaultand add the newScriptDefinitionscapability name. - Replace legacy per-language syntax managers with a unified
LLSyntaxDefCachethat can fetch via eitherScriptDefinitions(preferred) or legacyLSLSyntax. - Extend the external editor JSON-RPC API to list and fetch cached syntax definition files, and document the new methods/features.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| indra/newview/viewer_manifest.py | Packages default syntax definition files into the viewer. |
| indra/newview/llviewerregion.cpp | Registers the new ScriptDefinitions capability name. |
| indra/newview/llsyntaxid.h | Introduces LLSyntaxDefCache public API for keywords + cache access. |
| indra/newview/llsyntaxid.cpp | Implements fetching/caching logic for legacy and defs-cap responses. |
| indra/newview/llscripteditorws.h | Adds JSON-RPC handlers for syntax cache list/get. |
| indra/newview/llscripteditorws.cpp | Registers and implements language.syntax.cache and language.syntax.get; advertises syntax_cache feature. |
| indra/newview/llscripteditor.cpp | Switches keyword initialization to LLSyntaxDefCache. |
| indra/newview/llpreviewscript.cpp | Switches syntax-id callback and initialization to LLSyntaxDefCache. |
| indra/newview/app_settings/types_lua_default.xml | Removes Lua types default file (no longer used by the updated code). |
| indra/llmessage/llcorehttputil.h | Minor whitespace cleanup. |
| indra/llmessage/llcorehttputil.cpp | Improves LLSD response parsing using LLSDSerialize::deserialize(). |
| doc/external-editor-json-rpc.md | Updates/extends protocol documentation for new syntax-cache APIs and clarifications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| else | ||
| { | ||
| LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is empty." << LL_ENDL; | ||
| loadDefaultKeywordsIntoLLSD(); | ||
| LL_WARNS("SyntaxLSL") << "Malformed syntax defs response, missing 'files' map." << LL_ENDL; | ||
| } | ||
|
|
||
| result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS); | ||
|
|
||
| setKeywords(memcached_keywords["lsl_keywords.xml"], memcached_keywords["lua_keywords.xml"]); | ||
| LLAppViewer::instance()->postToMainCoro( | ||
| [this]() | ||
| { | ||
| mSyntaxIDChangedSignal(); | ||
| }); | ||
| } |
aea98c5 to
0f8be80
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| app_settings/std_bump.ini | ||
| app_settings/toolbars.xml | ||
| app_settings/trees.xml | ||
| app_settings/types_lua_default.xml |
There was a problem hiding this comment.
I hit this assert when I tried pressing edit again on a script already open in vscode
[2026-04-29 21:50:03] [frame_payload] Payload Bytes:
[0] (147) [1] {"id":1,"jsonrpc":"2.0","result":{"message":"Script already subscribed","script_id":"b9a3098060694bd0dc3b8174bf41f8ad","status":3,"success":false}}[2026-04-29 21:50:03] [frame_header] Dispatching write containing 1 message(s) containing 2 header bytes and 79 payload bytes
[2026-04-29 21:50:03] [frame_header] Header Bytes:
[0] (2) 81 4F[2026-04-29 21:50:03] [frame_payload] Payload Bytes:
[0] (79) [1] {"id":2,"jsonrpc":"2.0","result":{"id":"9095b976-6535-080c-f78e-de69f79c1fa9"}}2026-04-30T04:50:03Z ERROR #LlsdToJson# llcommon/llsdjson.cpp(135) LlsdToJson : Unsupported conversion to JSON from LLSD type (8).
There was a problem hiding this comment.
testing on fedora linux. unsure whether I should build viewer with or without DebInfo
There was a problem hiding this comment.
I'll run that test case. Thanks for the catch.
| | `slua_definitions.yaml` | Luau language definitions in YAML format | | ||
| | `slua_keywords.xml` | Luau keyword definitions in LLSD XML format | | ||
| | `slua_keywords_pretty.xml` | Luau keyword definitions in formatted LLSD XML format | | ||
| | `slua_selene.yml` | Luau Selene linter configuration in YAML format | |
There was a problem hiding this comment.
all these file have been renamed since the last simulator build:
- https://github.com/secondlife/lsl-definitions/tree/main/generated
- secondlife/lsl-definitions@08bcadd
That can be fixed in a different PR though. no need to block this on a simulator rebuild
Description
Adds support for downloading lsl and lua syntax definitions from the simulator. Make these files visible to external editors through the JSONRPC server.
Related Issues
secondlife/sl-vscode-plugin#66
Additional Notes