Skip to content
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

first stab at adding syntax checking on save similar to GoSublime #82

Merged
merged 10 commits into from May 31, 2016

Conversation

jasonwilliams
Copy link
Member

HI guys
I really liked the syntax checking on save within GoSublime.
So i had a go at trying it for Rust.

Under the hood all this plugin does is call "cargo run" in the same directory the file is in, if there's any errors it will try and parse out the first line number, then return that back to sublime.

It would be nice if some sublime users could take a look at my PR and tell me what they think needs adding or their thoughts.

here is a demo
Thanks Jason

testingpr

@jasonwilliams
Copy link
Member Author

jasonwilliams commented May 27, 2016

changing cargo run to cargo rustc -- -Zno-trans
Its now much faster
however with very large projects (servo) this seems to fail at updating the registry, if anyone has any idea let me know!

@jasonwilliams
Copy link
Member Author

Fixed the error now, and added async so no hanging now either!

@jasonwilliams
Copy link
Member Author

Hi all, its now faster and....
I've added tooltips, check out the new gif:

testingpr2

@steveklabnik
Copy link
Member

Neat! I don't use sublime personally, so I'm not sure I want to merge.

@jasonwilliams
Copy link
Member Author

It would be good to hear some reviews from people who use sublime to see what they think

@XAMPPRocky
Copy link
Member

@Jayflux It looks great! My only question is why do all tooltips start with a 'b?

@jasonwilliams
Copy link
Member Author

Its a bug, i'm working on that

return original_pt


def lol():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this was unintentionally left in?

@jasonwilliams
Copy link
Member Author

@Aaronepower the tooltip bug if fixed, here's a preview
It looks like a callback has to be provided to show_popup_menu so ive just created a callback function which does nothing.

testingpr3

@XAMPPRocky
Copy link
Member

@Jayflux Looking great. You should probably add a comment on the callback explaining that behaviour, and have you tested this against projects with a build script? As they typically put all the code into main.rs or lib.rs. I don't think it's necessary to cover this case, just to make sure they don't crash the plugin.

tokei uses a build script, so you can test it on that if you need.

@jasonwilliams
Copy link
Member Author

Just tested on tokei
Because cargo reports the error is in main.rs and the actual error was in marcos.rs the plugin failed to show a dot on marcos.rs

We decided this isn't really an issue and there's very little we can do about it, the plugin just silently fails

@jasonwilliams
Copy link
Member Author

jasonwilliams commented May 31, 2016

@Aaronepower I've now added settings, so its not on by default.
I've also updated the readme on how to add settings and how to add syntax checking.
https://github.com/Jayflux/sublime-rust/tree/addingSyntaxChecking

I've also checked it on different color schemes

@jasonwilliams
Copy link
Member Author

@steveklabnik could you take a look at this?
There's some more improvements I can add, but I think i'm done (for now)

@steveklabnik
Copy link
Member

As I said above, it seems good to me, but I also don't use sublime. I'm not actually sure who is in charge of the sublime plugin. Looking at recent PRs, it looks like @brson and myself were the last ones to merge things. He is on vacation, so I'm gonna just merge this. 👍

@steveklabnik steveklabnik merged commit 167018c into rust-lang:master May 31, 2016
@dten
Copy link

dten commented Jun 1, 2016

Don't want to be a spoilsport but there's already a pretty good linter here.
https://github.com/oschwald/SublimeLinter-contrib-rustc

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

Successfully merging this pull request may close these issues.

None yet

4 participants