-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add vscode task provider like rls-vscode #1935
Comments
Ahh, just found these keybindings etc., but I still think it is worth using the task provider API to be consistent with other languages/build tools using vscode...? |
The reason why we can't use task provider interface instead of our "run" thing is that task provider is a pretty limited thing. In particular, task providers don't have access to current cursor position, open file, etc, so it's impossible to implement something like "run this test" using a task provider. We can provide a task provider in addition to "run rust" action. |
Ahh, makes sense, yeah I should have said "worth adding" instead of "worth using"- having both would be best. I can open a PR, although I am not sure what the protocol is for me |
Just copy&paste it :) Note that we have a pretty strict linting check for rs on CI, so you might need to run |
3777: Add basic task support r=matklad a=Timmmm This adds basic support for running `cargo build`, `cargo run`, etc. Fixes #1935 I have tested this and it seems to work. There are two things I'm not sure about: 1. The workspace folder handling seems wrong - just get the first workspace folder? Is this just a TODO item? I don't know if it is right to lift `workspaceFolder` up to `activate()` but I couldn't see another way. 2. If you manually add an entry to `tasks.json` like this: ``` { "type": "cargo", "command": "build", "problemMatcher": [ "$rustc" ], "group": "build" } ``` then VSCode somehow magically knows to run `cargo build`. The documentation for `resolveTask` *sounds* like I should have to implement that for it to work: ``` * Resolves a task that has no [`execution`](#Task.execution) set. Tasks are * often created from information found in the `tasks.json`-file. Such tasks miss * the information on how to execute them and a task provider must fill in * the missing information in the `resolveTask`-method. ``` But then it also says this: ``` * This method will not be * called for tasks returned from the above `provideTasks` method since those * tasks are always fully resolved. A valid default implementation for the * `resolveTask` method is to return `undefined`. ``` Either way, it works without implementing it so the only thing I can think is that it is doing some kind of crazy pattern matching of the tasks returned by `provideTasks()` and the ones found in `tasks.json`. Co-authored-by: Tim <[email protected]>
I use this as my daily driver and it is awesome - thanks for providing such a great IDE experience!
Something that I miss from RLS (in Sublime & VSCode) was builtin tasks support.
Any chance of adding support for the vscode task provider API like the official vscode extension has so that
cargo
tasks are automatically detected by vscode? Or is there a reason why this file wasn't cherry picked from rust-lang/rls-vscode?The text was updated successfully, but these errors were encountered: