-
Notifications
You must be signed in to change notification settings - Fork 3
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
wesl.toml for LSPs #57
Comments
This makes a lot of sense. Though we still need to figure out how this might work with bevy's cargo shaders |
agreed with the proposal and @ncthbrt comment. I think it's time to try some prototypes to depend on npm/cargo packages. |
@k2d222 This current wesl.toml proposal is purely for having non-relative imports within a project. Akin to As long as one only uses relative imports, this wesl.toml wouldn't be needed. I'm somewhat sceptical about making it the libraries part optional, because from the point of view of a language server, it's not entirely obvious which files and package managers it should check. Bonus points for complex cases like monorepos with multiple package.json files.
|
And yes, we should definitely experiment with npm/cargo packages! :) |
99% of cases are not edge-cases, let's optimize UX for that. in those cases the |
We need a way for language servers to figure out what file an "absolute path" resolves to.
As in, if I write
import my_project::foo
, which folder does the language server look at?wesl.toml
ProposalFirst, a language server scans for
wesl.toml
files (how do they do it for Cargo.toml and package.json? Do they only scan the root folder, or..?)The file then contains a list of dependencies. For each dependency, we have its name, and how to find it. Currently, the only valid option is with a path that is relative to the
wesl.toml
.e.g.
The importing proposal #53 then uses these entries to start fully qualified paths.
This proposal is explicitly designed for IDEs. Bundlers are free to ignore it and may instead request the user to provide all relevant info.
Example
my_lib
is found in thewesl.toml
. Valid start["my_lib", "bar", "foo.wesl"]
.Implementation detail
Internally, a bundler should also generate an absolute filepath that is relative to the
wesl.toml
. Why?If the user specifies
Then utils my_lib/shaders/utils and utils should have the same absolute filesystem path. That way, the linker only needs to look at the absolute path to find out whether it's the same module or not.
The text was updated successfully, but these errors were encountered: