Why does TS/IDE Completions not show the same prop...
# package-development
w
Using
umb-debug
has been useful to see what's around to consume from the element I am at/creating. Just weird I don't get the same completions. So is it something not exported from the libraries/source code, my IDE or me just doing something wrong ?!
j
The workspace context that you see with umb-debug is the actual context instance. Your vscode only has the typings of the generic one, since that is the one you are consuming. The one in your umb-debug window looks like the
UMB_DOCUMENT_WORKSPACE_CONTEXT
which, if you consumed that, you could get IntelliSense for
w
Yeh figured that out eventually
Maybe suggestion/issue @Jacob Overgaard to improve umb-debug to list the token or something so I knew to look at
UMB_DOCUMENT_WORKSPACE_CONTEXT
as opposed to just
UMB_WORKSPACE_CONTEXT
Would that kind of info be possible to provide upto umb-debug ?
n
It's a bit cheeky, but you can typecast the context to any to get access to the instance rather than the interface. Do it, but don't tell anyone you did it.
w
No I gonna get a massive banner that says Nath said I should 😛
j
But that is the token (UmbWorkspaceContext). It's because it is generic, so we want you to be able to consume that to "figure out" where you are. You are supposed to typecast it when you have that figured out, or if you know that you are ever only going to display your view for Documents, you can consume the document context directly.
w
Yeh just a bit confusing umb debug says workspacecontext with all these interesting props & methods then you go use it and find out it has hardly anything. It was only just by fluke I stumbled across the document workspace one. So if umb debug could say which prop & methods are from the generic and which are from the other would be useful for discoverability. Half of the battle learning this stuff is knowing what stuff is where.
4 Views