-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Editor includes unnecessary header files in C #14411
Comments
This looks like the work of the LSP server underneath, which is Zed itself knows nothing about languages — it barely has a tree-sitter syntax tree information and that's it.
How is formatting related to the current issue? |
As far as I have been able to understand, one of the functions of the language server is holding required information for features like formatting, code completion, code highlighting etc. and frankly, to me the issues in these posts seem similar enough to include here. I am not very well versed with this technology so pardon me for any trouble caused. |
No troubles at all, but to restate again: there's nothing on Zed side we can do except
|
This is a problem in multiple context, even when using C++. The way to disable this is to add the
EDIT: Unfortunately this doesn't work. If someone knows how to fix it, please let me know. |
Check for existing issues
Describe the bug / provide steps to reproduce it
The issue:
While typing certain keywords or functions in the editor and using auto-complete to complete the line, the editor automatically includes any header files that the keywords or functions are a part of. While this is extremely useful, sometimes the editor includes headers that are unsupported or unavailable on the specific operating system or compiler, or headers that are completely unnecessary for the code to behave as intended or ones that have been included in another header file in the code already.
Here are some screen recordings:
Screen.Recording.2024-07-13.at.11.11.18.PM.mov
As you can see, the editor prompts me to auto complete the "NULL" keyword and as I do it, it includes the "cstddef" header file which is both, unnecessary for the program to run and not available to the compiler. The standard libraries required by the program are already included in the linkedList.h header file.
Steps to reproduce:
There were also instances where libraries that have been already included in another header file get included again by the editor, in the same manner.
Screen.Recording.2024-07-13.at.11.55.35.PM.mov
I have raised and seen other people raise similar issues with formatting in the past and I believe all of them have to do something with the language server itself.
#13924 (comment)
#4842 (comment)
#12154 (comment)
Environment
Zed: v0.143.7 (Zed)
OS: macOS 14.5.0
Memory: 8 GiB
Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: