simplify extension API context impl
Created by: sqs
The getComputedContextProperty function is called to provide the values for extension context keys such as resource.uri
(for extensions to define actions that, when invoked, call a function with the URI of the currently visible document).
Now, instead of getComputedContextProperty parsing the requested key (such as resource.uri
) and running custom code to return each key's value, it constructs a JavaScript object with all possible keys and just indexes into that object.
Finally, the getComputedContextProperty is renamed to computeContext. It now always returns the entire computed context data as a map, instead of computing the value per-key. This is a simplification because it enforces that there must be no special per-key computation; the context can be treated as a map instead of as an interface with an arbitrary {get(key:string): any}
function.
This is not expected to have any impact on extensions. It does slightly change the behavior, such as context expressions that used to return null
now return undefined
. I will search existing extension code for potential backcompat problems and will test it more before merging.