-
Notifications
You must be signed in to change notification settings - Fork 282
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
Support letting a language server provide additional metadata on values #284
Comments
Thanks for the kind words! Indeed, something we're talking about that would provide several things is the ability for language implementations in the editor to provide 'helper' APIs that debug adapters can use. This has many use cases--being able to figure out how to handle hovers correctly, better intellisense and autocompletion in the debug console/repl, figuring out renamed/mapped variables (like TS imports). In your example, maybe there would be a way for the debug extension to ask the language server the metadata for a symbol in the current scope--the debug server knows the runtime position and the value of cc @weinand |
There are at least two obstacles that make collaboration between language servers and debuggers more difficult than expected:
|
I'd love to revive this discussion! I think this is not that far out of reach. JS Debug could provide a typescript language server plugin that exposes a command function getNumberDisplay(value: number, expression: string, scope: Range, uri: Uri): Promise<Display | undefined> {}
type Display = { value: string } | { functionExpression: string }; Const Enum Exampleconst enum Foo {
A = 1,
B = 2,
}
const x = Foo.A;
console.log(x);
const y = { kind: Foo.B };
User Defined Example/**
* @display {x => x.toString(2)}
*/
type Binary = number;
const binX: Binary = 0b11011;
Evaluate requests that resolve an expression to a number could then use this command to improve the representation. I don't think |
👋 been enjoying this extension, great work.
It's a bit of a blue-sky idea, but an interesting case would be enum values.
For example selecting
kind
in the editor below could request some kind extended metadata about the raw value. So it would have the chance go from this:To this:
And maybe type information could then be available if you keep the mouse hovering?
The text was updated successfully, but these errors were encountered: