uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Running REPL without a file asks for an open project #739

Closed fdodino closed 7 years ago

fdodino commented 8 years ago

It shouldn't ask for a specific project. If you have no projects, you cannot invoke REPL console.

PalumboN commented 8 years ago

If you have no projects, you cannot invoke REPL console.

:cry: Why?

fdodino commented 8 years ago

I've seen this is not easy to achieve, because here in LaunchReplWithoutFileHandler you create a Run Configuration mode in Eclipse.

But Eclipse needs a Project to run anything.

So... a workaround could be: ok, I create an empty project so I can run a console, but... I think it would appear an "Empty project" on Project Explorer. This would be confusing for any student.

A second thought: create an empty project without using Java Nature, only for running REPL console (lets say REPL nature). Filter this kind of project in Project Explorer but allow here to appear:

    def configureConfiguration(ILaunchConfigurationWorkingCopy it) {
        val root =  ResourcesPlugin.getWorkspace().getRoot()
        val openProjects = root.projects.filter[ project | project.isOpen() && project.hasNature(JavaCore.NATURE_ID)]

        if(openProjects.empty) {
            val x = new RuntimeException(Messages.LaunchReplWithoutFileHandler_notHavingWollokProject)
            DebugUIPlugin.errorDialog(DebugUIPlugin.shell, Messages.LaunchReplWithoutFileHandler_notHavingWollokProject, Messages.LaunchReplWithoutFileHandler_notHavingWollokProject, x) //
            throw x
        }

What do you think @tesonep @javierfernandes @npasserini ?

tesonep commented 8 years ago

One possible way of generating is generating the classpath and run the REPL as a "External Tool", just as it is a external program. The problem here is generating the classpath with all the elements. I think it can be worked in the same way the dependencies in a project, but It have to be checked. What do you think @javierfernandes ?

npasserini commented 8 years ago

If we generate an empty project couldn't we hide it from the default workspace?

On Mon, Aug 22, 2016 at 2:41 PM, Pablo Tesone notifications@github.com wrote:

One possible way of generating is generating the classpath and run the REPL as a "External Tool", just as it is a external program. The problem here is generating the classpath with all the elements. I think it can be worked in the same way the dependencies in a project, but It have to be checked. What do you think @javierfernandes https://github.com/javierfernandes ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/739#issuecomment-241400603, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OcrZ3WA1cz_ZBDe-igFpnqQ7ekdMks5qiZkNgaJpZM4I1hdp .

npasserini commented 7 years ago

I would really like to have a nice solution to this problem. @tesonep do you think we could do something?

tesonep commented 7 years ago

I have to retry to generate the running as an external tool. I have seen some tools that performs this, I will try to be "inspired" from them to see how an external tool can refer to the elements installed in the plugins.

tesonep commented 7 years ago

I have created a workaround for this. Basically I am creating (or reusing) an empty project, this project is hidden in the view. I have chosen this approach because to run as a external tool, the whole classpath for the bundle should be calculated (it need the launcher, the lib, and all the xtext / eclipse dependencies). This is calculated in the build to generate the scripts to run from the console but they are not persisted. Even accesing to this classpath, it should be transformed to get the JARs from the plugins directory.

Maybe a better implementation can recalculate this classpath and store them for usage.

npasserini commented 7 years ago

This is great, we should start having documentation for this kind of features... in fact we should have a manual for the IDE :S

2017-03-16 8:11 GMT-03:00 Pablo Tesone notifications@github.com:

Closed #739 https://github.com/uqbar-project/wollok/issues/739.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/739#event-1002521115, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OQcnN--XHRkbW8vLQLUl35R6ALzrks5rmRjggaJpZM4I1hdp .