forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotnet-format.ts
109 lines (105 loc) · 3.48 KB
/
dotnet-format.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
const completionSpec: Fig.Spec = {
name: "format",
description:
"Dotnet format is a code formatter that applies style preferences to a project or solution. Preferences will be read from an .editorconfig file, if present, otherwise a default set of preferences will be used",
args: {
name: "project",
description:
"The MSBuild project or solution to run code formatting on. If a project or solution file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in proj or sln, and uses that file",
isOptional: true,
generators: {
template: "filepaths",
filterTemplateSuggestions(param) {
const suffixes = [".csproj", ".sln"];
return param.filter((file) => {
if (typeof file.name === "string") {
const fileName = file.name;
return suffixes.some((suffix) => fileName.endsWith(suffix));
}
return false;
});
},
},
},
options: [
{
name: "--diagnostics",
description:
"A space-separated list of diagnostic IDs to use as a filter when fixing code style or third party issues. Default value is whichever IDs are listed in the editorconfig file",
args: {
name: "diagnostics",
},
},
{
name: "--severity",
description:
"The minumum severity of diagnostics to fix. Allowed values are info, warn, and error. The default value is warn",
args: {
name: "severity",
isOptional: true,
default: "warn",
suggestions: ["info", "warn", "error"],
},
},
{
name: "--no-restore",
description:
"Doesn't execute an implicit restore before formatting. Default is to do implicit restore",
},
{
name: "--verify-no-changes",
description:
"Verifies that no formatting changes would be performed. Terminates with a non zero exit code if any files would have been formatted",
},
{
name: "--include",
description:
"A space-separated list of relative file or folder paths to include in formatting. All files in the solution or project are formatted if empty",
args: {
name: "paths",
template: ["folders", "filepaths"],
},
},
{
name: "--exclude",
description:
"A space-separated list of relative file or folder paths to exclude from formatting. The default is none",
args: {
name: "paths",
template: ["folders", "filepaths"],
},
},
{
name: "--include-generated",
description: "Formats files generated by the SDK",
},
{
name: ["-v", "--verbosity"],
description:
"Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. Not supported in every command. See specific command page to determine if this option is available",
args: {
name: "verbosity",
suggestions: ["quiet", "minimal", "normal", "detailed", "diagnostic"],
},
},
{
name: "--binarylog",
description:
"Logs all project or solution load information to a binary log file",
args: {
name: "log",
template: "filepaths",
},
},
{
name: "--report",
description:
"Produces a JSON report in the directory specified by <REPORT_PATH>",
args: {
name: "path",
template: "folders",
},
},
],
};
export default completionSpec;