You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Configurable Command Plugin Build Configuration
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: #1365
Co-authored-by: Rishi <[email protected]>
Copy file name to clipboardExpand all lines: docs/settings.md
+19-1
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ A plugin may require permissions to perform tasks like writing to the file syste
23
23
}
24
24
```
25
25
26
-
A key of `PluginName:command` will set permissions for a specific command. A key of `PluginName` will set permissions for all commands in the plugin.
26
+
A key of `PluginName:command` will set permissions for a specific command. A key of `PluginName` will set permissions for all commands in the plugin. If you'd like the same permissions to be applied to all plugins use `*` as the plugin name. Precedence order is determined by specificity, where more specific names take priority. The name `*` is the least specific and `PluginName:command` is the most specific.
27
27
28
28
Alternatively, you can define a task in your tasks.json and define permissions directly on the task. This will create a new entry in the list shown by `> Swift: Run Command Plugin`.
29
29
@@ -43,6 +43,24 @@ Alternatively, you can define a task in your tasks.json and define permissions d
43
43
}
44
44
```
45
45
46
+
If you'd like to provide specific arguments to your plugin command invocation you can use the `swift.pluginArguments` setting. Defining an array for this setting applies the same arguments to all plugin command invocations.
47
+
48
+
```json
49
+
{
50
+
"swift.pluginArguments": ["-c", "release"]
51
+
}
52
+
```
53
+
54
+
Alternatively you can specfiy which specific command the arguments should apply to using `PluginName:command`. A key of `PluginName` will use the arguments for all commands in the plugin. If you'd like the same arguments to be used for all plugins use `*` as the plugin name.
55
+
56
+
```json
57
+
{
58
+
"swift.pluginArguments": {
59
+
"PluginName:command": ["-c", "release"]
60
+
}
61
+
}
62
+
```
63
+
46
64
## SourceKit-LSP
47
65
48
66
[SourceKit-LSP](https://github.com/apple/sourcekit-lsp) is the language server used by the the Swift extension to provide symbol completion, jump to definition etc. It is developed by Apple to provide Swift and C language support for any editor that supports the Language Server Protocol.
Copy file name to clipboardExpand all lines: package.json
+24
Original file line number
Diff line number
Diff line change
@@ -444,6 +444,30 @@
444
444
"default": true,
445
445
"markdownDescription": "Controls whether or not the extension will contribute environment variables defined in `Swift: Environment Variables` to the integrated terminal. If this is set to `true` and a custom `Swift: Path` is also set then the swift path is appended to the terminal's `PATH`."
446
446
},
447
+
"swift.pluginArguments": {
448
+
"default": [],
449
+
"markdownDescription": "Configure a list of arguments to pass to command invocations. This can either be an array of arguments, which will apply to all command invocations, or an object with command names as the key where the value is an array of arguments.",
0 commit comments