Open JinShil opened 6 years ago
Thanks a lot for the request, Mike!
However, I'm inclined to close it as a WONTFIX. Here are my thoughts
it's would be a lot of work to change the frontend and backend to do so
it would be hard to support this in the frontend without adding visual baggage
run.dlang.io doesn't try to be an IDE, just a convenient way to play with D code
there aren't that many advantages I see of having multiple files - except for (1) testing and showing how module imports work, (2) using advanced D features like string imports, (3) find/test import bugs in DMD and (4) if your file is so large that it needs to be split up into multiple modules for better visibility
there are existing, sophisticated web IDEs
for "bigger" things I personally prefer to have my vim ...
Please see my NG thread about the D boilerplate template. It can be used as a template for the awesome WebIDE Cloud9 - simply use https://github.com/wilzbach/d-bootstrap as a template (or clone it in an existing workspace), hit make
and your D code runs automagically.
Imho we will never be as good as Cloud9 which has an entire development team and can utilize the AWS infrastructure directly.
What is your use case?
My use case is for sharing code and ideas with others. So, for example, I could post an example to illustrate a minimal runtime with an object.d and a main.d, and readers can try the example immediately. Or to illustrate concepts such as visibility from one module to another. This can be useful for demonstrating features and bugs on the forum or in Bugzilla. I also think there are a use cases in the documentation where it would be useful to teach concepts.
Perhaps I could make use of Cloud9 for such things; I've never tried.
I will say that this is a luxury and not a necessity. It's your call. No hard feelings if you choose not to implement it, I promise.
Well, I agree that's "generally useful", but not many click & run platforms I know of/have used, support this:
Actually https://godbolt.org is the online platform that supports this that comes to my mind and it's windowing framework looks rather complicated.
Perhaps I could make use of Cloud9 for such things; I've never tried.
If you use the micro instances, the first year is for free. Though I think you need to explicitly add people to the workspace
So, for example, I could post an example to illustrate a minimal runtime with an object.d and a main.d, and readers can try the example immediately.
That's actually a good use case - think ... we could "hack" that in though. We already support import from GH's gist, so in theory something similar to DUB single file format could work, e.g.
# add object.d from https://gist.github.com/anonymous/451a0fb778381b11ed80078d5e0b6653
void main() {
}
Well that would be a simple start and it's left optional whether the frontend actually needs to support multiple files.
Well if you or someone else want to take a go at this, it would require the following adjustments:
1) Allow to pass multiple files to the Docker container https://github.com/dlang-tour/core-exec (maybe simply as additional arguments). Currently STDIN can be passed as $2
, but an environment variable like DOCKER_COLOR
or DOCKER_FLAGS
would work too.
2) Modify the ExecProviders to accept multiple sources: https://github.com/dlang-tour/core/blob/master/source/exec/iexecprovider.d
3) Modify the invocation of the docker image to pass on the additional files https://github.com/dlang-tour/core/blob/master/source/exec/docker.d#L133
4) Modify the REST API to accept multiple files: https://github.com/dlang-tour/core/blob/master/source/rest/apiv1.d
As mentioned I don't need this, so I won't work on this in the foreseeable future, but I'm happy to merge PRs.
Initial HAR support is now live: https://run.dlang.io/is/ZHm2Xe
It's still experimental and most of the buttons don't work, but it should be enough to judge whether it's useful in this form.
And also we can start integrating it into the DTour + dlang.org where these buttons don't exist anyways.
Tried a minimal runtime test with this: https://run.dlang.io/is/rrhgJL
object.Exception@rdmd.d(105): Option -o- currently not supported by rdmd
I'm not sure what that means.
I'm not sure what that means.
I initially tried to use rdmd
for multiple files because -run
is terribly broken (see e.g. https://github.com/dlang/dmd/pull/7927), but well it turns out rdmd
isn't a good choice for this either.
Anyhow I just pushed a fix and it should be deployed in a few minutes:
It works now: https://run.dlang.io/is/UwoLSC
So cool!. Thanks. I'm OK to close this issue if you consider it solved.
Ah wait!. This gave me a strange error: https://run.dlang.io/is/gHkwbJ
/sandbox/object.d(1): Error: found `EOF` when expecting `}` following compound statement
Hmm it goes away if I remove the comment: https://run.dlang.io/is/7k0KLk
For reference, this was a bug in har. An updated version of har has been deployed: https://run.dlang.io/is/KBOVEb
the main function doesn't seem to be found when using HAR right now.
However if you add -i -run app.d
to the dmd arguments, you can work around this issue
This is a feature request to add support to run.dlang.io for editing/compiling multiple modules/files.