Bug/318 the list of metadata types is updated only when a metadata type is added or removed#342
Conversation
…d-only-when-a-metadata-type-is-added-or-removed
…d-only-when-a-metadata-type-is-added-or-removed
There was a problem hiding this comment.
Pull request overview
This PR refactors background metadata-type refresh to run mcdev explainTypes --json via the existing command-execution structure, with the goal of keeping the cached metadata types list up to date when types change.
Changes:
- Removes the terminal helper that captured full stdout/stderr for commands returning structured output.
- Changes metadata types update flow to accept a JSON string and parse/compare it to detect changes.
- Updates background refresh (
refreshMetadataTypesInBackground) to callmcdev.execute("explainTypes", ...)and log via a session logger.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/utils/terminal.ts | Removes executeTerminalCommandCapture export and implementation. |
| src/devtools/metadatatypes.ts | Changes updateMetadataTypes to parse from a JSON string and compare for additions/removals/changes. |
| src/devtools/mcdev.ts | Reworks updateMetadataTypes entrypoint to accept raw command output (string). |
| src/devtools/index.ts | Updates background refresh to execute the command via mcdev.execute and adds session logging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Handler function to process the output of the 'explainTypes' command execution | ||
| const onResult = ({ output, error }: TUtils.IOutputLogger): void => { | ||
| if (output) this.mcdev.updateMetadataTypes(output); | ||
| if (error) { |
There was a problem hiding this comment.
onResult calls mcdev.updateMetadataTypes(output) for every stdout chunk. Terminal.executeTerminalCommand streams data events (and trims per chunk), so output is not guaranteed to be the full JSON and may be corrupted, causing JSON parsing failures or partial updates. Buffer stdout in this method (or add a capture mode in Terminal/Mcdev) and call updateMetadataTypes once after execute() completes, with the complete, unmodified output.
There was a problem hiding this comment.
The executeTerminalCommand always returns the full json and not in chunks... I'm not sure what to do with this one.
…d-only-when-a-metadata-type-is-added-or-removed
|
When merging main into this branch I noticed that the .vscode folder is in the repository and not included .gitignore. However the launch.json (file that allows to launch the extension) is missing from this folder. Does this make sense? |
|
|
declined this change because we now need this to be granular. overruled by 3.0.0 |
PR details
What changes did you make? (Give an overview)
Updated logic of refreshing the metadata types to follow the project command structure
...
Is there anything you'd like reviewers to focus on?
...
Checklist