Skip to content

Cannot get error to actually display in-code #174

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

Closed
fschutt opened this issue Apr 1, 2017 · 8 comments
Closed

Cannot get error to actually display in-code #174

fschutt opened this issue Apr 1, 2017 · 8 comments

Comments

@fschutt
Copy link

fschutt commented Apr 1, 2017

Sublime Text Version

Sublime Text 3 (Build 3126)

Rust Enhanced Version

1.3.0

Operating system

x86_64 GNU/Linux
4.4.0-66-generic

Expected behavior

The errors should show up where I have them, like in the screenshot in the main README.

Actual behavior

This:

screenshot from 2017-04-02 00-06-35

The errors get displayed, but in the bottom half of the screen. So to actually get to an error, I have to use the lower console window, scroll it to the top (because it always scrolls to the bottom) to get the first error, then see where the error is, then go to that location in the code (if I use something like Goto Anything, the lower console window will disappear, I have to recompile to get the list of errors back).

What is going on? Is this supposed to be this way and if yes, how is this user friendly? I want the error messages to display in the red box, not the line number. The line number tells me nothing. Clicking on the red box doesn't do anything.

Steps to reproduce

  1. Install the plugin
  2. Trigger a build error
@ehuss
Copy link

ehuss commented Apr 1, 2017

The inline error reporting currently only works when you save a file (it triggers a partial compile in the background). What you are showing is the Build system output. There is work in progress (see #165) to enhance the build system to also show inline errors.

If you are not seeing inline errors when you save the file, is there any output in the Sublime console?

@fschutt
Copy link
Author

fschutt commented Apr 1, 2017

Saving a file does nothing. Or at least, the output doesn't end up on the screen, I don't know how I could check if the recompile is actually triggered. Only using CTRL+B to build the project works. There is output on the lower half of the screen:

screenshot from 2017-04-02 01-14-23

That is all I have been working with. rustc and cargo are found in the $PATH, if that matters. The above is what I have been working with for a week now. I have not changed any settings, all default.

I do not have a sublime-project file if that matters (saw it in #165 ).

@ehuss
Copy link

ehuss commented Apr 1, 2017

The Sublime console can be opened with Ctrl+` (backtick). There might be some diagnostic information there.

@fschutt
Copy link
Author

fschutt commented Apr 1, 2017

Ah! There is output when I save the file:

Running 'cargo metadata --no-deps'
Running 'cargo rustc --lib -- -Zno-trans -Zunstable-options --error-format=json --test'
rust: /home/felix/Development/mapedit/src/graphics/conversion.rs
[error]: cannot find function `lat_lon_to_utm_x_y` in this scope
rust: /home/felix/Development/mapedit/src/graphics/conversion.rs
[error]: did you mean `lon_lat_to_utm_x_y`?
rust: /home/felix/Development/mapedit/src/graphics/conversion.rs
[error]: cannot find function `utm_x_y_to_lat_lon` in this scope
rust: /home/felix/Development/mapedit/src/graphics/conversion.rs
[error]: did you mean `utm_x_y_to_lon_lat`?

This is what I get when I save the file. However, there is nothing ending up on the screen....

Wait, I just noticed: I do actually get the error messages - if the console is opened!

screenshot from 2017-04-02 01-26-53

This is very strange. Apparently, the plugin does not work by default, it requires that you at least once open the Sublime Text console and save a file. THEN and only then you will get the actual error messages on a save. If you are like me and just install the plugin, it doesn't work. To make it work, you have to open the console and (while the console is open), save the file. This will actually "activate" the plugin. The change is persistent, it still works after a restart of Sublime Text, even without having the console open.

I'll restart my computer, see if it changes anything. The plugin works now as expected, but I hope this is persistent.

@fschutt
Copy link
Author

fschutt commented Apr 1, 2017

Alright, it seems that it is persistent between restarts of Sublime Text, but once I restart my computer, it's back where it was at the beginning.

Now it gets funky: When I save now, the errors actually appear for a very short period of time (a few milliseconds), flicker / flash a few times, then disappear after about a second.

Again, the error is fixed by opening the console and saving the file while the console is opened. The errors will display correctly - until I restart the computer.

@ehuss
Copy link

ehuss commented Apr 2, 2017

When it says something like this:

rust: /home/felix/Development/mapedit/src/graphics/conversion.rs
[error]: cannot find function `lat_lon_to_utm_x_y` in this scope

That just means that rust found an error, but that file is currently not open, so it will not display any messages for that file.

I can't imagine why opening the Sublime console would make any difference in the behavior.

As for the flickering, I suspect the issue is that building/checking your package is relatively slow. It should display the text Rust syntax check running... in the status field at the bottom of Sublime while the check is running. If you attempt to save a file while a check is running, it will unfortunately run multiple checks (one after another), and it will clear/flicker when the second one starts. This has also been fixed in #165.

@dten
Copy link

dten commented Apr 2, 2017

Your syntax is set to Rust not Rust Enhanced.

I suggest disabling the default Rust package so only one is thinking about errors. It could be one is wrong out the others messages.

also what version of rust are you using?

@fschutt
Copy link
Author

fschutt commented Apr 2, 2017

Thanks for the replies.

Your syntax is set to Rust not Rust Enhanced.

I didn't know that the plugin added a special syntax, that isn't enabled by default. The main README says nothing about it (only tells you to install the plugin, but not to change the syntax afterwards). Thanks for the hint. Changing the syntax at least formats the errors more nicely, not sure if it changed anything about the error handling.

My rustc version is: rustc 1.17.0-nightly (b1e31766d 2017-03-03)

The thing is, the Rust syntax check running... did not work before I saved a file while having the console open (that was the first time it worked).

For the most part it is working now, but it didn't work for over a week (where I constantly saved files, of course). I claim that the Rust syntax check running... did not appear in this week (just the regular "Saved file, ...."), can't prove it, however.

Well. If nobody can replicate this issue and other people don't have this problem, then maybe something is wrong with my setup. It works now, so I am closing this issue.

@fschutt fschutt closed this as completed Apr 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants