Stream: git-wasmtime

Topic: wasmtime / Issue #2286 Store generated instructions code ...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 20:55):

sirgl opened Issue #2286:

Usually I explore new API by completion and quick documentation in IDE. For the instructions emission methods (the core API of cranelift) this functionality is absent.

Now instructions code is generated in cranelift-codegen in during build and then it get inserted into library using include.
This allows to have always fresh version of instruction code, but at the same time breaks experience with IDE.
Both IntelliJ and rust-analyser can't index code that created during build and can't provide completion/navigation/reliable refactorings.

Feature / Implementation

Insert generated code for instructions right into library. It will allow IDE index it and provide all information for completion/hover and so on.

Benefit

Cranelifts' newcomers will be able to explore and understand API quickly.

Alternatives

Leave everything as is. For newcomers API will still be a bigger problem.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 21:00):

sirgl edited Issue #2286:

Usually I explore new API by completion and quick documentation in IDE (and AFAIK most of the people do so). For the instructions emission methods (the core API of cranelift) this functionality is absent. You have to go to online documentation first and then write code.

Here I would expect to see return_, but there is nothing in completion list.
![2020-10-11_22-54](https://user-images.githubusercontent.com/11944514/95690071-6ac3de80-0c15-11eb-9a34-acd1352e2214.png)

Now instructions code is generated in cranelift-codegen in during build and then it get inserted into library using include.
This allows to have always fresh version of instruction code, but at the same time breaks experience with IDE.
Both IntelliJ and rust-analyser can't index code that created during build and can't provide completion/navigation/reliable refactorings. Also it is bad for validation of parameter types.

Feature / Implementation

Insert generated code for instructions right into library. It will allow IDE index it and provide all information for completion/hover and so on.

Benefit

Cranelifts' newcomers will be able to explore and understand API quickly.

Alternatives

Leave everything as is. For newcomers API will still be a bigger problem.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 21:02):

sirgl edited Issue #2286:

Usually I explore new API by completion and quick documentation in IDE (and AFAIK most of the people do so). For the instructions emission methods (the core API of cranelift) this functionality is absent. You have to go to online documentation first and then write code.

Here I would expect to see return_, but there is nothing in completion list.
![2020-10-11_22-54](https://user-images.githubusercontent.com/11944514/95690071-6ac3de80-0c15-11eb-9a34-acd1352e2214.png)

Now instructions code is generated in cranelift-codegen during build and then it get inserted into library using include.
This allows to have always fresh version of instruction code, but at the same time breaks experience with IDE.
Both IntelliJ and rust-analyser can't index code that created during build and can't provide completion/navigation/reliable refactorings. Also it is bad for validation of parameter types.

Feature / Implementation

Insert generated code for instructions right into library. It will allow IDE index it and provide all information for completion/hover and so on.

Benefit

Cranelifts' newcomers will be able to explore and understand API quickly, IDE will be able to provide inline documentation, refactorings, parameter hints, errors.

Alternatives

Leave everything as is. For newcomers API will still be a bigger problem.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 21:03):

sirgl edited Issue #2286:

Usually I explore new API by completion and quick documentation in IDE (and AFAIK most of the people do so). For the instructions emission methods (the core API of cranelift) this functionality is not working in IntelliJ and rust-analyser. You have to go to online documentation first and then write code.

Here I would expect to see return_, but there is nothing in completion list.
![2020-10-11_22-54](https://user-images.githubusercontent.com/11944514/95690071-6ac3de80-0c15-11eb-9a34-acd1352e2214.png)

Now instructions code is generated in cranelift-codegen during build and then it get inserted into library using include.
This allows to have always fresh version of instruction code, but at the same time breaks experience with IDE.
Both IntelliJ and rust-analyser can't index code that created during build and can't provide completion/navigation/reliable refactorings. Also it is bad for validation of parameter types.

Feature / Implementation

Insert generated code for instructions right into library. It will allow IDE index it and provide all information for completion/hover and so on.

Benefit

Cranelifts' newcomers will be able to explore and understand API quickly, IDE will be able to provide inline documentation, refactorings, parameter hints, errors.

Alternatives

Leave everything as is. For newcomers API will still be a bigger problem.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2020 at 22:13):

bjorn3 commented on Issue #2286:

You can enable support for build script generated code in rust-analyzer using:

{
    "rust-analyzer.cargo.loadOutDirsFromCheck": true,
}

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2020 at 05:56):

sirgl commented on Issue #2286:

Thank you, then, probably, you should add it to readme to dev instructions.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2020 at 17:06):

abrown commented on Issue #2286:

@sirgl, do you mind creating a PR with that setup information? (And I wonder if there is a way to add OUT dirs to IntelliJ scanning...).

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2020 at 12:18):

sirgl commented on Issue #2286:

Seems that in IntelliJ you can enable org.rust.cargo.evaluate.build.scripts in Experimental Features. Sure, I'll make PR.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2021 at 18:03):

bjorn3 commented on Issue #2286:

Should this be closed?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 22 2021 at 17:02):

abrown commented on Issue #2286:

I'm think so; there's a way to do this with IDEs using rust-analyzer (e.g. VS Code).

view this post on Zulip Wasmtime GitHub notifications bot (Mar 22 2021 at 17:02):

abrown closed Issue #2286:

Usually I explore new API by completion and quick documentation in IDE (and AFAIK most of the people do so). For the instructions emission methods (the core API of cranelift) this functionality is not working in IntelliJ and rust-analyser. You have to go to online documentation first and then write code.

Here I would expect to see return_, but there is nothing in completion list.
![2020-10-11_22-54](https://user-images.githubusercontent.com/11944514/95690071-6ac3de80-0c15-11eb-9a34-acd1352e2214.png)

Now instructions code is generated in cranelift-codegen during build and then it get inserted into library using include.
This allows to have always fresh version of instruction code, but at the same time breaks experience with IDE.
Both IntelliJ and rust-analyser can't index code that created during build and can't provide completion/navigation/reliable refactorings. Also it is bad for validation of parameter types.

Feature / Implementation

Insert generated code for instructions right into library. It will allow IDE index it and provide all information for completion/hover and so on.

Benefit

Cranelifts' newcomers will be able to explore and understand API quickly, IDE will be able to provide inline documentation, refactorings, parameter hints, errors.

Alternatives

Leave everything as is. For newcomers API will still be a bigger problem.


Last updated: Dec 23 2024 at 12:05 UTC