Stream: t-compiler

Topic: IDE


Rakshith Ravi (May 12 2020 at 12:02, on Zulip):

Hey, out of curiosity, what IDE do you guys use? I'm currently using VSCode and it's being super slow to show the types of variables and stuff. Doesn't seem to work well for large repos. Any suggestions on a better IDE?

Jonas Schievink (May 12 2020 at 12:17, on Zulip):

Have you tried out rust-analyzer? You're probably using RLS, right?

Rakshith Ravi (May 12 2020 at 12:46, on Zulip):

Yeah, RLS

Rakshith Ravi (May 12 2020 at 12:50, on Zulip):

OMG rust-analyzer is so good!

mark-i-m (May 12 2020 at 15:46, on Zulip):

Btw, the vscode rust plugin supports basic rust-analyzer as of today, apparently...

nikomatsakis (May 12 2020 at 18:06, on Zulip):

@Rakshith Ravi if you're hacking on rustc, you can configure rust-analyzer to run x.py check to get the list of problems

nikomatsakis (May 12 2020 at 18:06, on Zulip):

I'm not sure how well documented that is

nikomatsakis (May 12 2020 at 18:07, on Zulip):

you want to put

{
    "rust-analyzer.checkOnSave.overrideCommand": [
        "./x.py",
        "check",
        "--json-output"
    ],
    "editor.formatOnSave": true
}

into .vscode/settings.json

nikomatsakis (May 12 2020 at 18:07, on Zulip):

I at least find that very convenient

nikomatsakis (May 12 2020 at 18:07, on Zulip):

now if only I could get the formatter to use whatever random rustfmt x.py fmt does...

nikomatsakis (May 12 2020 at 18:08, on Zulip):

cc @matklad is it possible to configure the rustfmt binary that is used by vscode rust plugin, btw?

Rakshith Ravi (May 12 2020 at 18:09, on Zulip):

oh cool! I'll check that out. Thanks!

FĂ©lix Fischer (May 12 2020 at 20:10, on Zulip):

Thank u for that snippet @nikomatsakis, that's very useful!!

nikomatsakis (May 12 2020 at 20:53, on Zulip):

need to add that to rustc-dev-guide

nikomatsakis (May 12 2020 at 20:53, on Zulip):

if one of you wants to make a PR, it would be most welcome (presuming it's not in there already...)

nikomatsakis (May 12 2020 at 20:53, on Zulip):

cc @WG-rustc-dev-guide :point_up:

Santiago Pastorino (May 12 2020 at 20:54, on Zulip):

oh we were literally talking about this in a meeting with @mark-i-m

mark-i-m (May 12 2020 at 20:54, on Zulip):

And I also created this issue: https://github.com/rust-lang/rustc-dev-guide/issues/703

Santiago Pastorino (May 12 2020 at 20:55, on Zulip):

I think we want a getting started section in rustc-dev-guide part 1, which has some info on how to setup your environment, how to build rustc, how to run tests, how to setup editor, etc

Wesley Wiser (May 12 2020 at 21:03, on Zulip):

Tying that into the "so you want to do {x}" documentation I've seen mentioned would be great as well. A lot of contributions do not need to build the compiler at all and the vast majority of contributions don't need a stage 2 compiler. Having specific workflows that make contributing as fast as possible would be excellent.

nikomatsakis (May 12 2020 at 21:19, on Zulip):

btw

matklad (May 12 2020 at 22:07, on Zulip):

Yup, it's possible to fully override rustfmt with this option: https://github.com/rust-analyzer/rust-analyzer/blob/23cc6908a7d6547bddf779227e3e1d5c5912861e/editors/code/package.json#L251-L262

matklad (May 12 2020 at 22:08, on Zulip):

rust-analyzer.rustfmt.overrideCommand

Santiago Pastorino (May 12 2020 at 22:25, on Zulip):

nikomatsakis said:

you want to put

{
    "rust-analyzer.checkOnSave.overrideCommand": [
        "./x.py",
        "check",
        "--json-output"
    ],
    "editor.formatOnSave": true
}

into .vscode/settings.json

is someone doing something like this on vim?

Santiago Pastorino (May 12 2020 at 22:26, on Zulip):

I'm using coc, and placed a .vim/coc-settings.json with the following ...

Santiago Pastorino (May 12 2020 at 22:26, on Zulip):
{
        "rust-analyzer.checkOnSave.overrideCommand": [
                "./x.py",
                "check",
                "--stage 1",
                "--json-output"
        ]
}
Santiago Pastorino (May 12 2020 at 22:26, on Zulip):

but doesn't seem to work

nikomatsakis (May 12 2020 at 22:31, on Zulip):

matklad said:

Yup, it's possible to fully override rustfmt with this option: https://github.com/rust-analyzer/rust-analyzer/blob/23cc6908a7d6547bddf779227e3e1d5c5912861e/editors/code/package.json#L251-L262

ah, nice, so we could link it to stage0/bin/rustfmt or whatever...

simulacrum (May 12 2020 at 23:18, on Zulip):

/me is reminded that we likely want to create a build/bin directory that's symlinked to the "real" stage0 bin or just drop the build triple (and not support multiple build triples at once)

matklad (May 14 2020 at 07:47, on Zulip):

mark-i-m said:

Btw, the vscode rust plugin supports basic rust-analyzer as of today, apparently...

@mark-i-m keep in mind that "supports" means that it doesn't crash on start-up :-) There's a ton of extra features in rust-analyzer own plugin at the moment, the most notable one being code actions

Last update: Jun 04 2020 at 16:50UTC