Skip to content

Commit

Permalink
fix: sdk missing type completions when not used already (#2640)
Browse files Browse the repository at this point in the history
Adds some basic testing for the language server (only hover and completions for now), mostly snapshot testing. This includes a cute lil macro that should make further tests pretty easy.

Also threw in a change to close #2339 by eagerly loading the SDK.

- [x] PR title matches [Winglang's style guide](https://docs.winglang.io/contributors/pull_requests#how-are-pull-request-titles-formatted)
- [x] PR description explains motivation and solution
- [x] Tests added
- [x] Docs updated
- [x] Needs end-to-end tests (`pr/e2e-full` label)

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
  • Loading branch information
MarkMcCulloh authored May 25, 2023
1 parent 39ad1d5 commit 89a7371
Show file tree
Hide file tree
Showing 19 changed files with 583 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
jobs:
build:
name: "Build"
timeout-minutes: 25
timeout-minutes: 30
runs-on: ubuntu-latest
env:
# Testing runs out of memory without this
Expand Down
2 changes: 2 additions & 0 deletions .insta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
behavior:
update: "always"
136 changes: 129 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions docs/06-contributors/020-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ Note: In CI, tests likely run much slower than on your local machine, so you may

## How do I work only on the compiler?

The following command runs the cargo tests, currently just ensures the valid examples compile and the
invalid ones do not.
The following command runs the rust tests in wingc, including verification that valid tests compile, invalid tests do not compile, and none of them panic.

It will also make sure to update any snapshots.

```sh
npx nx test wingc
Expand All @@ -190,8 +191,11 @@ To check that your code passes all the lints, run:
npx nx lint wingc
```

If you are using VS Code, you can show clippy errors in your IDE by installing the rust-analyzer extension and setting the option "Rust-analyzer › Check: Command" to "clippy" instead of "check".
### Optional VSCode extensions for working on the compiler

You can show clippy errors in your IDE by installing the [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) extension and setting the option "Rust-analyzer › Check: Command" to "clippy" instead of "check".

The [insta](https://marketplace.visualstudio.com/items?itemName=mitsuhiko.insta) extension allows you to view snapshots in the tests files.

## How do I make changes to the Wing grammar?

Expand Down
4 changes: 4 additions & 0 deletions libs/wingc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ duplicate = "1.0.0"

[lib]
crate-type = ["rlib", "cdylib"]

[dev-dependencies]
insta = { version = "1.29.0", features = ["yaml"] }
uuid = { version = "1.3.2", features = ["fast-rng", "v4"] }
7 changes: 6 additions & 1 deletion libs/wingc/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
"implicitDependencies": ["sdk", "wingii", "tree-sitter-wing"],
"targets": {
"test": {
"dependsOn": ["lint"],
"dependsOn": ["^build", "lint"],
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"cwd": "libs/wingc"
},
"configurations": {
"release": {
"command": "INSTA_UPDATE=\"no\" cargo test"
}
}
},
"lint": {
Expand Down
Loading

0 comments on commit 89a7371

Please sign in to comment.