Skip to content

Commit 3c6378b

Browse files
authored
Merge pull request #528 from kcl-lang/feat-docs-0.12
feat: add 0.12 docs
2 parents 0c06463 + 8f49fd2 commit 3c6378b

File tree

380 files changed

+66538
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+66538
-440
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ yarn-error.log*
2222

2323
.vscode/
2424
.idea/
25-
.kclvm
25+
.kcl
2626
.terraform
2727
.terraform.lock.hcl
28+
pnpm-lock.yaml

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11
1+
0.12

blog/2024-11-14-newsletter/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Thanks to all community participants over the past two weeks, listed in no parti
3535

3636
- Supports hint for config entry key type
3737
- Optimized static analysis of unpacking expressions `**expr`, providing richer diagnostic information
38-
- Optimized code snippet completion for schema types `{}`
38+
- Optimized code snippet completion for schema types `{}`
3939
- Added monitoring for changes in `kcl.mod` files, improving external package completion experience
4040
- Differentiated highlight colors for `any` type and `any` keyword expressions
4141

blog/2024-12-24-kcl-0.11.0-release/index.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The KCL team is pleased to announce that **KCL v0.11.0 is now available**! This
2020

2121
**We would like to extend our heartfelt thanks to all community contributors who participated in the iteration from version v0.10 to v0.11. The following list is in no particular order.**
2222

23-
_@adamwg, @steeling, @dennybaa, @liangyuanpeng, @NishantBansal2003, @mayrf, @eminaktas, @Gmin2, @tvandinther, @diefans, @nkabir, @suin, @Chewie, @lwz23, @eminaktas,@steeling, @bozaro, @cakemanny, @Yufeireal, @andrzejgorski, @yonas, @dansrogers, @SkySingh04, @jellllly420, @slashexx, @xnull, @diefans, @zflat, @vfarcic, @spastorclovr, @patpicos, @mproffitt, @fraenkel, @irizzant, @vfarcic, @patpicos, @mproffitt, @fraenkel, @Clint, @Christopher Haar, @ron18219, @Zack Zhang, @Alexander Fuchs, @Smaine Kahlouch, @Yvan da Silva, @Jakob Maležič, @Ryan Rueth, @Christopher Haar, @kesser, @Justin B, @Evgeny Shepelyuk, @Smaine Kahlouch, @KennyZ, @Mark Altmann (Wompi), @Peter Boat, @Hai Wu, @Evgeny Shepelyuk, @anshuman singh, @Carl-Fredrik, @Larry Gadallah, @Kevin Sztern, @Nick Atzert, @Tobias Kässer, @Mike, @john thompson, @Sky Singh, @suin, @Tom van Dinther, @Stefano Borrelli, @Valer Orlovsky, @Jacob Colvin, @Sjuul Janssen, @Vyacheslav Terdunov, @Yury Tsarev_
23+
_@adamwg, @steeling, @dennybaa, @liangyuanpeng, @NishantBansal2003, @mayrf, @eminaktas, @Gmin2, @tvandinther, @diefans, @nkabir, @suin, @Chewie, @lwz23, @eminaktas,@steeling, @bozaro, @cakemanny, @Yufeireal, @andrzejgorski, @yonas, @dansrogers, @SkySingh04, @jellllly420, @slashexx, @xnull, @diefans, @zflat, @vfarcic, @spastorclovr, @patpicos, @mproffitt, @fraenkel, @irizzant, @vfarcic, @patpicos, @mproffitt, @fraenkel, @Clint, @Christopher Haar, @ron18219, @Zack Zhang, @Alexander Fuchs, @Smaine Kahlouch, @Yvan da Silva, @Jakob Maležič, @Ryan Rueth, @Christopher Haar, @kesser, @Justin B, @Evgeny Shepelyuk, @Smaine Kahlouch, @KennyZ, @Mark Altmann (Wompi), @Peter Boat, @Hai Wu, @Evgeny Shepelyuk, @anshuman singh, @Carl-Fredrik, @Larry Gadallah, @Kevin Sztern, @Nick Atzert, @Tobias Kässer, @Mike, @john thompson, @Sky Singh, @suin, @Tom van Dinther, @Stefano Borrelli, @Valer Orlovsky, @Jacob Colvin, @Sjuul Janssen, @Vyacheslav Terdunov, @Yury Tsarev_
2424

2525
## 📚 Key Updates
2626

@@ -30,16 +30,15 @@ _@adamwg, @steeling, @dennybaa, @liangyuanpeng, @NishantBansal2003, @mayrf, @emi
3030

3131
- KCL supports Alpine Linux(musl) platform.
3232
- KCL refactored the implementation of the Parser and reorganized the parse process of import dependencies.
33-
- KCL optimized the type parsing of ** expressions in schema attributes.
33+
- KCL optimized the type parsing of \*\* expressions in schema attributes.
3434
- KCL fixed the problem that lambda expressions do not work when nested calls.
3535
- KCL fixed the memory leak problem of schema mixin parse.
3636
- KCL fixed the type promotion in function call expressions in assignment statements with type declarations.
3737
- KCL fixed the error of lambda functions calling attr in mixin
3838

39-
4039
#### Toolchain
4140

42-
- Package management tool version selection algorithm is released. In v0.11.0, the KCL package management tool supports the selection of different version numbers of the same tripartite library that appears in the dependency graph. The KCL package management tool refers to the mvs algorithm of go mod.
41+
- Package management tool version selection algorithm is released. In v0.11.0, the KCL package management tool supports the selection of different version numbers of the same tripartite library that appears in the dependency graph. The KCL package management tool refers to the mvs algorithm of go mod.
4342

4443
To ensure as much compatibility as possible, package management tools currently prefer to select the latest version that appears in the dependency diagram rather than the latest version that has already been released.
4544

@@ -56,11 +55,11 @@ In v0.11.0, the new cache structure is turned off by default, and the new local
5655

5756
- KCL IntelliJ plugin released 0.4.0, supporting LSP4IJ.
5857
- IDE can complete schemas defined in the worksace but not imported , and automatically insert the import statements of the package.
59-
![complete](/img/blog/2024-12-06-kcl-0.11.0-release/complete.gif)
58+
![complete](/img/blog/2024-12-06-kcl-0.11.0-release/complete.gif)
6059
- IDE adds type hints for key in the Config block.
61-
![hint](/img/blog/2024-12-06-kcl-0.11.0-release/hint.png)
60+
![hint](/img/blog/2024-12-06-kcl-0.11.0-release/hint.png)
6261
- IDE hover provides schema attribute default value information.
63-
![hover](/img/blog/2024-12-06-kcl-0.11.0-release/hover.png)
62+
![hover](/img/blog/2024-12-06-kcl-0.11.0-release/hover.png)
6463
- IDE fixed the failure of Windows path issues.
6564
- IDE fixed the failure of compound assignment operation statements.
6665
- IDE distinguished the highlighting of the `any` from keyword and type.

docs/reference/model/net.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ assert net.split_host_port("[::1]:80") == ["::1", "80"]
2828
`join_host_port(host: str, port: int | str) -> str`
2929

3030
Combines `host` and `port` into a network address of the form `host:port`.
31-
If `host` contains a colon, as found in an IPv6 address literal, then returns `[host]:port`.
31+
If `host` contains a colon, as found in an IPv6 address literal, then returns `[host]:port`.
3232

3333
```python
3434
import net
@@ -277,7 +277,7 @@ Calculates a subnet of the CIDR `cidr`.
277277
Extends the prefix of `cidr` by `additional_bits`. For example, if `cidr` is
278278
a `/18` and `additional_bits` is `6`, then the result will be a `/24`.
279279

280-
`net_num` is a non-negative number used to populate the bits added to the prefix.
280+
`net_num` is a non-negative number used to populate the bits added to the prefix.
281281

282282
```python
283283
import net

docs/reference/xlang-api/c-api.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@ int exec_file(const char* file_str) {
3535
};
3636
struct Buffer* files[] = { &file };
3737
struct RepeatedString strs = { .repeated = &files[0], .index = 0, .max_size = 1 };
38-
ExecProgram_Args args = ExecProgram_Args_init_zero;
38+
ExecProgramArgs args = ExecProgramArgs_init_zero;
3939
args.k_filename_list.funcs.encode = encode_str_list;
4040
args.k_filename_list.arg = &strs;
4141

4242
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
43-
status = pb_encode(&stream, ExecProgram_Args_fields, &args);
43+
status = pb_encode(&stream, ExecProgramArgs_fields, &args);
4444
message_length = stream.bytes_written;
4545

4646
if (!status) {
4747
printf("Encoding failed: %s\n", PB_GET_ERROR(&stream));
4848
return 1;
4949
}
5050

51-
const char* api_str = "KclvmService.ExecProgram";
51+
const char* api_str = "KclService.ExecProgram";
5252
size_t result_length = call_native((const uint8_t*)api_str, strlen(api_str), buffer, message_length, result_buffer);
5353
if (check_error_prefix(result_buffer)) {
5454
printf("%s", result_buffer);
5555
return 1;
5656
}
5757
pb_istream_t istream = pb_istream_from_buffer(result_buffer, result_length);
5858

59-
ExecProgram_Result result = ExecProgram_Result_init_default;
59+
ExecProgramResult result = ExecProgramResult_init_default;
6060

6161
uint8_t yaml_value_buffer[BUFFER_SIZE] = { 0 };
6262
result.yaml_result.arg = yaml_value_buffer;
@@ -74,7 +74,7 @@ int exec_file(const char* file_str) {
7474
result.log_message.arg = log_value_buffer;
7575
result.log_message.funcs.decode = decode_string;
7676

77-
status = pb_decode(&istream, ExecProgram_Result_fields, &result);
77+
status = pb_decode(&istream, ExecProgramResult_fields, &result);
7878

7979
if (!status) {
8080
printf("Decoding failed: %s\n", PB_GET_ERROR(&istream));
@@ -115,31 +115,31 @@ int validate(const char* code_str, const char* data_str)
115115
size_t message_length;
116116
bool status;
117117
118-
ValidateCode_Args validate_args = ValidateCode_Args_init_zero;
118+
ValidateCodeArgs validate_args = ValidateCodeArgs_init_zero;
119119
validate_args.code.funcs.encode = encode_string;
120120
validate_args.code.arg = (void*)code_str;
121121
validate_args.data.funcs.encode = encode_string;
122122
validate_args.data.arg = (void*)data_str;
123123
124124
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
125-
status = pb_encode(&stream, ValidateCode_Args_fields, &validate_args);
125+
status = pb_encode(&stream, ValidateCodeArgs_fields, &validate_args);
126126
message_length = stream.bytes_written;
127127
128128
if (!status) {
129129
printf("Encoding failed: %s\n", PB_GET_ERROR(&stream));
130130
return 1;
131131
}
132132
133-
const char* api_str = "KclvmService.ValidateCode";
133+
const char* api_str = "KclService.ValidateCode";
134134
size_t result_length = call_native((const uint8_t*)api_str, strlen(api_str), buffer, message_length, result_buffer);
135135
pb_istream_t istream = pb_istream_from_buffer(result_buffer, result_length);
136-
ValidateCode_Result result = ValidateCode_Result_init_default;
136+
ValidateCodeResult result = ValidateCodeResult_init_default;
137137
138138
result.err_message.funcs.decode = decode_string;
139139
uint8_t value_buffer[BUFFER_SIZE] = { 0 };
140140
result.err_message.arg = value_buffer;
141141
142-
status = pb_decode(&istream, ValidateCode_Result_fields, &result);
142+
status = pb_decode(&istream, ValidateCodeResult_fields, &result);
143143
144144
if (!status) {
145145
printf("Decoding failed: %s\n", PB_GET_ERROR(&istream));

docs/reference/xlang-api/cpp-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can use FetchContent to add KCL C++ Lib to your project.
2222
FetchContent_Declare(
2323
kcl-lib
2424
GIT_REPOSITORY https://github.com/kcl-lang/lib.git
25-
GIT_TAG v0.10.8 # You can change the GitHub branch tag.
25+
GIT_TAG v0.12.1 # You can change the GitHub branch tag.
2626
SOURCE_SUBDIR cpp
2727
)
2828
FetchContent_MakeAvailable(kcl-lib)

docs/reference/xlang-api/dotnet-api.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dotnet add package KclLib
1616
using KclLib.API;
1717

1818
var api = new API();
19-
var execArgs = new ExecProgram_Args();
19+
var execArgs = new ExecProgramArgs();
2020
var path = Path.Combine("test_data", "schema.k");
2121
execArgs.KFilenameList.Add(path);
2222
var result = api.ExecProgram(execArgs);
@@ -48,7 +48,7 @@ C# Code
4848
```csharp
4949
using KclLib.API;
5050

51-
var execArgs = new ExecProgram_Args();
51+
var execArgs = new ExecProgramArgs();
5252
var path = "schema.k"
5353
execArgs.KFilenameList.Add(path);
5454
var result = new API().ExecProgram(execArgs);
@@ -81,7 +81,7 @@ C# Code
8181
using KclLib.API;
8282

8383
var path = "schema.k"
84-
var args = new ParseFile_Args { Path = path };
84+
var args = new ParseFileArgs { Path = path };
8585
var result = new API().ParseFile(args);
8686
```
8787

@@ -112,7 +112,7 @@ C# Code
112112
using KclLib.API;
113113

114114
var path = "schema.k";
115-
var args = new ParseProgram_Args();
115+
var args = new ParseProgramArgs();
116116
args.Paths.Add(path);
117117
var result = new API().ListOptions(args);
118118
```
@@ -144,9 +144,9 @@ C# Code
144144
using KclLib.API;
145145

146146
var path = "schema.k";
147-
var args = new LoadPackage_Args();
147+
var args = new LoadPackageArgs();
148148
args.ResolveAst = true;
149-
args.ParseArgs = new ParseProgram_Args();
149+
args.ParseArgs = new ParseProgramArgs();
150150
args.ParseArgs.Paths.Add(path);
151151
var result = new API().LoadPackage(args);
152152
```
@@ -178,7 +178,7 @@ C# Code
178178
using KclLib.API;
179179

180180
var api = new API();
181-
var args = new ListVariables_Args();
181+
var args = new ListVariablesArgs();
182182
var path = "schema.k";
183183
args.Files.Add(path);
184184
var result = api.ListVariables(args);
@@ -210,7 +210,7 @@ C# Code
210210
using KclLib.API;
211211

212212
var path = "options.k";
213-
var args = new ParseProgram_Args();
213+
var args = new ParseProgramArgs();
214214
args.Paths.Add(path);
215215
var result = new API().ListOptions(args);
216216
```
@@ -242,9 +242,9 @@ C# Code
242242
using KclLib.API;
243243

244244
var path = "schema.k";
245-
var execArgs = new ExecProgram_Args();
245+
var execArgs = new ExecProgramArgs();
246246
execArgs.KFilenameList.Add(path);
247-
var args = new GetSchemaTypeMapping_Args();
247+
var args = new GetSchemaTypeMappingArgs();
248248
args.ExecArgs = execArgs;
249249
var result = new API().GetSchemaTypeMapping(args);
250250
```
@@ -275,7 +275,7 @@ C# Code
275275
```csharp
276276
using KclLib.API;
277277

278-
var args = new OverrideFile_Args
278+
var args = new OverrideFileArgs
279279
{
280280
File = "main.k",
281281
};
@@ -303,7 +303,7 @@ string sourceCode = "schema Person:\n" + " name: str\n" + " age: int\
303303
string expectedFormattedCode = "schema Person:\n" + " name: str\n" + " age: int\n\n" + " check:\n"
304304
+ " 0 < age < 120\n\n";
305305
var api = new API();
306-
var args = new FormatCode_Args();
306+
var args = new FormatCodeArgs();
307307
args.Source = sourceCode;
308308
var result = api.FormatCode(args);
309309
```
@@ -335,7 +335,7 @@ C# Code
335335
using KclLib.API;
336336

337337
var api = new API();
338-
var args = new FormatPath_Args();
338+
var args = new FormatPathArgs();
339339
var path = "format_path.k";
340340
args.Path = path;
341341
var result = api.FormatPath(args);
@@ -365,7 +365,7 @@ C# Code
365365
using KclLib.API;
366366

367367
var path = "lint_path.k"
368-
var args = new LintPath_Args();
368+
var args = new LintPathArgs();
369369
args.Paths.Add(path);
370370
var result = new API().LintPath(args);
371371
bool foundWarning = result.Results.Any(warning => warning.Contains("Module 'math' imported but unused"));
@@ -394,7 +394,7 @@ schema Person:
394394
0 < age < 120
395395
";
396396
string data = "{\"name\": \"Alice\", \"age\": 10}";
397-
var args = new ValidateCode_Args
397+
var args = new ValidateCodeArgs
398398
{
399399
Code = code,
400400
Data = data,
@@ -425,10 +425,10 @@ C# Code
425425
```csharp
426426
using KclLib.API;
427427

428-
Rename_Args args = Rename_Args.newBuilder().setPackageRoot(".").setSymbolPath("a")
428+
RenameArgs args = RenameArgs.newBuilder().setPackageRoot(".").setSymbolPath("a")
429429
.addFilePaths("main.k").setNewName("a2").build();
430430
API apiInstance = new API();
431-
Rename_Result result = apiInstance.rename(args);
431+
RenameResult result = apiInstance.rename(args);
432432
```
433433

434434
</p>
@@ -446,7 +446,7 @@ C# Code
446446
```csharp
447447
using KclLib.API;
448448

449-
var args = new RenameCode_Args
449+
var args = new RenameCodeArgs
450450
{
451451
PackageRoot = "/mock/path",
452452
SymbolPath = "a",
@@ -472,7 +472,7 @@ C# Code
472472
using KclLib.API;
473473

474474
var pkg = Path.Combine(parentDirectory, "test_data", "testing");
475-
var args = new Test_Args();
475+
var args = new TestArgs();
476476
args.PkgList.Add(pkg + "/...");
477477
var result = new API().Test(args);
478478
```
@@ -504,7 +504,7 @@ using KclLib.API;
504504

505505
var workDir = ".";
506506
var settingsFile = "kcl.yaml";
507-
var args = new LoadSettingsFiles_Args
507+
var args = new LoadSettingsFilesArgs
508508
{
509509
WorkDir = workDir,
510510
};
@@ -541,7 +541,7 @@ C# Code
541541
using KclLib.API;
542542

543543
var manifestPath = "module";
544-
var args = new UpdateDependencies_Args { ManifestPath = manifestPath };
544+
var args = new UpdateDependenciesArgs { ManifestPath = manifestPath };
545545
var result = new API().UpdateDependencies(args);
546546
```
547547

@@ -584,9 +584,9 @@ API api = new API();
584584

585585
var manifestPath = "module";
586586
var testFile = Path.Combine(manifestPath, "main.k");
587-
var updateArgs = new UpdateDependencies_Args { ManifestPath = manifestPath };
587+
var updateArgs = new UpdateDependenciesArgs { ManifestPath = manifestPath };
588588
var depResult = new API().UpdateDependencies(updateArgs);
589-
var execArgs = new ExecProgram_Args();
589+
var execArgs = new ExecProgramArgs();
590590
execArgs.KFilenameList.Add(testFile);
591591
execArgs.ExternalPkgs.AddRange(depResult.ExternalPkgs);
592592
var execResult = new API().ExecProgram(execArgs);
@@ -607,7 +607,7 @@ C# Code
607607
```csharp
608608
using KclLib.API;
609609

610-
var result = new API().GetVersion(new GetVersion_Args());
610+
var result = new API().GetVersion(new GetVersionArgs());
611611
```
612612

613613
</p>

0 commit comments

Comments
 (0)