Skip to content

Feat/config management#156

Merged
GeWuYou merged 14 commits into
mainfrom
feat/config-management
Apr 1, 2026
Merged

Feat/config management#156
GeWuYou merged 14 commits into
mainfrom
feat/config-management

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

GeWuYou added 13 commits March 30, 2026 13:18
- 实现了 ConfigRegistry 配置注册表,支持按名称注册和类型安全查询
- 创建了 InMemoryConfigTable 内存配置表,提供基于字典的只读配置存储
- 定义了 IConfigLoader、IConfigRegistry 和 IConfigTable 接口契约
- 添加了完整的单元测试验证配置表的注册、查询和类型检查功能
- 在项目文件中添加了新的代码文件夹结构
- 实现了配置表的覆盖策略以支持开发期热重载需求
- 新增YamlConfigLoader类支持基于目录的YAML配置加载
- 添加对.yaml和.yml文件格式的自动识别和解析
- 实现异步加载任务支持取消令牌
- 集成YamlDotNet库进行YAML反序列化处理
- 支持驼峰命名约定和忽略未匹配属性
- 实现配置表注册的链式API设计
- 添加详细的加载过程异常处理和错误信息
- 提供完整的单元测试覆盖各种加载场景
- 更新项目依赖添加YamlDotNet包引用16.3.0版本
- 实现SchemaConfigGenerator源代码生成器
- 支持从JSON schema文件生成配置类型和表包装类
- 添加ConfigSchemaDiagnostics诊断系统
- 集成System.Text.Json包依赖
- 生成强类型的配置访问接口
- 支持多种数据类型包括整数、浮点数、布尔值、字符串和数组
- 实现id字段作为表主键的约束验证
- 添加完整的单元测试和快照验证
- 实现配置文件浏览器功能,支持工作区 config 目录下的 YAML 文件浏览
- 添加配置文件验证功能,支持基于 JSON Schema 的轻量级验证
- 提供表单预览界面,支持顶层标量字段的编辑功能
- 实现配置文件与匹配模式文件的快速打开功能
- 添加工作区设置选项,可自定义配置和模式目录路径
- 支持实时保存和验证反馈,集成 VSCode 诊断集合显示错误警告
- 添加 Microsoft.CodeAnalysis.CSharp 命名空间引用
- 优化代码结构以支持 C# 语法分析功能
- 提升测试驱动程序的编译器集成能力
- 创建了 GFramework.Game 模块的全面文档
- 包含架构模块系统、资产管理、存储系统和序列化系统详解
- 提供了 AbstractModule、AbstractAssetCatalogUtility 等核心组件使用示例
- 添加了分层存储、加密存储和缓存存储的实现方案
- 集成了 JSON 序列化、自定义转换器和版本化数据管理
- 提供了完整的游戏数据管理系统和自动保存系统实现
- 修改了 VitePress 配置文件
- 在YamlConfigLoader中添加YamlDotNet序列化库引用
- 移除YamlConfigSchemaValidator中的未使用引用
- 在全局引用中添加YAML处理相关库引用
- 优化配置模块的依赖管理和命名空间使用
- 实现YamlConfigLoader支持基于文件目录的YAML配置加载
- 添加EnableHotReload方法支持开发期配置文件变更自动重载
- 提供带schema校验的配置表注册功能
- 实现按表粒度的热重载机制及错误处理回调
- 添加配置文件变更监听和防抖处理
- 更新文档说明热重载使用方法和行为特性
- 移除未完成功能列表中的运行时热重载项
- 引入基于YAML和JSON Schema的静态内容配置系统
- 实现运行时只读查询和Source Generator支持
- 提供VS Code扩展用于配置浏览、验证和轻量编辑
- 支持开发期热重载和跨表引用校验功能
- 包含完整的文档说明和工具链集成
- 实现YAML配置文件管理和JSON Schema验证功能
- 提供运行时只读查询和Source Generator代码生成功能
- 开发VS Code插件实现配置浏览、校验和轻量表单编辑
- 支持开发期热重载和配置变更自动刷新机制
- 集成诊断功能提供配置文件错误提示和修复建议
- 实现YamlConfigLoader支持从YAML文件加载配置数据
- 提供ConfigRegistry用于统一管理命名的配置表
- 支持JSON Schema校验配置结构和类型匹配
- 实现跨表引用校验避免无效引用和缺失依赖
- 提供开发期热重载功能监听文件变更自动刷新
- 支持一对象一文件的目录组织方式
- 集成VS Code插件提供配置浏览和轻量校验
- 生成器支持从schema自动生成配置类型定义
- 文档说明配置系统的使用方法和推荐目录结构
- 实现基于YAML的配置源文件和JSON Schema结构验证
- 提供运行时只读查询和Source Generator代码生成
- 添加VS Code插件实现配置浏览、编辑和轻量校验功能
- 支持开发期热重载和跨表引用校验
- 实现批量编辑和表单预览功能
- 实现基于YAML的配置文件管理和JSON Schema校验功能
- 提供YamlConfigSchemaValidator用于运行时配置校验和跨表引用检查
- 添加完整的单元测试覆盖配置加载器的各种场景
- 支持热重载功能,开发期修改配置文件后自动刷新运行时表
- 集成Source Generator生成配置类型和表包装类
- 提供VS Code插件支持配置浏览、编辑和校验操作

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @GeWuYou, your pull request is larger than the review limit of 150000 diff characters

@deepsource-io

deepsource-io Bot commented Apr 1, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in a10cc5b...c84f628 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Apr 1, 2026 4:47a.m. Review ↗
Secrets Apr 1, 2026 4:47a.m. Review ↗

{
cancellationToken.ThrowIfCancellationRequested();

string yaml;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `yaml` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.

/// </summary>
public void Dispose()
{
List<FileSystemWatcher> watchersToDispose;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `watchersToDispose` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.

public void Dispose()
{
List<FileSystemWatcher> watchersToDispose;
List<CancellationTokenSource> reloadTokensToDispose;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `reloadTokensToDispose` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.

{
List<FileSystemWatcher> watchersToDispose;
List<CancellationTokenSource> reloadTokensToDispose;
List<SemaphoreSlim> reloadLocksToDispose;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `reloadLocksToDispose` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.


private void ScheduleReload(string tableName)
{
CancellationTokenSource reloadTokenSource;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `reloadTokenSource` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.

throw new FileNotFoundException($"Schema file '{schemaPath}' was not found.", schemaPath);
}

string schemaText;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `schemaText` is uninitialized


While some variables such as fields can be initialized and be assigned a default value, it is possible for local variables to not be initialized. This however is not a good practice as it is capable of critically altering your program's path, thereby affecting its logic.

It is therefore recommended that you always initialize variables, ideally where they're being declared.

Comment on lines +401 to +402
if (allowedValues != null &&
allowedValues.Count > 0 &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullable check expression can be simplified


While it is common to explicitly check an object's nullability before accessing its value, you can further simplify this expression by
either using the conditional access operator ? or pattern matching instead. These proposed solutions are succinct and reduce your
keystrokes.

/// <param name="property">属性 JSON 节点。</param>
/// <param name="isRequired">属性是否必填。</param>
/// <returns>解析后的属性信息或诊断。</returns>
private static ParsedPropertyResult ParseProperty(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParseProperty has a cyclomatic complexity of 27 with "very-high" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

var fileName = Path.GetFileName(path);
if (fileName.EndsWith(".schema.json", StringComparison.OrdinalIgnoreCase))
{
return fileName.Substring(0, fileName.Length - ".schema.json".Length);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using range index over `Substring`


String.Substring takes parameters such as the starting index and/or length and returns a part of the specified string. However, this entire expression can be simplified using the range operator, i.e., the .. operator.

- 将传统的空值检查和计数判断替换为更简洁的模式匹配语法
- 使用集合表达式简化代码结构,提高可读性
- 保持原有的功能逻辑不变,仅优化代码风格
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant