red / VScode-extension

Red extension for Visual Studio Code
Boost Software License 1.0
40 stars 17 forks source link

Failed starting server version 0.4.2 #45

Closed GiuseppeChillemi closed 3 years ago

GiuseppeChillemi commented 4 years ago

Hi, I am on Windows and I am trying the latest version. I can't start the server, I get the following message:

[Error - 14:45:30] Starting client failed
Launching server using command C:\ProgramData\Red failed.

My configuration is the following:

{
    "red.buildDir": "C:\\Users\\Administrator\\Dropbox\\Svi\\",
    "red.redPath": "C:\\Users\\Administrator\\Dropbox\\Svi\\red.exe",
    "red.rls-debug": true,
    "red.devOptions": [

    ],
    "red.excludedPath": ""
}
Jose-Moreno commented 4 years ago

@GiuseppeChillemi Maybe try "red.redPath": "C:\\Users\\Administrator\\Dropbox\\Svi\\red.exe --CLI" ?

In my case I set the red.redPath directly to the console / CLI binary found in the ProgramData folder i.e red.redPath": C:\\ProgramData\\Red\\console-2020-10-1-51363.exe to avoid issues and it worked too.

By the way I literally just did this 5 minutes ago, so it should work now.

p.s. I compiled the red-console.exe from the source code, but it also worked with their latest auto build binaries.

EDIT: Well it seems in order to compile you NEED to use red.exe instead of the console executable. Sigh. Ok the main problem I had was that the VSCode extension command invokes cmd /c and in my case I was using the actual cmd instead of powershell.

Currently Red has this bug for windows but since someone provided a workaround it was closed, god knows why.

Anyway If I use powershell the program will compile after pressing F7, though I had to edit the commandsProvider.js file from the red extension. You can find that here: YourDrive:\VS Code Folder\data\extensions\red-auto.red-0.4.2\out

function execCommand(command, args) {
    let text = "";
    terminal = terminal ? terminal : vscode.window.createTerminal(`Red`);
    if (process.platform === 'win32') {
        text = "cmd /c Powershell "; // <--- added <Powershell>. Removed single quote <'>
    }
    text = text + "\"" + command + "\"";
    text = text + " " + args;
    if (process.platform === 'win32') {
        text = text; // <--- Removed the single quote <'>
    }

The other issue was that the command uses the -o output command and that was creating an error for me. Removing it and only allowing the -c compilation command allowed me to have some success in compiling, but now i also seem to have an error:

Compiling e:\src\Red\RedLearning\Lesson_001\main.red ...
Compiling libRedRT...
...compilation time : 2913 ms

Compiling to native code...
...compilation time : 90664 ms
...linking time     : 1164 ms
...output file size : 1253376 bytes
...output file      : E:\src\Red\RedLearning\libRedRT.dll

*** Compilation Error: undefined word input
*** in file: e:\src\Red\RedLearning\Lesson_001\main.red
*** near: [
    input
]

My code was this:

Red[]
print "Hello World"
input

For some reason now i get the error haha... I have read that for certain runtime code I need to use -e or encapsulate. I used that and it allowed me to compile without error, but when i run the .exe it then gives me a runtime error heh.

The VSCode extension works fine as much as it can, but i suppose there's a bunch of extra hoops for Windows users like us to sort out, but it's not entirely the extension's fault. I guess i'll wait for Red to be a bit more mature.

Good luck with your issue I hope you can solve it.

qtxie commented 3 years ago

I close it now. Please try to latest version.

HunterZ commented 2 years ago

This shouldn't have been closed. It's still a problem with the latest version.