Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

The generator currently scans all dependencies in package.json to discover plugins. This prevents throwing errors when plugin DLLs are missing since regular dependencies can't be distinguished from plugins.

Changes

  • GeneratorHandler.cs: Modified GetOrderedPluginDlls to:

    • Read from plugins property instead of dependencies
    • Throw InvalidOperationException when plugin dist directory or DLLs are not found
    • Return empty list when no plugins property exists (backward compatible)
  • GeneratorHandlerTests.cs: Added tests for:

    • Missing plugin directory error case
    • Missing plugin DLL error case
    • Backward compatibility with no plugins property

Migration

Projects using plugins must move plugin entries from dependencies to a top-level plugins property. Regular dependencies remain in dependencies.

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<filter_complete></filter_complete>

<issue_title>Plugin loading should use a special property rather than just dependencies</issue_title>
<issue_description>Currently, we look under dependencies in package.json for any plugins. This is problematic because the plugins need to be built, and the generator doesn't know what dep is supposed to be a plugin so it can't throw if there is no dll found. We should instead adopt a new convention where we add a top-level property, called "plugins" and look there for any plugins. This would allow us to throw if we don't find a dll for the specified by plugin preventing downstream bugs.</issue_description>

Comments on the Issue (you are @copilot in this section)

Original prompt

This section details on the original issue you should resolve

<issue_title>Plugin loading should use a special property rather than just dependencies</issue_title>
<issue_description>Currently, we look under dependencies in package.json for any plugins. This is problematic because the plugins need to be built, and the generator doesn't know what dep is supposed to be a plugin so it can't throw if there is no dll found. We should instead adopt a new convention where we add a top-level property, called "plugins" and look there for any plugins. This would allow us to throw if we don't find a dll for the specified by plugin preventing downstream bugs.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI and others added 2 commits October 31, 2025 20:25
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Update plugin loading to use a special property Use dedicated "plugins" property in package.json for plugin loading Oct 31, 2025
Copilot AI requested a review from JoshLove-msft October 31, 2025 20:35
Copilot finished work on behalf of JoshLove-msft October 31, 2025 20:35
"@typespec/http-client-csharp": "1.0.0-alpha.20250923.2",
"@typespec/http-client-csharp": "1.0.0-alpha.20250923.2"
},
"plugins": {
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot revert thsi change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 9d7debf. The SampleService package.json now retains the original structure with logging-plugin in dependencies.

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot AI requested a review from JoshLove-msft November 1, 2025 19:39
Copilot finished work on behalf of JoshLove-msft November 1, 2025 19:39
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.

Plugin loading should use a special property rather than just dependencies

2 participants