Our golang devfile (https://github.com/eclipse/che-devfile-registry/tree/master/devfiles/go) uses https://github.com/golang/example.git as a sample project. It has many runnable files with func main(), but we have only tasks for outyet subproject. AFAIK there is no way how to run Go file from IDE. Some languages can run files with little Run | Debug hovering over the runnable function, bug in Go, this does not work. So only way how to run files is by running terminal and write commands. I would consider this as not good IDE user experience.
func main().Could the command be parameterized so it take the file name? We used to have that in the commands macro?
cc @RomanNikitenko and @azatsarynnyy
Yes, it can be parameterized.
I think the best solution would be adding Run CodeLens support for func main() into VS Code Go extension upstream project.
@azatsarynnyy that would be awesome. parametrized task is ok for now, I guess
@azatsarynnyy Could you please show how to configure that task to @sparkoo ?
I don't think it's something very costly so we should take it as part of the 7.0 or 7.1
@rhopp : as you are triager today, I rely on you ;)
@slemeur @sparkoo
a command for running the current file can look like the following:
}
"type": "che",
"label": "run current file",
"command": "go get -d && go run ${file}",
"target": {
"containerName": "go-cli"
}
}
FYI all the variables that can be processed by the substitution mechanism are available through Variable: List All command in Theia commands palette.
Note, resolving the variables in the command property for che tasks will come with the PR https://github.com/eclipse/che-theia/pull/373
I'm labelling this issue as bug (as misconfiguration of the command).
Most helpful comment
@slemeur @sparkoo
a command for running the current file can look like the following:
FYI all the variables that can be processed by the substitution mechanism are available through
Variable: List Allcommand in Theia commands palette.Note, resolving the variables in the
commandproperty forchetasks will come with the PR https://github.com/eclipse/che-theia/pull/373