Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: respect ignoreDir in --check CLI #3110

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

Merged
sumneko merged 3 commits into LuaLS:master from emmericp:fix-ignore-in-check
Mar 12, 2025

Conversation

Copy link
Contributor

@emmericp emmericp commented Mar 8, 2025

No description provided.

@@ -102,7 +102,7 @@ xpcall(lclient.start, errorhandler, lclient, function (client)
local max = #uris
table.sort(uris) -- sort file list to ensure the work distribution order across multiple threads
for i, uri in ipairs(uris) do
if (i % numThreads + 1) == threadId then
if (i % numThreads + 1) == threadId and not ws.isIgnored(uri) then
Copy link
Contributor

@tomlau10 tomlau10 Mar 9, 2025

Choose a reason for hiding this comment

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

I think this can be improved by removing them from uris[] first before the forloop.

  • Otherwise the workload distribution might be slightly unbalanced
  • because one of the threads will just ignore one round of the distributed task
 local uris = files.getChildFiles(rootUri)
 for i = #uris, 1, -1 do
 if ws.isIgnored(uris[i]) then
 -- remove by swapping with last element
 uris[i] = uris[#uris]
 uris[#uris] = nil
 end
 end
 local max = #uris
 table.sort(uris) -- sort file list to ensure the work distribution order across multiple threads

Copy link
Contributor Author

@emmericp emmericp Mar 9, 2025

Choose a reason for hiding this comment

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

I considered this, but I don't think this makes a significant difference, the balancing is more affected by file complexity/size than ignoring. Also, since they are sorted by prefix it is likely that a whole contiguous range of files will be ignored, distributing the ignoredness over all workers

Copy link
Contributor

@tomlau10 tomlau10 Mar 9, 2025
edited
Loading

Choose a reason for hiding this comment

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

I don't think this makes a significant difference, the balancing is more affected by file complexity/size than ignoring.

I totally agree with this.
But since now you are now trying to modify the logic of this part, why not make it perfect? 😂

I know that this whole multi thread check feature is implemented by you, and that's really awesome. 👍
In your initial implementation you used filename hash to distribute the tasks, which leads to slightly imbalanced distribution.
Maybe at that time you had also considered that and thought that won't make significant difference.
But in fact I changed it to simple round robin here #2738, and it yields a 10% performance 😄 .


Again I agree that my suggestion will probably not make a significant difference.
But isn't that removing ignored uris first is a more correct implementation? 😕
And if you find my current suggested change would make the logic a bit messy, I have come up with another suggestion

  • change the files.getChildFiles() to add a excludeIgnored optional boolean param
  • inside that logic add one more filter condition
    function m.getChildFiles(uri)
    local results = {}
    local uris = m.getAllUris(uri)
    for _, curi in ipairs(uris) do
    if #curi > #uri
    and curi:sub(1, #uri) == uri
    and curi:sub(#uri+1, #uri+1):match '[/\\]' then
    results[#results+1] = curi
function m.getChildFiles(uri, excludeIgnored)
 local ws = require "workspace"
...
 and (not excludeIgnored or not ws.isIgnored(curi)) then
  • then finally you can just use it like local uris = files.getChildFiles(rootUri, true) 👀

Copy link
Collaborator

sumneko commented Mar 12, 2025

Completion is more important than perfection, and we have plenty of opportunities to continue improving.

tomlau10 reacted with laugh emoji

@sumneko sumneko merged commit 76519b5 into LuaLS:master Mar 12, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@tomlau10 tomlau10 tomlau10 left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /