Skip to content
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

Configurable Command Plugin Build Configuration #1365

Open
MahdiBM opened this issue Feb 9, 2025 · 3 comments
Open

Configurable Command Plugin Build Configuration #1365

MahdiBM opened this issue Feb 9, 2025 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@MahdiBM
Copy link
Contributor

MahdiBM commented Feb 9, 2025

Configurable Command Plugin Permissions changes are working very nicely and have resolved the other issue I had filed.

We should add build configuration to the list of configurable settings too, for heavier operations.

Example:

time swift package -c release --allow-writing-to-package-directory generate-code-from-openapi
...
________________________________________________________
Executed in   32.80 secs    fish           external
   usr time   49.43 secs    0.11 millis   49.43 secs
   sys time    0.81 secs    1.46 millis    0.80 secs
time swift package --allow-writing-to-package-directory generate-code-from-openapi
...
________________________________________________________
Executed in   68.68 secs    fish           external
   usr time  115.34 secs    0.12 millis  115.34 secs
   sys time    1.44 secs    1.74 millis    1.44 secs

The non-release version takes more than twice as much to finish, wasting ~36 seconds.

This is with hello-world-async-http-client-example and replacing openapi.yaml with GitHub's on my M1 Macbook Pro.

@award999
Copy link
Contributor

The swift-plugin task type can take freeform args. Is there a strong justification to tie this to a setting?

@MahdiBM
Copy link
Contributor Author

MahdiBM commented Feb 12, 2025

Hmm I'd say yes for this one? It should also be fine if you were to implement this in a more free-form way. Like accepting package-command-args. But it should be separate for each plugin as most plugins are not worth release-building.

@award999
Copy link
Contributor

we can add a setting for default package command args similar to what is done for package resolve

@award999 award999 moved this from Unscreened to Todo in Swift Extension for Visual Studio Code Feb 26, 2025
plemarquand added a commit to plemarquand/vscode-swift that referenced this issue Feb 26, 2025
Packages can define their own plugins either directly or through
their dependencies. These plugins define commands, and the extension
exposes a list of these when you use `> Swift: Run Command Plugin`.

It may be desirable to build and run these plugins with specific
arguments. This patch introduces a new setting that can be specified
globally or on a per workspace folder basis that allows users to
configure arguments to pass to plugin command invocations.

The setting is defined under `swift.pluginArguments`, and is specified
as an object in the following form:

```json
{
	"PluginCommandName:intent-name": ["--some", "--args"]
}
```

- The top level string key is the command id in the form
  `PluginCommandName:intent-name`. For instance, swift-format's
  format-source-code command would be specified as
  `swift-format:format-source-code`
- Specifying `PluginCommandName` will apply the arguments to all intents
  in the command plugin
- Specifying `*` will apply the arguments to all commands.

This patch also adds this wildcard functionality to the
`swift.pluginPermissions` setting.

Issue: swiftlang#1365
plemarquand added a commit to plemarquand/vscode-swift that referenced this issue Feb 26, 2025
Packages can define their own plugins either directly or through
their dependencies. These plugins define commands, and the extension
exposes a list of these when you use `> Swift: Run Command Plugin`.

It may be desirable to build and run these plugins with specific
arguments. This patch introduces a new setting that can be specified
globally or on a per workspace folder basis that allows users to
configure arguments to pass to plugin command invocations.

The setting is defined under `swift.pluginArguments`, and is specified
as an object in the following form:

```json
{
	"PluginCommandName:intent-name": ["--some", "--args"]
}
```

- The top level string key is the command id in the form
  `PluginCommandName:intent-name`. For instance, swift-format's
  format-source-code command would be specified as
  `swift-format:format-source-code`
- Specifying `PluginCommandName` will apply the arguments to all intents
  in the command plugin
- Specifying `*` will apply the arguments to all commands.

This patch also adds this wildcard functionality to the
`swift.pluginPermissions` setting.

Issue: swiftlang#1365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants