-
-
Notifications
You must be signed in to change notification settings - Fork 402
fix(parser): 修复文档参数绑定的重复问题 #3349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ushen-pyj
wants to merge
1
commit into
LuaLS:master
Choose a base branch
from
ushen-pyj:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+34
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当
old.virtual和doc.virtual状态相同时(都为true或都为false),当前逻辑不会移除任何一个重复的参数文档,这会导致重复的文档仍然存在。你应该处理这种情况,例如,保留文件中先出现的文档(索引较低的那个)。此外,
removeByValue函数每次调用都会遍历bindDocs,导致此去重逻辑在最坏情况下的时间复杂度为 O(N^2)。对于有很多参数的函数,这可能会成为性能瓶颈。我建议修改逻辑以处理所有重复情况,并考虑一个更高效的 O(N) 实现来构建一个新的
bindDocs列表,而不是在迭代时从中移除元素。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同时为virtual或者同时都不是virtual,这是人为写出来的,可以自己避免,正常使用不会这么写,给一个函数加两个一模一样的virtual,或者在一个函数写两个一模一样的@param注释。
最快的情况下O(N^2),通常是为每一个参数都加了虚拟注解,又重新写了每一个参数的真实注解,这种情况我认为也是不合理使用导致的,我们为某种规则的函数,根据规定用plugin定义了参数,说明是大部分都是正确的才会这样用,也就是大部分都不需要重写param