ScriptingWorkspace class abstract

A workspace represents a collection of files that are likely related (usually part of a single Rive file).

Constructors

ScriptingWorkspace()

Properties

builtinDefinitionKeys List<String>
no setter
builtinDefinitions String
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosing bool
Whether this workspace is closing or has been closed. When true, no further async work can be scheduled.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

autocomplete(String scriptName, ScriptPosition position) Future<AutocompleteResult>
Get possible autocompletion results at position in script with name scriptName. Uses the Luau frontend \u2014 see autocompleteWGSL for WGSL-backed assets.
autocompleteWGSL(String scriptName, ScriptPosition position) Future<AutocompleteResult>
Get possible autocompletion results at position in a WGSL source with name scriptName. Uses the naga-backed WGSL frontend.
builtinDefinition(String key) String
checkNeedsRecompile(String scriptId) Future<bool>
Check if a script needs to be recompiled (source changed since last compile). Returns true if the script has never been compiled or if the source has changed.
checkScriptsWithRequires() → void
clearScriptDiffSource(String scriptId) → void
Clear the diff source for a module with scriptId.
compile(String scriptName, {bool failOnErrors = false, bool compileDependencies = false, OptimizationLevel optimizationLevel = OptimizationLevel.medium, DebugLevel debugLevel = DebugLevel.medium}) Future<CompileResult?>
Retrieves the bytecode for module named scriptName.
compileAndSign(Iterable<String> scriptNames, Uint8List privateKey, {bool failOnErrors = false, OptimizationLevel optimizationLevel = OptimizationLevel.medium, DebugLevel debugLevel = DebugLevel.medium, int shaderOutputFlags = 0}) Future<CompileAndSignResult?>
Retrieves the bytecode for listed modules and signature.
completeInsertion(String scriptName, ScriptPosition position) Future<InsertionCompletion>
Get extra text insertion to be auto-completed at the given position.
completeWork(Completer completer, ScriptingWorkspaceResponseResult response) → void
configureGPUFromRenderTexture(RenderTexture? renderTexture) → void
Configures GPU contexts on this workspace from a RenderTexture. On web, extracts ore/render context pointers directly from the texture's JS renderer object, avoiding global state. On native (FFI), delegates to initGPUScripting + setOreContext + setRenderContext as before.
dispose() → void
Dispose of the workspace, any further calls will not work.
findInFiles(Iterable<String>? inclusionSet, String query, {bool caseSensitive = false, bool matchWholeWord = false, bool regularExpression = false, bool trim = true}) Future<FindInFilesResult>
Searches for query in files. If inclusionSet is provided, only those files are searched, otherwise all non-built-in files are searched.
format(String scriptName) Future<FormatResult>
Formats module named scriptName.
fullProblemReport() Future<List<ScriptProblemResult>>
Get an error report for all the script files in this workspace.
getDefinition(String scriptName, ScriptPosition position) Future<DefinitionResult>
Get definition information at position in script with name scriptName.
getDiffSourceLine(String scriptId, int line) Future<String>
Get a specific line from the diff source for a module with scriptId. Returns the line content when ready, or empty string if the line doesn't exist or no diff source is available.
implementedType(String scriptName) Future<ImplementedType?>
Retrieves the implemented type for module named scriptName.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
problemReport(String scriptName) Future<ScriptProblemResult>
Get an error report for a script file with identified by scriptName.
registerCompleter<T>(int workId) Future<T>
removeLibraryImport(int callerLibraryId, int callerLibraryVersionId, String name) → void
Remove the import edge for name from the caller scope.
removeScriptSource(String scriptId) → void
requestVM({int factoryPointer = 0}) Future<VMResult?>
Request a fresh VM with all scripts compiled and registered in dependency order. Returns a VMResult with the VM pointer and registered module list.
responseForWork(int workId) ScriptingWorkspaceResponseResult
rewriteRequires(String scriptId) Future<String>
The statically linked source for scriptId: every constant require resolved to its registered name. Export flows compile elsewhere without this workspace's import state, so they send this instead of raw source.
rowHighlight(String scriptName, int row) Uint32List
Get the highlight data for a single row of scriptName.
setLibraryCanonicalName(int libraryId, int libraryVersionId, String canonicalName) → void
Canonical mangle prefix for a library version, e.g. draco@3. Compiled requires and exported wire names both derive from it, so the editor pushes one map for both.
setLibraryImport(int callerLibraryId, int callerLibraryVersionId, String name, int targetLibraryId, int targetLibraryVersionId) → void
One import edge: the caller scope pins name to a target library version. Root caller is (0,0). Labels live on edges, so lib: requires resolve per caller.
setOreContext(int oreContextPointer) → void
Sets the ore::Context pointer on the workspace so that VMs created via requestVM have access to GPU scripting. Call once after GPU init.
setRenderContext(int renderContextPointer) → void
Sets the gpu::RenderContext pointer on the workspace so that VMs created via requestVM can allocate RenderCanvas objects. Call once after GPU init, alongside setOreContext.
setScriptDiffSource(String scriptId, String source) Future<HighlightResult>
Set the diff source for a module with scriptId. We store the diff source on the Script so subsequent calls to setScriptSource can return line level diffs with stored source when requesting highlighting data.
setScriptScope(String scriptId, int libraryId, int libraryVersionId) → void
Scope for scriptId without a source push. Proxies stamp before their text hydrates, an empty source push would register a dead scoped module.
setScriptSource(String scriptId, String scriptName, String source, {bool highlight = false, int libraryId = 0, int libraryVersionId = 0}) Future<HighlightResult>
Set the source code for the script with scriptId. libraryId and libraryVersionId scope it to a library version, zero scope is the host file.
setSystemGeneratedSource(String scriptName, String prefix, String source) Future<HighlightResult>
setWGSLScriptSource(String scriptId, String scriptName, String source, {bool highlight = false}) Future<HighlightResult>
Set a WGSL shader source. Same as setScriptSource but marks the script as WGSL so the workspace uses naga for validation/highlighting/formatting instead of Luau.
toString() String
A string representation of this object.
inherited
workReadyCallback(int workId) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

initGPUScripting() int
Initialises GPU scripting for the current platform. Call once after the native renderer is set up (i.e. after RiveNative.init completes). Returns the ore::Context pointer address, or 0 on unsupported platforms. Pass the result to setOreContext on every workspace you create.
make({bool canvasEnabled = false}) ScriptingWorkspace
nativeFontBytes() Uint8List