Retrieve pregenerated tool config files from cache on viewer. #66
Retrieve pregenerated tool config files from cache on viewer. #66Rider-Linden merged 4 commits intodevelopfrom
Conversation
…ough the JSON RPC interface to the viewer. IF syntax.cache is not implemented on the viewer continue using the old method.
There was a problem hiding this comment.
Pull request overview
This PR adds support for the viewer’s new syntax_cache capability so the extension can fetch pre-generated Selene and Luau-LSP configuration artifacts from the viewer rather than generating them locally.
Changes:
- Extend viewer JSON-RPC message interfaces to cover syntax cache list/get and extra handshake/subscription metadata.
- Track
syntax_cachefeature support inSynchServiceand request the cache file list on handshake/syntax changes. - Add repository/service methods to list and fetch cached syntax files, and new plugin entrypoints to configure Selene/Luau-LSP from viewer-provided content.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/viewereditwsclient.ts | Adds TypeScript interfaces for new handshake/subscription fields and syntax cache RPC payloads. |
| src/synchservice.ts | Detects syntax_cache support and triggers cache-list refresh during handshake/syntax changes; passes capability into syntax version update flow. |
| src/shared/languageservice.ts | Adds syntax-cache-aware syntax update path and delegates viewer-cache configuration into plugins. |
| src/shared/languagerepository.ts | Implements language.syntax.cache and language.syntax.get calls and stores the returned cache file list. |
| src/pluginsupport.ts | Adds plugin methods to configure Selene / Luau-LSP directly from viewer-provided files. |
| doc/Message_Interfaces.md | Documents the new RPC methods/fields and clarifies existing protocol semantics. |
| .pre-commit-config.yaml | Switches pre-commit hook to run the repo’s consolidated npm run precommit script. |
|
Is the intent to leave the current generation feature in for now? Then remove it when the new cap is fully rolled out and people have a chance to update viewers plugin etc? |
Yes. I'd like to kill the whole generation section and just rely on the pre generated versions downloaded from the simulator. That feature won't be available from the viewer until the new alpha, so I didn't want to block the plugin. We could perhaps leave the generators hanging out on a branch for anyone that wants to generate a config for something that we don't natively support. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for the viewer’s new “syntax cache” feature so the extension can download pregenerated tooling config files (Luau-LSP + Selene) from the viewer instead of generating them locally, improving startup/update behavior when the viewer provides cached artifacts.
Changes:
- Add JSON-RPC APIs and models for
language.syntax.cacheandlanguage.syntax.get, and request the cache list during session establishment / syntax changes. - Route
changeSyntaxVersion()through viewer-cache configuration when supported, and add plugin entry points to configure from cached content. - Improve JSON-RPC notification handling to safely log rejected async handler Promises.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/websockclient.ts | Catches and logs rejections from async notification handlers to avoid unhandled Promise rejections. |
| src/viewereditwsclient.ts | Adds protocol interfaces for syntax cache and expands handshake/subscribe response models. |
| src/synchservice.ts | Detects syntax_cache feature, requests cache list on connect/syntax change, and passes cache support through to syntax updates. |
| src/shared/languageservice.ts | Uses viewer cache to configure Selene/Luau-LSP when supported; adds cache request helper methods. |
| src/shared/languagerepository.ts | Implements language.syntax.cache and language.syntax.get calls and stores available cache filenames. |
| src/pluginsupport.ts | Adds Selene + Luau-LSP “configure from viewer cache” methods. |
| doc/Message_Interfaces.md | Documents the new syntax cache methods and updates handshake/response documentation. |
| .pre-commit-config.yaml | Switches local pre-commit hook to run npm run precommit for repo-wide validation. |
| public async configureFromViewerCache( | ||
| version: any, | ||
| viewerDLuau: string, | ||
| viewerDocsJson: string, | ||
| ): Promise<boolean> { | ||
| const configPath = await this.host.config.getWorkspaceConfigPath(); | ||
|
|
||
| const defsFiles: { [k: string]: string } = {}; | ||
|
|
||
| defsFiles["sl-slua"] = await this.saveLuauLSPDefs( | ||
| configPath, | ||
| version, | ||
| viewerDLuau, | ||
| ); | ||
|
|
||
| if (this.host.config.getConfig(ConfigKey.PreprocessorConstantsInSLua, false)) { | ||
| defsFiles["sl-slua-consts"] = await this.saveLuauLSPConstantDefs(configPath); | ||
| } | ||
|
|
||
| const docsFileName = await this.saveLuauLSPDocs( | ||
| configPath, | ||
| version, | ||
| viewerDocsJson, | ||
| ); | ||
|
|
||
| await this.restartLuauLSP(defsFiles, docsFileName, this.host); | ||
| return true; | ||
| } |
If the viewer implements the new syntax cache feature, use that to download the generated config files for LUAU-LSP and selene rather than attempting to generate them.
Viewer PR: secondlife/viewer#5739