Skip to content

Commit 0f6fcda

Browse files
authored
Refactor standard type (#69)
1 parent b48e938 commit 0f6fcda

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

api.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export enum Version {
2121
latest = v7
2222
}
2323

24+
export type CStandard = "c89" | "c99" | "c11" | "c17" | "c23";
25+
export type GnuCStandard = "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23";
26+
export type CppStandard = "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26";
27+
export type GnuCppStandard = "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
28+
2429
/**
2530
* An interface to allow VS Code extensions to communicate with the C/C++ extension.
2631
* @see [CppToolsExtension](#CppToolsExtension) for a code example.
@@ -175,8 +180,7 @@ export interface SourceFileConfiguration {
175180
/**
176181
* The C or C++ standard to emulate.
177182
*/
178-
readonly standard?: "c89" | "c99" | "c11" | "c17" | "c23" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26" |
179-
"gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
183+
readonly standard?: CStandard | GnuCStandard | CppStandard | GnuCppStandard;
180184
/**
181185
* Any files that need to be included before the source file is parsed.
182186
*/
@@ -264,8 +268,7 @@ export interface WorkspaceBrowseConfiguration {
264268
* The C or C++ standard to emulate. This field defaults to "c++17" and will only be used if
265269
* [compilerPath](#WorkspaceBrowseConfiguration.compilerPath) is set.
266270
*/
267-
readonly standard?: "c89" | "c99" | "c11" | "c17" | "c23" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26" |
268-
"gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
271+
readonly standard?: CStandard | GnuCStandard | CppStandard | GnuCppStandard;
269272
/**
270273
* The version of the Windows SDK that should be used. This field defaults to the latest Windows SDK
271274
* installed on the PC and will only be used if [compilerPath](#WorkspaceBrowseConfiguration.compilerPath)

out/api.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export declare enum Version {
1313
v7 = 7,
1414
latest = 7
1515
}
16+
export type CStandard = "c89" | "c99" | "c11" | "c17" | "c23";
17+
export type GnuCStandard = "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23";
18+
export type CppStandard = "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26";
19+
export type GnuCppStandard = "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
1620
/**
1721
* An interface to allow VS Code extensions to communicate with the C/C++ extension.
1822
* @see [CppToolsExtension](#CppToolsExtension) for a code example.
@@ -142,7 +146,7 @@ export interface SourceFileConfiguration {
142146
/**
143147
* The C or C++ standard to emulate.
144148
*/
145-
readonly standard?: "c89" | "c99" | "c11" | "c17" | "c23" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26" | "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
149+
readonly standard?: CStandard | GnuCStandard | CppStandard | GnuCppStandard;
146150
/**
147151
* Any files that need to be included before the source file is parsed.
148152
*/
@@ -219,7 +223,7 @@ export interface WorkspaceBrowseConfiguration {
219223
* The C or C++ standard to emulate. This field defaults to "c++17" and will only be used if
220224
* [compilerPath](#WorkspaceBrowseConfiguration.compilerPath) is set.
221225
*/
222-
readonly standard?: "c89" | "c99" | "c11" | "c17" | "c23" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++26" | "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu23"| "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | "gnu++23" | "gnu++26";
226+
readonly standard?: CStandard | GnuCStandard | CppStandard | GnuCppStandard;
223227
/**
224228
* The version of the Windows SDK that should be used. This field defaults to the latest Windows SDK
225229
* installed on the PC and will only be used if [compilerPath](#WorkspaceBrowseConfiguration.compilerPath)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-cpptools",
3-
"version": "7.0.4",
3+
"version": "7.1.0",
44
"description": "Public API for vscode-cpptools",
55
"typings": "./out/api.d.ts",
66
"main": "./out/api.js",

0 commit comments

Comments
 (0)