Skip to content

Map files to their corresponding compilation steps #2308

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
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

arielherself
Copy link

This PR solves the problem discussed in #2305 by categorizing build context (packages, c_macros and include_dirs) into different “compilation units,” which hold modules and files required by a single compilation step.

When ZLS analyzes a symbol, it will find the context of the compilation unit that the current file belongs to. When there are multiple of them, it picks a random one. However, this could be improved by calculating the longest common prefix between the current file and the root file of the compilation unit.

After the changes, only modules required by at least one compilation step (which could be an arbitrary one instead of just of the descendants of the default step) will be analyzed by ZLS. This behavior is also seen in other language servers like rust-analyzer.

@leecannon
Copy link
Member

I have been using this for a couple days and have not hit any issues in a project with 58 “compilation units”.

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.

2 participants