Skip to content

Bug/318 the list of metadata types is updated only when a metadata type is added or removed#342

Closed
anasilva105 wants to merge 6 commits intomainfrom
bug/318-the-list-of-metadata-types-is-updated-only-when-a-metadata-type-is-added-or-removed
Closed

Bug/318 the list of metadata types is updated only when a metadata type is added or removed#342
anasilva105 wants to merge 6 commits intomainfrom
bug/318-the-list-of-metadata-types-is-updated-only-when-a-metadata-type-is-added-or-removed

Conversation

@anasilva105
Copy link
Copy Markdown
Collaborator

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

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • test scripts updated
  • Wiki updated (if applicable)

…d-only-when-a-metadata-type-is-added-or-removed
@JoernBerkefeld JoernBerkefeld requested a review from Copilot March 24, 2026 22:19
…d-only-when-a-metadata-type-is-added-or-removed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 call mcdev.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.

Comment on lines +371 to +374
// 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) {
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls fix

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executeTerminalCommand always returns the full json and not in chunks... I'm not sure what to do with this one.

@anasilva105
Copy link
Copy Markdown
Collaborator Author

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?

@anasilva105
Copy link
Copy Markdown
Collaborator Author

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?

@JoernBerkefeld

@JoernBerkefeld
Copy link
Copy Markdown
Contributor

declined this change because we now need this to be granular. overruled by 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] The list of metadata types is updated only when a metadata type is added or removed.

3 participants