Skip to content

Get error markers working again #240

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

Open
Boddlnagg opened this issue Oct 22, 2016 · 9 comments
Open

Get error markers working again #240

Boddlnagg opened this issue Oct 22, 2016 · 9 comments

Comments

@Boddlnagg
Copy link
Contributor

Boddlnagg commented Oct 22, 2016

Error markers (squiggly lines) no longer appear with #234. The build errors will be shown in the error list, and clicking on them navigates to the error location, but the markers are missing. However, it's not clear to me whether adding the error markers from the MSBuild errors is a good idea, because they won't be updated when the file is changed (until you build again). Integrating with the Rust Language Server would be much better.

@quixoticaxis
Copy link

quixoticaxis commented Nov 7, 2016

I don't know how it was before, but I'd like to ask if the notes are shown (or will be shown) somewhere.
For example,

  --> src\main.rs:24:21
   |
24 |     match guess.cmp(&secret_number)
   |                     ^^^^^^^^^^^^^^ expected struct `std::string::String`, found integral variable
   |
   = note: expected type `&std::string::String`
   = note:    found type `&{integer}`

I understand that ^^^^^^^^ will be shown as error markers but where do notes and explanation go?

@Boddlnagg
Copy link
Contributor Author

No, the notes are currently not shown. We take JSON formatted errors (cargo build --message-format=json) and extract the main message and span. The concept of multiline notes and explanations (and multiple spans) in error messages is somewhat incompatible to the whay VS usually presents errors. Do you have a good idea how to present them?

@quixoticaxis
Copy link

Well, I have an idea of how to present them: the same way as other "built-in" languages do - they show error description in a bubble that pops up when you hover the marker with a pointer. I've never created VS extensions so I'm not sure if it's hard to implement though.

@quixoticaxis
Copy link

At least it would be good to iterate over children in json and add them to the description section of an error. It doesn't looks perfectly but at least that way there is more information (like in good ol' c++ error messages).

@Boddlnagg
Copy link
Contributor Author

You're welcome to improve that situation 👍 The build errors are created here: https://github.com/PistonDevelopers/VisualRust/blob/master/VisualRust.Build/Rustc.cs#L370 (LogRustcMessage)

@quixoticaxis
Copy link

@Boddlnagg hello again, I'm totally new to GitHub and can't check what I've done in full build (missing components to build solution and Java) but I've added a few lines to aggregate notes, hope they do their job. How can I make a pull request for review (request from GitHub Desktop fails)? Also are there any instructions on how to actually build the whole solution?
github client

@Vbif
Copy link
Contributor

Vbif commented Nov 15, 2016

@quixoticaxis Do you install all software components from https://github.com/PistonDevelopers/VisualRust#prerequisites ?

@Boddlnagg
Copy link
Contributor Author

@quixoticaxis I don't know the GitHub Desktop Software ... but you can create a PR from the web interface from any branch in your fork. How to create a branch is explained in many tutorials in the web.

https://github.com/PistonDevelopers/VisualRust#contributing has all the information about how to get a full build working. It's especially important that you copy all the files from the VisualRust.Build debug output directory to %ProgramFiles(x86)%\MSBuild\VisualRust to make the MSBuild integration work.
Or, if you're hacking on VisualRust.Build and don't want to copy all the files after each change, you can create a "redirection" by creating C:\Program Files (x86)\MSBuild\VisualRust\VisualRust.Rust.targets with the following content (all the other files are referenced relatively) and setting the correct path to your Git clone in there:

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- Copy this file to C:\Program Files (x86)\MSBuild\VisualRust\ to load build rules directly from build output -->
  <Import Project="<your>\<path>\<to>\VisualRust\VisualRust.Build\bin\Debug\VisualRust.Rust.targets" />
</Project>

@quixoticaxis
Copy link

@Boddlnagg thank you, I'll create a PR a bit later then. Unfortunately I can't install Java where I am now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants