-
Notifications
You must be signed in to change notification settings - Fork 334
Fix type graph viewer to display scopeless decorator state #9541
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
| import { describe, expect, it } from "vitest"; | ||
| import { ObjectInspector } from "./object-inspector.js"; | ||
|
|
||
| describe("ObjectInspector", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove top level describe, just keep the content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3f44231 - removed the nested describe blocks and kept only the test functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot revert those change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pnpm-workspace.yaml file was not modified in the commits - it appears unchanged in the PR.
| } | ||
| } | ||
|
|
||
| // Also iterate over Symbol keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I think this should be simplified. Why not originally list all string and symbol properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified in 3f44231 - now getting all string and Symbol properties upfront using spread operator, then processing them together in a single iteration loop.
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
|
/azp run typespec - pr tools |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
You can try these changes here
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This is a good start but it doesn't show up in the collapsed object preview, only when expanded, why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c64db10. The issue was that object-preview.tsx was using a for...in loop which only iterates over enumerable string properties. Updated it to use Object.getOwnPropertyNames() and Object.getOwnPropertySymbols() to include Symbol keys, matching the approach in object-inspector.tsx. Symbol properties now appear in both collapsed and expanded views.
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Fix type graph viewer to display scopeless decorator state
Scopeless decorators (e.g.,
@clientName("enabled")without ascopeparameter) store their state using Symbol keys. The type graph viewer's ObjectInspector and ObjectPreview only iterated over string properties viaObject.getOwnPropertyNames()andfor...inloops, causing Symbol-keyed decorator state to appear empty in both expanded and collapsed views.Changes:
object-inspector.tsxusingObject.getOwnPropertySymbols()object-preview.tsxto show Symbol properties in collapsed viewgetPropertyValue()inproperty-utils.tsxto acceptstring | symbolsortObjectKeysis enabledExample:
Previously, the decorator data would render as
Symbol(...): { }in both collapsed and expanded views. Now it correctly displays the decorator properties in both the collapsed object preview and the expanded inspector view.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.