You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current virtual code always accesses variables through __VLS_ctx to obtain the unref type without breaking the template type narrowing.
The Vue SFC Compiler statically analyzes variables that are safe to access directly, but otherwise wrap unref. (We cannot use unref for virtual code because this breaks template type narrowing)
The way to reuse SFC Compiler analysis is to use require('@vue/compiler-sfc').compileScript.bindings, but this is not a suitable method for two reasons.
compileScript does not support incremental updates. If you rely on this function, it will cause obvious delays in auto-complete on larger files.
Introducing @vue/compiler-sfc will cause the package size to increase.
To solve it, we need to port SFC Compiler's analysis to our parseScriptSetupRanges(), but we don't need the complete logic (SFC Compiler thinks a lot to ensure runtime safety), just implement a simplified version.
Uh oh!
There was an error while loading. Please reload this page.
The current virtual code always accesses variables through
__VLS_ctx
to obtain the unref type without breaking the template type narrowing.The Vue SFC Compiler statically analyzes variables that are safe to access directly, but otherwise wrap unref. (We cannot use unref for virtual code because this breaks template type narrowing)
The way to reuse SFC Compiler analysis is to use
require('@vue/compiler-sfc').compileScript.bindings
, but this is not a suitable method for two reasons.@vue/compiler-sfc
will cause the package size to increase.To solve it, we need to port SFC Compiler's analysis to our
parseScriptSetupRanges()
, but we don't need the complete logic (SFC Compiler thinks a lot to ensure runtime safety), just implement a simplified version.This will resolve #2377 (comment), #3409
The text was updated successfully, but these errors were encountered: