-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open charts from tooltips #20
Comments
I'm trying to figure out how to use the Autometrics hover tooltips to open their queries inside the VS Code extension's chart panel. My idea was the extension should just intercept clicks to the Prometheus URL and handle them internally, but as far as I can find, VS Code actually won't let you do that. The only URLs you can handle are those with a special prefix that is registered by the extension, which means that -- in case of the Rust implementation -- the doc string generated by the macro must generate URLs with the VS Code extension prefix in them. Maybe this is not a huge issue, because users can just set their @emschwartz can you maybe think think of a way how we might be able to let the extension inject the prefix into the macro config? |
Hmm. Just brainstorming here but these are the things that come to mind:
|
Yeah, I'm afraid letting it modify env vars used by Looking for it in a file was also a last resort I thought of, though not really desirable since people will most likely want to put it in their |
This seems somewhat related (but unfortunately it's unresolved) microsoft/vscode#152806 |
Internally, they even seem to have an option for setting extra environment variables as well: https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs#L108 I do suppose we could ask them if they would accept a PR to open up this functionality... |
I tried setting both of these in "rust-analyzer.cargo.extraEnv": {
"rustc-env": "PROMETHEUS_URL=vscode://"
} and: "rust-analyzer.cargo.extraEnv": {
"PROMETHEUS_URL": "vscode://"
} But no dice... |
Bingo, it's actually this one: "rust-analyzer.server.extraEnv": {
"PROMETHEUS_URL": "..."
} I will first try if I can really catch it that way. But then we just need to figure out if we can set that setting programmatically, or if we just need a bit more elaborate setup instructions. Another complication is that the |
@emschwartz I suppose we could do a lookup for |
Ran into another snag. My extension is now able to catch the URI |
One thing that does work is this: vscode.workspace
.getConfiguration("rust-analyzer")
.update("server.extraEnv", {
PROMETHEUS_URL: "vscode://fiberplane.autometrics",
}); |
I have opened an issue with VS Code to ask for suggestions on how we might be able to intercept links (or whether they might be open to implementing such a feature): microsoft/vscode#181320 |
Right now we've got support for:
|
@flenter what's the basic part about the Rust support? Anything you need from the library side? |
I was under the assumption that the currently implemented logic for rust was actually detecting whether the function is using the autometrics trait. But that's not the case, the extension right now assumes that all functions have been decorated. It seems like there's more stuff to be done here. Rust support should probably be disabled by default, if we want to ship the extension or start working on a solution similar to what's discussed here: #29 |
Our Autometrics tooltips contain queries. Currently, those point to external URLs, but when we have charts inside the extension, we want to open them right there for a consistent experience.
One complicating factor is that different languages have different mechanisms for opening tooltips. Some rely on the extension itself, which is likely easier to intercept, but for instance Autometrics-rs generates Rustdoc strings, which we may need to detect somehow.
Charts should consistently open within the extension, regardless of language.
The text was updated successfully, but these errors were encountered: