vscode-npm-gui icon indicating copy to clipboard operation
vscode-npm-gui copied to clipboard

Implement Copy Installation Package Command for Script & Interactive

Open xbotter opened this issue 8 months ago • 0 comments

Summary: This pull request introduces a new feature to the NuGet Package Manager GUI that allows users to copy a NuGet package installation command for script directly to the clipboard.
This is achieved by adding a new "Copy" button in the package installation interface and implementing the corresponding backend service to handle the copy
action. The feature enhances the user experience by providing a quick and easy way to copy package references for use in other applications or documents.

Changes:

  1. Front-end Changes:

    • Modified install-package.component.html to include a new "Copy" button next to the "Install" button for each package listed in the GUI.
    • Updated install-package.component.ts by adding a new copy method that triggers the loading animation, calls the copyPackage service with the
      selected package name and version, and then stops the loading animation once the operation is complete.
  2. Service Layer Updates:

    • Updated command.service.ts to include a new copyPackage method that creates an observable to send the nugetpackagemanagergui.copyPackage command
      along with the package name and selected version to the backend.
  3. Extension Backend Enhancements:

    • Modified extension.ts to register a new command nugetpackagemanagergui.copyPackage that calls the copy function from the newly created copy.service.ts.
    • Added a new file copy.service.ts that contains the copy function. This function constructs the package reference string and uses the Visual Studio
      Code API to write it to the system clipboard.

xbotter avatar May 28 '24 11:05 xbotter