feature: maven.executable.options configuration as list of strings (#1032)

* feature: maven.executable.options configuration as list of strings

Closes #981

* fix json format in README

fix json format in README

---------

Co-authored-by: Jinbo Wang <jinbwan@microsoft.com>
This commit is contained in:
Israel Merljak 2024-11-12 06:58:57 +00:00 коммит произвёл GitHub
Родитель 80733c92df
Коммит 43618e6dff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -137,7 +137,7 @@ The usage of Maven executable is:
You can use `maven.executable.options` to specify default **options** for all your Maven commands executed in current project.
```json
{
"maven.executable.options": "-o -s ./settings.xml" // work offline, and use an alternative settings file
"maven.executable.options": "-o -s ./settings.xml" // work offline and use an alternative settings file. Can also be defined as an array of strings, e.g. ["-o", "-s ./settings.xml"]
}
```
</details>

Просмотреть файл

@ -662,7 +662,17 @@
"scope": "machine"
},
"maven.executable.options": {
"type": "string",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"default": "",
"description": "%configuration.maven.executable.options%",
"scope": "machine-overridable"
@ -852,4 +862,4 @@
"which": "^1.3.1",
"xml2js": "^0.5.0"
}
}
}

Просмотреть файл

@ -79,7 +79,11 @@ export class Settings {
return _getMavenSection("executable.path", resourceOrFilepath);
}
public static options(resourceOrFilepath?: Uri | string): string | undefined {
return _getMavenSection("executable.options", resourceOrFilepath);
const options: string | string[] | undefined = _getMavenSection("executable.options", resourceOrFilepath);
if (Array.isArray(options)) {
return options.join(' ');
}
return options;
}
public static preferMavenWrapper(resourceOrFilepath?: Uri | string): boolean {
return !!_getMavenSection<boolean>("executable.preferMavenWrapper", resourceOrFilepath);