Skip to content

Get pregenerated config files from the simulator cap and make them available through the websocket.#5739

Open
Rider-Linden wants to merge 7 commits intoproject/lua_editorfrom
rider/defs_cap
Open

Get pregenerated config files from the simulator cap and make them available through the websocket.#5739
Rider-Linden wants to merge 7 commits intoproject/lua_editorfrom
rider/defs_cap

Conversation

@Rider-Linden
Copy link
Copy Markdown
Contributor

@Rider-Linden Rider-Linden commented Apr 29, 2026

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

…cap when available to retrieve all language definition files and cache them locally.

Retrieve the default definition files from the LSL definitions precompiled library.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LLSyntaxDefCache to 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_default and removes the legacy types_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.

Comment thread indra/newview/llsyntaxid.cpp Outdated
Comment thread indra/newview/llsyntaxid.cpp Outdated
Comment on lines +324 to +331
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);

setKeywords(memcached_keywords["lsl_keywords.xml"], memcached_keywords["lua_keywords.xml"]);
LLAppViewer::instance()->postToMainCoro(
[this]()
{
mSyntaxIDChangedSignal();
});
Comment thread indra/newview/llsyntaxid.cpp
Comment thread indra/newview/llviewerregion.cpp Outdated
Comment thread doc/external-editor-json-rpc.md Outdated
Comment on lines 111 to +115
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);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_default and add the new ScriptDefinitions capability name.
  • Replace legacy per-language syntax managers with a unified LLSyntaxDefCache that can fetch via either ScriptDefinitions (preferred) or legacy LSLSyntax.
  • 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.

Comment on lines 320 to +333
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();
});
}
Comment thread indra/newview/llsyntaxid.cpp Outdated
Comment thread indra/newview/llsyntaxid.cpp Outdated
Comment thread indra/newview/llviewerregion.cpp
Comment thread indra/newview/llsyntaxid.cpp Outdated
Comment thread indra/newview/llsyntaxid.cpp Outdated
Rider-Linden and others added 3 commits April 29, 2026 15:36
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the cmake label Apr 29, 2026
app_settings/std_bump.ini
app_settings/toolbars.xml
app_settings/trees.xml
app_settings/types_lua_default.xml
Copy link
Copy Markdown

@tapple tapple Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown

@tapple tapple Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing on fedora linux. unsure whether I should build viewer with or without DebInfo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll run that test case. Thanks for the catch.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't reproduce this again

@Rider-Linden Rider-Linden changed the title Rider/defs cap Get pregenerated config files from the simulator cap and make them available through the websocket. Apr 30, 2026
| `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 |
Copy link
Copy Markdown

@tapple tapple Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these file have been renamed since the last simulator build:

That can be fixed in a different PR though. no need to block this on a simulator rebuild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants