refactor(visibility): improve type visibility#1004
refactor(visibility): improve type visibility#1004xuhuanzy wants to merge 9 commits intoEmmyLuaLs:mainfrom
Conversation
|
鉴定为不行, 不符合现实, 通常现成的lua生态,如果他不使用emmylua doc, 那么我可以通过global或者 require的方式引入, 如果他使用emmylua doc, 并且他设计上会给别人使用, 那么他的类型通常有命名空间前缀, 并且如果他的类型不希望被外部使用那么他应该使用private class. 而如果一个库使用emmylua doc并且设计上没有使用命名空间, 那么他通常不是足够流行的公共库, 或者就是他们自己内部的生态. 所有这些都表明默认internal不是正确的方向 |
This comment was marked as outdated.
This comment was marked as outdated.
1. 类型默认为 public 2. 添加 internal 可见性修饰符, 即包内可见, 在这里包的概念是`workspace.library`引入的内容 3. 删除 ---@export
|
@CppCXY 类型访问修饰符从 flag 里独立出来怎么样? ---@class public (flag) className |
|
不改 |
可以两者兼容往后过渡吧, 把一堆东西塞 flag 太丑了, 可能还得为他写专门的诊断避免重复修饰 |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces the @export tag system with a comprehensive visibility model using @public, @internal, and @private modifiers. It refactors the type index to support scoped lookups across global, internal, and local contexts and updates workspace configuration to handle library and package imports more consistently. A new diagnostic checker for inconsistent type access modifiers is also introduced. Feedback includes suggestions to extract complex property owner identification into helper functions, verify MSRV compatibility for the is_none_or method, and simplify the resolve_workspace_id logic to reduce nesting.
crates/emmylua_code_analysis/src/compilation/analyzer/doc/property_tags.rs
Show resolved
Hide resolved
|
@CppCXY 看一下没问题就先合了, 处理泛型跟特性切分支再合并太麻烦了 |
workspace.library与workspace.packages引入的文件夹workspace.packageDirs重命名为workspace.packagesinternal定义的类型仅在包内可见, 不同包的---@class (internal) class现在不会冲突也不会进行合并