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

Experimental support for the new error format #87

Merged
merged 8 commits into from
Sep 13, 2016

Conversation

Thinkofname
Copy link

This is mostly a result of me playing around with the new json formatted error messages but I decided to PR it to see what was thought of it.

It requires the latest dev build of Sublime Text 3 so I don't really expect this to be pulled as it stands.

This uses the phantom system to display error messages and hints inline with the code, i'm not sure how much I like this system but it seemed to be the nicest way I could think of displaying them.

I don't really do python so i'm sorry about the code

@dten
Copy link

dten commented Aug 23, 2016

I'm trying to try this out but where is expecting rust_syntax_checking to be enabled?


view_filename = view.file_name()

for line in output[1].split(os.linesep):
Copy link

Choose a reason for hiding this comment

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

hard to change this line to the below to make it work. i'm using windows 10 + rustup installed rust windows-gnu nightly
for line in output[1].split('\n'):

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, thanks

@Thinkofname
Copy link
Author

@dten I have a Rust.sublime-settings in .config/sublime-text-3/Packages/User (Preferences -> Browse packages) with

    // Enable the syntax checking plugin, which will highlight any errors during build
    "rust_syntax_checking": true
}

in it.
I'm not sure why it doesn't show in package settings but it didn't show before this PR either. I haven't really worked with sublime's api before to be able to fix it

@dten
Copy link

dten commented Aug 23, 2016

it's pretty sweet 👍 only thing is I currently get the cargo errors in-line and your errors

@dten
Copy link

dten commented Aug 23, 2016

bit of poking around shows a file called Main.sublime-menu with something like this in it makes the settings appear in the menu

    {
        "caption": "Preferences",
        "mnemonic": "n",
        "id": "preferences",
        "children":
        [
            {
                "caption": "Package Settings",
                "mnemonic": "P",
                "id": "package-settings",
                "children":
                [
                    {
                        "caption": "Rust",
                        "children":
                        [
                            {
                                "command": "open_file",
                                "args": {"file": "${packages}/Rust/Rust.sublime-settings"},
                                "caption": "Settings – Default"
                            },
                            {
                                "command": "open_file",
                                "args": {"file": "${packages}/User/Rust.sublime-settings"},
                                "caption": "Settings – User"
                            }
                        ]
                    }
                ]
            }
        ]
    }
]

@Thinkofname
Copy link
Author

Seems like something that should be its own PR instead of adding it to this one. (Unless someone thinks it's a good idea)

@brson
Copy link

brson commented Aug 29, 2016

cc @steveklabnik

I don't really have any understanding of sublime text, but I'll happily merge if someone says it's the right thing to do.

@brson
Copy link

brson commented Aug 29, 2016

cc @petrochenkov @Jayflux looks like you two have contributed recently. Maybe have opinions.

@jasonwilliams
Copy link
Member

jasonwilliams commented Aug 30, 2016

It requires the latest dev build of Sublime Text 3 so I don't really expect this to be pulled as it stands.

@Thinkofname I don't think thats a problem, using the API you can detect 3 or above, and run it if its 3, and don't run it if its not.
I'm wondering if we should have syntax highlighting on by default, as no one is going to know to switch this feature on. As long as they can switch it off, thats the main thing

See version checking example here:
https://github.com/Jayflux/sublime-rust/blob/improvement/syntaxChecking/syntaxCheckerPlugin.py#L8

I'm not sure why it doesn't show in package settings but it didn't show before this PR either. I haven't really worked with sublime's api before to be able to fix it

I never got that far, thanks for adding it though!

@Thinkofname It looks like you've built of my first PR, which got merged.
It might be worth you taking a look at my second PR, which has some updates and fixes:
#83

I would actually prefer this to go in, instead of my PR, as this seems more complete.
I will pull it down and have a play with it later on

@Thinkofname
Copy link
Author

Added the package settings menu item using @dten's suggestion and added the version checking from @Jayflux, thanks.

I also cleaned things up a bit.

@jasonwilliams
Copy link
Member

jasonwilliams commented Aug 30, 2016

@Thinkofname just tested this branch, its working nicely!

testingrust

@dten can we switch this feature on by default? or would you rather users add a setting to have it.
Its a nice feature but not sure anyone would know its there

@dten
Copy link

dten commented Aug 30, 2016

My only issue is I currently get both errors when using building with cargo
Have no opinion if it should be on by default 👍
image

@jasonwilliams
Copy link
Member

@dten could you walk me through step by step how you got that to happen so i can re-create the problem?
Also are you on IRC?

@Thinkofname
Copy link
Author

@dten Guessing thats using the build system feature of sublime (Ctrl + B)?

Thats a plugin built-in to sublime (seperate from this) which uses the file_regex of the .sublime-build files we provide to place them. Removing that would unfortunately break using F4 to jump to the errors

@dten
Copy link

dten commented Aug 31, 2016

it was using Ctrl+B
I guess it should be possible to provide a build system programmatically that is the equiv of this on-save action that runs full cargo and picks the errors out like this ? Something to come back to I think

@jasonwilliams
Copy link
Member

@Thinkofname could you push a commit on this PR setting rust_syntax_checking to true?

@Thinkofname
Copy link
Author

@Jayflux sorry about the delay, done

@jasonwilliams
Copy link
Member

@brson @steveklabnik @dten
I think this is ready to go in

@brson brson merged commit bb8d73c into rust-lang:master Sep 13, 2016
@brson
Copy link

brson commented Sep 13, 2016

Thanks @Thinkofname and @Jayflux.

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.

4 participants