Skip to content
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

No autocomplete for packages #465

Closed
Beyley opened this issue Feb 21, 2022 · 10 comments
Closed

No autocomplete for packages #465

Beyley opened this issue Feb 21, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@Beyley
Copy link
Contributor

Beyley commented Feb 21, 2022

If i attempt to import a package (whether through exe.addPackagePath or with a std.build.Pkg with exe.addPackage), i get no autocompletion or any language features if i try to import said package in my main.zig file, ex const glfw = @import("glfw"); even though it builds and runs fine, but if i import the package manually by file ex const glfw = @import("../deps/mach-glfw/src/main.zig");, completion does work, but it does not build due to a import of file outside package path error (which zls should probably show)

@nektro
Copy link
Contributor

nektro commented Feb 22, 2022

not a bug

@dxps
Copy link

dxps commented Mar 18, 2022

not a bug

That's not helpful either.

@GideonUng
Copy link

That essential features like this are ignored in zig tooling is one of the things holding zig back.
If this is omitted by design then the design of zls is the bug.

@andrewrk
Copy link

Note that:

  1. zls, while useful for many people, is not official zig tooling, and
  2. a compiler server built into zig itself is planned.

@GideonUng
Copy link

It is the tooling currently available and its an issue on zls not zig so the issue is still relevant imho.
So until the zig compiler provides a ground truth for a language server this puts an obstacle in front of arguably good coding standards. (modularization and abstraction through modules/packages)

@nektro
Copy link
Contributor

nektro commented Apr 12, 2022

zig does a lot of great things, but its good to remember it is still in its early stages. tooling (both official and community) is in a "best effort" situation right now. if this is a issue of great inspiration to you, then research/a pr is very much welcome. sorry for being crude earlier, I was going through a lot of notifications at the time

@mattnite
Copy link
Contributor

I know that maintenance of zls has changed hands a few times, and that makes it difficult knowing what’s a bug, when regressions have taken place, etc. Big thanks to @nektro for taking on a lot of the responsibilities!

I remember from way back looking into how zls worked and this function came to mind:

fn loadPackages(context: LoadPackagesContext) !void {

From what I can tell zls is supposed to autocomplete packages, but there must have been a regression.

I think as a community we could pour a little more love into our third-party tools like zls. The @ZigEmbeddedGroup is committed to improving the workflow for imported packages in zls — it’s invaluable for working with register definitions. In addition to this we’ll likely be the ones stressing performance and this will lead to more improvements that the community will benefit from.

@mifopen
Copy link

mifopen commented Jul 21, 2022

Works for me on the latest master (ab62e58)

@jiacai2050
Copy link
Contributor

Also works for me.
Could you try again the latest master? @Beyley

@leecannon
Copy link
Member

@Beyley If you are still getting this issue can you check the output in vscode again as a much better error should be provided due to #569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants