editor-rs / vscode-rust Goto Github PK
View Code? Open in Web Editor NEWRust for Visual Studio Code
License: MIT License
Rust for Visual Studio Code
License: MIT License
I am going to do several changes.
I want to remove the "checkOnSave", "checkWith", "features" configuration properties.
Add the new property "actionOnSave" with the following available values:
Add the new property "buildArgs", which is an array of strings.
This property will be used when any build command is invoked.
Add the new property "checkArgs", which is an array of strings.
This property will be used when any check command is invoked.
Add the new property "clippyArgs", which is an array of strings.
This property will be used when a clippy command is invoked.
Add the new property "runArgs", which is an array of strings.
This property will be used when any run command is invoked.
Add the new property "testArgs", which is an array of strings.
This property will be used when any test command is invoked.
What do you think about it?
Version: 0.1.3.
I'm trying to set up code checking with Clippy.
"rust.checkWith": "clippy",
"rust.checkOnSave": false
I expect cargo clippy
command to be invoked, but instead I see output:
Started cargo check --lib
...
rust.checkOnSave
to true
, "Cargo: Check Library" command still works the same, but checking file on saving is done with Clippy.It appears, this is the only place in the extension's code, where checkWith
setting is used:
https://github.com/KalitaAlexey/vscode-rust/blob/ddec37cdf534073b5a38d1c2b5b6a17e2a752d9d/src/extension.ts#L97
Shouldn't this setting be used for the Cargo Check command too?
Version of VSCode: 1.8.1
Version of the extension: 0.3.5
OS: Windows 10
Description:
Error messages are very minimal, showing much less information than what I get when I run cargo at the command line.
For example, I used ctrl-shift-t to test my project, and got this compilation error:
Started cargo test --message-format json
Compiling pandt v0.1.0 (file:///C:/Users/radix/Projects/pandt/pandt)
src\grid.rs:49:9: error: E0308: mismatched types
src\grid.rs:49:9: error: E0308: mismatched types
error: Could not compile `pandt`.
To learn more, run the command again with --verbose.
Completed with code 101
It took approximately 2.334 seconds
And when I hover my mouse over the line with the error, I only see E0308: mismatched types
.
On the other hand, if I run it with cargo test on the command line:
C:\Users\radix\Projects\pandt\pandt [master ≡ +0 ~3 -0 !]> cargo test
Compiling pandt v0.1.0 (file:///C:/Users/radix/Projects/pandt/pandt)
error[E0308]: mismatched types
--> src\grid.rs:49:37
|
49 | assert_eq!((point3_distance(pos1, pos2)),
| ^^^^ expected i32, found i16
error[E0308]: mismatched types
--> src\grid.rs:49:43
|
49 | assert_eq!((point3_distance(pos1, pos2)),
| ^^^^ expected i32, found i16
Is there a way to get similar output into vscode?
I get this warning:
warning: the option `Z` is unstable and should only be used on the nightly compiler, but it is currently accepted for backwards compatibility; this will soon change, see issue #31847 for more details
This is with the json error format option enabled. Also the json option means link errors aren't shown.
It would be nice if the non-JSON stdout and stderr from cargo were immediately displayed in the output panel instead of only flushing everything out at the end of the cargo invocation. There is currently no way to see the cargo progress (like "Compiling <package>...") or see any output from your program (like log messages) until cargo exits.
The Rust Language Server ships their own VS code plugin https://github.com/jonathandturner/rls_vscode
but I would much prefer to see it combined with vscode-rust and possibly replace Racer.
Version of VSCode: 1.8.1
Version of the extension: 0.3.2
OS: Linux
Description:
After updating from 0.3.0 to 0.3.2, vscode-rust doesn't work anymore. The vscode developer tools console shows:
[Extension Host] Activating extension kalitaalexey.vscode-rust
failed: {1}.
[Extension Host] Activating extension kalitaalexey.vscode-rust
failed: undefined
[Extension Host] Here is the error stack: undefined
Activating extension kalitaalexey.vscode-rust
failed: {1}.
Not sure where to go from here. I already tried to re-install the extension.
Hi everybody,
Cargo supports emission of messages (warnings and errors) in JSON since 1.13
I don't think that anyone still uses lower version.
I want to remove all parse code of old formats.
I am going to do that in 3 days.
Has anyone any objections?
Best regards,
Alexey
The settings for choosing the error format disappeared in the new version, which is intended. But now it uses the broken new error format instead of the JSON error format it seems. The JSON error format is the only one that worked with this extension.
Also since it breaks with the new error format, it only does the check on save once and then stops doing it since it crashes.
Hi everybody.
It was changed from SIGINT to SIGTERM in the PR: #33
It was made because rustup had an issue with SIGINT: rust-lang/rustup#806
If the issue of rustup is fixed we need to change SIGTERM to SIGINT.
Version of VSCode: 1.8.1
Version of the extension: 0.3.5
OS: OSX
It is required to check what happens if you change source code while your project is building.
In the past cargo was not able to check all targets of a project in one go. Even worse you had to specify --lib
if the project contained a library together with one or multiple binaries. Because of this a variation of the cargo check command was introduced.
Now cargo checks all targets, without any additional flags required. Therefore I suggest dropping the cargo check library command.
use following code:
use std::{thread, time};
fn main() {
loop {
let ten_millis = time::Duration::from_millis(1000);
thread::sleep(ten_millis);
println!("ok ...");
}
}
then shift+cmd+p, select "Cargo: Run Debug"
after that, shift+cmd+p, select "Cargo: Terminate Running Task"
task is still running.
Version of VSCode: 1.9.0
Version of the extension: 0.3.6
OS: Arch Linux
Description: I installed rustsym
via cargo install rustsym
. I have ~/.cargo/bin
in my PATH
, I set it in ~/.zprofile
(my shell is ZSH). Unfortunately, VSCode claims that rustsym
is not installed.
Output of the "Rust logging" channel: Where is the Rust logging channel?
Hi everybody,
Unfortunately, when I used outdated cargo-clippy, so I didn't write code to make cargo-clippy print messages in JSON.
This is going to be fixed in 0.2.3
Regards,
Alexey
Hi everybody.
I want to add a new command "Cargo: Start playground".
Executing of the new command
shows a quick pick dialog with the two choices: "Binary", "Library".
If a user cancels the quick pick dialog nothing happens.
A choice determines what kind of a project is created.
If a user chooses a certain choice
the extension creates a project in the OS-specific temporary directory and
opens a new window of VSCode with the created directory.
Closing the created window removes the created directory. - Removed because it adds complexity, but doesn't important enough
Sometimes you want to try something out.
Currently it is complicated.
The features makes that easy.
Thanks,
Alexey
Of course, three are some debugger extension for rust.
but you have to install extensions each other.
I think it will be great that vscode-rust includes debugger feature.
I wonder there is some reasons to not includes debugger feature.
Hi everybody,
Currently there are the following configuration properties: "buildArgs", "checkArgs", "clippyArgs", "runArgs", "testArgs".
It allows a user to specify what arguments are passed to a cargo invocation.
But it is a little inconvenient.
Let's assume we want to build a project with two pairs of features.
Currently we must change buildArgs to build with the first features.
Then we must change buildArgs to build with the second features.
This can be improved.
We can allow a user to describe custom build, check, clippy, run, test configurations.
The following description is same for build, check, clippy, run, test.
Execution of the "Cargo: Build" command and pressing of CTRL+B keybinding invokes a build using buildArgs.
Execution of the "Cargo: Build using custom configuration" command and pressing of CTRL+ALT+B keybinding shows an error message if there is no custom configurations otherwise invokes a build using arguments specified in the custom build configuration if there is only one custom build configuration otherwise it shows a quick pick of names of custom build configurations.
If a user cancels the quick pick nothing happens.
If a user selects one of the names a build using arguments of the chosen custom build configuration starts.
When the feature is implemented, we can remove all commands, which aren't default:
We need to define the following properties in the package.json:
The aforementioned properties need to be objects with the following properties:
Regards,
Alexey
It will be added later.
Version of VSCode: 1.9.1
Version of the extension: 0.3.6
OS: Linux
Description:
It would be nice to have a "Cargo build example" command which uses the base name (without extension) of the currently opened file.
Really annoyingly, the Ctrl-Shift-B build shortcut only seems to work if the cursor is focused in a .rs
file. If you're editing Cargo.toml
, or even have clicked in the output pane, VSCode will say "No task runner configured".
Visual Studio Code can show diagnostics,
but some people may like to execute any cargo
command in a terminal.
I think this feature is very easy, but elegant.
Diagnostics will not be shown if any cargo
command is executed in a terminal.
Version of VSCode: 1.8.1
Version of the extension: 0.35
OS: macOS Sierra
Description: certain snippets include an unnecessary \
example:
println!("\{:?}"); // should be println!("{:?}");
I intend to fix this by removing unnecessary escapes for braces, as these seem to be escaped automatically.
example:
"println!(\"${1:\\{${2::?}\\}}\");"
into
"println!(\"${1:{${2::?}}}\");"
I didn't find informations about/on why this fork.
Can you explain why this fork exists ?
How about add Rustup integration?
I think we must add this list of commands:
The "Create Playground" command replaces the current window instead of opening a new one.
Remove the "features" property.
Add the new property "buildArgs", which is an array of strings.
This property will be used when any build command is invoked.
Add the new property "checkArgs", which is an array of strings.
This property will be used when any check command is invoked.
Add the new property "clippyArgs", which is an array of strings.
This property will be used when a clippy command is invoked.
Add the new property "runArgs", which is an array of strings.
This property will be used when any run command is invoked.
Add the new property "testArgs", which is an array of strings.
This property will be used when any test command is invoked.
Edit
When testing this and pasting information i realized my rustc was 1.14, while i have the 1.15 source. I updated it, and the program no longer completely fails, i do get errors back. Though I do still wonder why I'm not getting cargo check :)
Original Issue
Version of VSCode: 1.9.1
Version of the extension: 0.3.6
OS: Mac OS
Description:
Hello, I have an issue where cargo runs rustc to do the check, instead of using cargo check. I've been digging through a bit of the extension code, and i see that it evaluates whether cargo check is there, and will call cargo check or cargo rustc. The problem with rustc, is the -Zno-trans option seems to be deprecated, and I can't compile the build with it. Where as trying in iTerm, cargo check
runs fine. Any ideas as to why it's still calling rustc?
Output when building on save:
Started cargo rustc --message-format json -- -Zno-trans
Compiling am_test v0.1.0 (file:///Users/aaronmcleod/src/rust/am_test)
error: Could not compile `am_test`.
To learn more, run the command again with --verbose.
Completed with code 101
It took approximately 0.77 seconds
My VSCode settings:
// Place your settings in this file to overwrite the default settings
{
"editor.renderWhitespace": "all",
"git.confirmSync": false,
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"rust.rustLangSrcPath": "/usr/local/src/rustc-1.15.0-src/src",
"rust.actionOnSave": "check",
"rust.cargoPath": "/Users/aaronmcleod/.cargo/bin/cargo"
}
Output of the "Rust logging" channel:
DEBUG: SuggestService: start(): enter
DEBUG: SuggestService: start(): racerPath=racer
DEBUG: MissingToolsInstallator: getMissingTools(): pathDirectories=["/Users/aaronmcleod/.rbenv/shims","/usr/local/Cellar/vim/7.4.027/bin","/usr/local/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin","/Users/aaronmcleod/bin","/Users/aaronmcleod/Library/Android/sdk/platform-tools","/Users/aaronmcleod/Library/Android/sdk/tools","/Users/aaronmcleod/.cargo/bin",""]
DEBUG: MissingToolsInstallator: getMissingTools(): tools={"racer":"racer","rustfmt":"rustfmt","rustsym":"rustsym"}
DEBUG: MissingToolsInstallator: getMissingTools(): missingTools=[]
Hello everybody.
I am opening this issue because I was asked in #66
I think that such feature may be very useful.
One unresolved question is that which variables to add.
I have a list:
I want it to be substituted when it is used as:
"*Args"
"args"
in any of "custom*Configurations"
What do you think about it?
Thanks
Remove the "checkOnSave", "checkWith" configuration properties.
Add a new property "actionOnSave" with the following available values:
If you run cargo check from within vscode without an open document the following exception is thrown
shell.ts:541 Cannot read property 'document' of undefined: TypeError: Cannot read property 'document' of undefined
at Function.cwd (/home/w4rh4wk/.vscode/extensions/kalitaalexey.vscode-rust-0.2.3/out/src/services/pathService.js:51:60)
at Function.runCargo (/home/w4rh4wk/.vscode/extensions/kalitaalexey.vscode-rust-0.2.3/out/src/services/commandService.js:432:31)
at checkCargoCheckAvailability.then.isAvailable (/home/w4rh4wk/.vscode/extensions/kalitaalexey.vscode-rust-0.2.3/out/src/services/commandService.js:194:18)
at process._tickCallback (internal/process/next_tick.js:103:7)e.onUnexpectedError @ shell.ts:541(anonymous function) @ shell.ts:457e.onUnexpectedError @ errors.ts:68o @ errors.ts:88t.onUnexpectedExtHostError @ mainThreadErrors.ts:13e.handle @ abstractThreadService.ts:34s @ ipcRemoteCom.ts:269f @ ipcRemoteCom.ts:226_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98
See screenshot below.
When attempting to call a function or member variable of a type, whether defined by an external crate(such as sdl2 in the below screenshot), or even a std::vec, no function signatures appear.
This occurs with "Racer: on" on the bottom left, and "Rust source" on the bottom right, so the obvious candidates are ruled out. My Rust Source setting is pointing to the correct directory, and all the binary files are being correctly pointed to.
If this issue is filed in error, please let me know what steps may be missing for a macOS user to get this setup.
Version of VSCode: 1.8.1
Version of the extension: 0.3.5
OS: Windows 10
Description:
I cannot figure out how to use "rust.customBuildConfigurations".
Reading the code it seems to me that the elements should be strings, I tried "rust.customBuildConfigurations": ["--debug"] (there is no --debug flag for cargo, I was confused) but the command seems to do nothing, no error message.
I expected the command "Cargo: Build using custom configuration" to trigger a debug build. Am I doing it wrong or is it a bug?
Output of the "Rust logging" channel:
No output.
It links back to this GitHub repository and accessing the probable URL directly on gitter.com does not appear to work.
I considered switching over to this from the original RustyCode (seeing as it hasn't been updated in quite a while despite open PRs), but the following issues prevented me from doing so:
The original RustyCode's license is MIT, which clearly states:
Copyright (c) 2015 Constantine Akhantyev
[..]
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
You have simply wiped out the original author and are now - strictly speaking - representing all of his work as your own (and not just your commits). You can (and should), of course, have your work on this fork under your own copyright, but as far as I know you may not just delete the original author's, you need to preserve it somehow. I cannot tell you how, as that would be giving legal advice, but as it stands now, I'm fairly certain you're violating the original author's copyright on his work on RustyCode up to the point of the fork.
You released vscode-rust under new versioning (at least in the vscode gallery), but neither did you remove the git tags for RustyCode's versions (here's how), nor did you provide new tags for vscode-rust's versions (though, of course, the latter requires the former in terms of sanity).
Hi everybody.
I have a question for all of us.
I want you to suggest me a way to show complex errors, i.e., errors like "doesn't live enough".
Let's look at the code:
fn main() {
let mut x = &5;
{
let y = 5;
x = &y;
}
}
The compiler emits the following output:
error: `y` does not live long enough
--> <anon>:6:5
|
5 | x = &y;
| - borrow occurs here
6 | }
| ^ `y` dropped here while still borrowed
7 | }
| - borrowed value needs to live until here
I like the way how it is made in Sublime Text, but unfortunately VSCode doesn't support CodeLens at user-defined column.
I have opened an issue: microsoft/vscode#18046 but the issue is stuck.
So I am open for suggestions.
Thanks
This is just an idea since there are a bunch of issues around with people saying that they just had to "use new error format". Should we make the "new" error format default and replace that option in the config with a useLegacyErrorFormat
option.
Hi,
vscode-rust: 0.3.0
code: 1.81
macOS: Sierra
This is basically the same issue as:- https://github.com/saviorisdead/RustyCode/issues/218
I switched to this plugin when it was indicated that this issue was fixed on the RustyCode issue log, but I still experience the same problems as I did with RustyCode.
I've tried all combinations of absolute paths and relative paths, but I've been unable to get anything to work correctly at this point. With the settings.json
as below, I get the message: Racer: Not found
"rust.racerPath": "~/.cargo/bin",
"rust.rustLangSrcPath": "~/git/rust/src",
"rust.rustfmtPath": "~/.cargo/bin",
"rust.rustsymPath": "~/.cargo/bin",
// etc..
Version of VSCode: 1.8.1
Version of the extension: 0.3.6
OS: Windows 10
Description: Error when saving file
fn main() {
println!("Hello, world!");
}
I was following this tutorial.
Error: spawnSync undefined ENOENT
Output of the "Rust logging" channel:
Don't know what a "Rust Logging" channel is.
When racer is crashed, Racer: Off
is shown in the statusbar and racer is not restarted.
Steps to reproduce the problem:
I'm using Linux 4.8.13-1-ARCH x86_64 GNU/Linux, node.js v6.5.0, vscode 1.8.1, racer 2.0.3.
r
after the c
in the main fn. This will crash racer with stack overflow.pub use self::{crash as crash};
fn main() {
c
}
stopDaemon
is called with null
, and Racer status is changed to Racer: Off
because !null == true
(at L152).I am sorry to answer you through this means, but apparently outlook.com does not accept mails from my mail server.
Here my reply
Hi Alexey,
It is a feature of the maintainer(s). I cannot assign an issue
to anyone, not even myself.
I think people with contributor privileges are able to assign issues.
- Alex
In cargo added a new command check.
Currently it is in nightly.
When it is stabilized fallback to cargo rustc -- -Znotrans
should be deleted.
Not sure if this is a problem with the extension, or the RLS, but after typing in Some(
, I got the following problem reported:
file: 'file:///c%3A/Users/diggs/workspace/lockless/src/containers/atomic_cell_array.rs'
severity: 'Error'
message: 'cannot find function `emoS` in this scope
not found in this scope'
at: '44,48'
source: 'rustc'
It seems like the plugin is not updating the cursor position when it's sending input to the RLS?
Shortly afterward, the RLS usually gets into a panic loop and has to be restarted.
Version of VSCode: 1.9.1
Version of the extension: 0.3.6
OS: Mac OSX
Description:
I just installed vscode-rust with all the dependencies (racer, rustfmt, etc.) Added it the PATH.
However, I can't get the auto-complete to work. Am I missing an obvious configuration step?
Output of the "Rust logging" channel:
DEBUG: SuggestService: restart
DEBUG: SuggestService: stop
DEBUG: SuggestService: start(): enter
DEBUG: SuggestService: start(): racerPath=/Users/nambrot/.cargo/bin/racer
DEBUG: SuggestService: restart (repeated a lot)
Version of VSCode: 1.8.1
Version of the extension: 0.3.5
OS: Linux x86_64
Whenever I run some application (such as a rocket based server) using "cargo run" from within the IDE, the application will stop and work well but I will not have any way to stop it anymore. Same way, trying to use samples using stdin (like the rust book guessing_game sample) will fail because I cannot interact with the in/output provided to / read from the cargo console window. Not sure whether this is a bug or just me being unable to use this tool right.
Perhaps it would be a good idea to include some default settings for the custom build and run configurations? This would also help to remove some confusion on how to configure these settings without needing to refer to the wiki article. For example:
"rust.customBuildConfigurations": [
{
"title": "Debug",
"args": []
},
{
"title": "Release",
"args": ["--release"]
}
],
"rust.customRunConfigurations": [
{
"title": "Debug",
"args": []
},
{
"title": "Release",
"args": ["--release"]
}
],
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.