Closed Chriscbr closed 2 months ago
Thanks for opening this pull request! :tada: Please consult the contributing guidelines for details on how to contribute to this project. If you need any assistance, don't hesitate to ping the relevant owner over Discord.
Topic | Owner |
---|---|
Wing SDK and standard library | @chriscbr |
Wing Console | @skyrpex |
Wing compiler and language design | @chriscbr |
VSCode extension and language server | @chriscbr |
Wing CLI | @chriscbr |
Documentation | @boyney123 |
Examples | @boyney123 |
Wing Playground | @skyrpex |
Console preview environment is available at https://wing-console-pr-7146.fly.dev :rocket:
Congrats! :rocket: This was released in Wing 0.85.11.
Fixes a bug where the compiler can panic in certain situations when files from different directories are loaded. Specifically, the issue happens when a Wing file tries importing another Wing file from a directory that is not a sibling or in a sibling directory.
The issue is related to a facility of the compiler responsible for calculating a FQN (fully-qualified name) for every public type. To calculate the FQN for a public type like a class, we need to know where the file is relative to its package. For example, when a file like
/home/node_modules/@winglibs/dynamodb/aws/table.w
is type checked, the compiler needs to know that it belongs to the library named@winglibs/dynamodb
and that the root of@winglibs/dynamodb
is/home/node_modules/@winglibs/dynamodb
. This way, types defined insideaws
will get added to theaws
namespace, and types defined at the root should get added to the root namespace, and if a type is defined outside of the project root, it's an error.Today, the way we identify what package each source file belongs to is by looking up the file system and seeing if there's a package.json or wing.toml file somewhere up the file tree. But we don't enforce all projects to have these files and we want the language server to work even when these files don't exist. In such cases, we decide that all files that aren't part of a well-defined package are part of an implicit "default" package, and the root of this default package is whatever is the common root of all of its files.
This PR should also slightly improve the stability of the language server.
Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.