Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ yarn-error.log*

.vscode/
.idea/
.kclvm
.kcl
.terraform
.terraform.lock.hcl
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11
0.12
2 changes: 1 addition & 1 deletion blog/2024-11-14-newsletter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Thanks to all community participants over the past two weeks, listed in no parti

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

Expand Down
13 changes: 6 additions & 7 deletions blog/2024-12-24-kcl-0.11.0-release/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The KCL team is pleased to announce that **KCL v0.11.0 is now available**! This

**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.**

_@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_
_@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_

## 📚 Key Updates

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

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


#### Toolchain

- 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.
- 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.

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.

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

- KCL IntelliJ plugin released 0.4.0, supporting LSP4IJ.
- IDE can complete schemas defined in the worksace but not imported , and automatically insert the import statements of the package.
![complete](/img/blog/2024-12-06-kcl-0.11.0-release/complete.gif)
![complete](/img/blog/2024-12-06-kcl-0.11.0-release/complete.gif)
- IDE adds type hints for key in the Config block.
![hint](/img/blog/2024-12-06-kcl-0.11.0-release/hint.png)
![hint](/img/blog/2024-12-06-kcl-0.11.0-release/hint.png)
- IDE hover provides schema attribute default value information.
![hover](/img/blog/2024-12-06-kcl-0.11.0-release/hover.png)
![hover](/img/blog/2024-12-06-kcl-0.11.0-release/hover.png)
- IDE fixed the failure of Windows path issues.
- IDE fixed the failure of compound assignment operation statements.
- IDE distinguished the highlighting of the `any` from keyword and type.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/model/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ assert net.split_host_port("[::1]:80") == ["::1", "80"]
`join_host_port(host: str, port: int | str) -> str`

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

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

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

```python
import net
Expand Down
20 changes: 10 additions & 10 deletions docs/reference/xlang-api/c-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ int exec_file(const char* file_str) {
};
struct Buffer* files[] = { &file };
struct RepeatedString strs = { .repeated = &files[0], .index = 0, .max_size = 1 };
ExecProgram_Args args = ExecProgram_Args_init_zero;
ExecProgramArgs args = ExecProgramArgs_init_zero;
args.k_filename_list.funcs.encode = encode_str_list;
args.k_filename_list.arg = &strs;

pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
status = pb_encode(&stream, ExecProgram_Args_fields, &args);
status = pb_encode(&stream, ExecProgramArgs_fields, &args);
message_length = stream.bytes_written;

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

const char* api_str = "KclvmService.ExecProgram";
const char* api_str = "KclService.ExecProgram";
size_t result_length = call_native((const uint8_t*)api_str, strlen(api_str), buffer, message_length, result_buffer);
if (check_error_prefix(result_buffer)) {
printf("%s", result_buffer);
return 1;
}
pb_istream_t istream = pb_istream_from_buffer(result_buffer, result_length);

ExecProgram_Result result = ExecProgram_Result_init_default;
ExecProgramResult result = ExecProgramResult_init_default;

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

status = pb_decode(&istream, ExecProgram_Result_fields, &result);
status = pb_decode(&istream, ExecProgramResult_fields, &result);

if (!status) {
printf("Decoding failed: %s\n", PB_GET_ERROR(&istream));
Expand Down Expand Up @@ -115,31 +115,31 @@ int validate(const char* code_str, const char* data_str)
size_t message_length;
bool status;

ValidateCode_Args validate_args = ValidateCode_Args_init_zero;
ValidateCodeArgs validate_args = ValidateCodeArgs_init_zero;
validate_args.code.funcs.encode = encode_string;
validate_args.code.arg = (void*)code_str;
validate_args.data.funcs.encode = encode_string;
validate_args.data.arg = (void*)data_str;

pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
status = pb_encode(&stream, ValidateCode_Args_fields, &validate_args);
status = pb_encode(&stream, ValidateCodeArgs_fields, &validate_args);
message_length = stream.bytes_written;

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

const char* api_str = "KclvmService.ValidateCode";
const char* api_str = "KclService.ValidateCode";
size_t result_length = call_native((const uint8_t*)api_str, strlen(api_str), buffer, message_length, result_buffer);
pb_istream_t istream = pb_istream_from_buffer(result_buffer, result_length);
ValidateCode_Result result = ValidateCode_Result_init_default;
ValidateCodeResult result = ValidateCodeResult_init_default;

result.err_message.funcs.decode = decode_string;
uint8_t value_buffer[BUFFER_SIZE] = { 0 };
result.err_message.arg = value_buffer;

status = pb_decode(&istream, ValidateCode_Result_fields, &result);
status = pb_decode(&istream, ValidateCodeResult_fields, &result);

if (!status) {
printf("Decoding failed: %s\n", PB_GET_ERROR(&istream));
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/xlang-api/cpp-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can use FetchContent to add KCL C++ Lib to your project.
FetchContent_Declare(
kcl-lib
GIT_REPOSITORY https://github.com/kcl-lang/lib.git
GIT_TAG v0.10.8 # You can change the GitHub branch tag.
GIT_TAG v0.12.1 # You can change the GitHub branch tag.
SOURCE_SUBDIR cpp
)
FetchContent_MakeAvailable(kcl-lib)
Expand Down
48 changes: 24 additions & 24 deletions docs/reference/xlang-api/dotnet-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dotnet add package KclLib
using KclLib.API;

var api = new API();
var execArgs = new ExecProgram_Args();
var execArgs = new ExecProgramArgs();
var path = Path.Combine("test_data", "schema.k");
execArgs.KFilenameList.Add(path);
var result = api.ExecProgram(execArgs);
Expand Down Expand Up @@ -48,7 +48,7 @@ C# Code
```csharp
using KclLib.API;

var execArgs = new ExecProgram_Args();
var execArgs = new ExecProgramArgs();
var path = "schema.k"
execArgs.KFilenameList.Add(path);
var result = new API().ExecProgram(execArgs);
Expand Down Expand Up @@ -81,7 +81,7 @@ C# Code
using KclLib.API;

var path = "schema.k"
var args = new ParseFile_Args { Path = path };
var args = new ParseFileArgs { Path = path };
var result = new API().ParseFile(args);
```

Expand Down Expand Up @@ -112,7 +112,7 @@ C# Code
using KclLib.API;

var path = "schema.k";
var args = new ParseProgram_Args();
var args = new ParseProgramArgs();
args.Paths.Add(path);
var result = new API().ListOptions(args);
```
Expand Down Expand Up @@ -144,9 +144,9 @@ C# Code
using KclLib.API;

var path = "schema.k";
var args = new LoadPackage_Args();
var args = new LoadPackageArgs();
args.ResolveAst = true;
args.ParseArgs = new ParseProgram_Args();
args.ParseArgs = new ParseProgramArgs();
args.ParseArgs.Paths.Add(path);
var result = new API().LoadPackage(args);
```
Expand Down Expand Up @@ -178,7 +178,7 @@ C# Code
using KclLib.API;

var api = new API();
var args = new ListVariables_Args();
var args = new ListVariablesArgs();
var path = "schema.k";
args.Files.Add(path);
var result = api.ListVariables(args);
Expand Down Expand Up @@ -210,7 +210,7 @@ C# Code
using KclLib.API;

var path = "options.k";
var args = new ParseProgram_Args();
var args = new ParseProgramArgs();
args.Paths.Add(path);
var result = new API().ListOptions(args);
```
Expand Down Expand Up @@ -242,9 +242,9 @@ C# Code
using KclLib.API;

var path = "schema.k";
var execArgs = new ExecProgram_Args();
var execArgs = new ExecProgramArgs();
execArgs.KFilenameList.Add(path);
var args = new GetSchemaTypeMapping_Args();
var args = new GetSchemaTypeMappingArgs();
args.ExecArgs = execArgs;
var result = new API().GetSchemaTypeMapping(args);
```
Expand Down Expand Up @@ -275,7 +275,7 @@ C# Code
```csharp
using KclLib.API;

var args = new OverrideFile_Args
var args = new OverrideFileArgs
{
File = "main.k",
};
Expand Down Expand Up @@ -303,7 +303,7 @@ string sourceCode = "schema Person:\n" + " name: str\n" + " age: int\
string expectedFormattedCode = "schema Person:\n" + " name: str\n" + " age: int\n\n" + " check:\n"
+ " 0 < age < 120\n\n";
var api = new API();
var args = new FormatCode_Args();
var args = new FormatCodeArgs();
args.Source = sourceCode;
var result = api.FormatCode(args);
```
Expand Down Expand Up @@ -335,7 +335,7 @@ C# Code
using KclLib.API;

var api = new API();
var args = new FormatPath_Args();
var args = new FormatPathArgs();
var path = "format_path.k";
args.Path = path;
var result = api.FormatPath(args);
Expand Down Expand Up @@ -365,7 +365,7 @@ C# Code
using KclLib.API;

var path = "lint_path.k"
var args = new LintPath_Args();
var args = new LintPathArgs();
args.Paths.Add(path);
var result = new API().LintPath(args);
bool foundWarning = result.Results.Any(warning => warning.Contains("Module 'math' imported but unused"));
Expand Down Expand Up @@ -394,7 +394,7 @@ schema Person:
0 < age < 120
";
string data = "{\"name\": \"Alice\", \"age\": 10}";
var args = new ValidateCode_Args
var args = new ValidateCodeArgs
{
Code = code,
Data = data,
Expand Down Expand Up @@ -425,10 +425,10 @@ C# Code
```csharp
using KclLib.API;

Rename_Args args = Rename_Args.newBuilder().setPackageRoot(".").setSymbolPath("a")
RenameArgs args = RenameArgs.newBuilder().setPackageRoot(".").setSymbolPath("a")
.addFilePaths("main.k").setNewName("a2").build();
API apiInstance = new API();
Rename_Result result = apiInstance.rename(args);
RenameResult result = apiInstance.rename(args);
```

</p>
Expand All @@ -446,7 +446,7 @@ C# Code
```csharp
using KclLib.API;

var args = new RenameCode_Args
var args = new RenameCodeArgs
{
PackageRoot = "/mock/path",
SymbolPath = "a",
Expand All @@ -472,7 +472,7 @@ C# Code
using KclLib.API;

var pkg = Path.Combine(parentDirectory, "test_data", "testing");
var args = new Test_Args();
var args = new TestArgs();
args.PkgList.Add(pkg + "/...");
var result = new API().Test(args);
```
Expand Down Expand Up @@ -504,7 +504,7 @@ using KclLib.API;

var workDir = ".";
var settingsFile = "kcl.yaml";
var args = new LoadSettingsFiles_Args
var args = new LoadSettingsFilesArgs
{
WorkDir = workDir,
};
Expand Down Expand Up @@ -541,7 +541,7 @@ C# Code
using KclLib.API;

var manifestPath = "module";
var args = new UpdateDependencies_Args { ManifestPath = manifestPath };
var args = new UpdateDependenciesArgs { ManifestPath = manifestPath };
var result = new API().UpdateDependencies(args);
```

Expand Down Expand Up @@ -584,9 +584,9 @@ API api = new API();

var manifestPath = "module";
var testFile = Path.Combine(manifestPath, "main.k");
var updateArgs = new UpdateDependencies_Args { ManifestPath = manifestPath };
var updateArgs = new UpdateDependenciesArgs { ManifestPath = manifestPath };
var depResult = new API().UpdateDependencies(updateArgs);
var execArgs = new ExecProgram_Args();
var execArgs = new ExecProgramArgs();
execArgs.KFilenameList.Add(testFile);
execArgs.ExternalPkgs.AddRange(depResult.ExternalPkgs);
var execResult = new API().ExecProgram(execArgs);
Expand All @@ -607,7 +607,7 @@ C# Code
```csharp
using KclLib.API;

var result = new API().GetVersion(new GetVersion_Args());
var result = new API().GetVersion(new GetVersionArgs());
```

</p>
Expand Down
Loading