Skip to content

Retrieve pregenerated tool config files from cache on viewer. #66

Merged
Rider-Linden merged 4 commits intodevelopfrom
rider/new_cap
Apr 30, 2026
Merged

Retrieve pregenerated tool config files from cache on viewer. #66
Rider-Linden merged 4 commits intodevelopfrom
rider/new_cap

Conversation

@Rider-Linden
Copy link
Copy Markdown
Collaborator

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

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

…ough the JSON RPC interface to the viewer. IF syntax.cache is not implemented on the viewer continue using the old method.
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

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_cache feature support in SynchService and 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.

Comment thread src/synchservice.ts
Comment thread src/synchservice.ts
Comment thread src/shared/languageservice.ts
Comment thread src/pluginsupport.ts
@Rider-Linden Rider-Linden changed the title Rider/new cap Retrieve pregenerated tool config files from cache on viewer. Apr 30, 2026
@WolfGangS
Copy link
Copy Markdown
Contributor

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?

@Rider-Linden
Copy link
Copy Markdown
Collaborator Author

Rider-Linden commented Apr 30, 2026

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.

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

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.cache and language.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.

Comment thread src/pluginsupport.ts
Comment on lines +298 to +325
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;
}
@Rider-Linden Rider-Linden merged commit fdb1655 into develop Apr 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants