red / VScode-extension

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

Error switching to project folder #6

Closed OxeStone closed 7 years ago

OxeStone commented 7 years ago

When I run a script, PowerShell issues the following error:

PS D:> cd ":\Projects\Programming\Red" cd : Cannot find path 'D:\:\Projects\Programming\Red' because it does not exist. At line:1 char:1 cd ":\Projects\Programming\Red"

This happens even when I manually switch to the 'D' drive in the internal PowerShell.

geekyi commented 7 years ago

Not a bug, you have a syntax error in your code:

PS D:> cd "D:\Projects\Programming\Red"

Or it works for me, can you provide more details? Maybe updating vscode would help? I also use latest red binaries. Probably wrong in the settings too.

ghost commented 7 years ago

On a fresh installation of vscode and this extension, I also have this issue. On pressing F6 (builddir is empty), I get this -

C:\Users\USER>cd ":\Users\USER\Desktop"
The filename, directory name, or volume label syntax is incorrect.

C:\Users\USER>C:/Dev/red.bat --cli c:\Users\USER\Desktop\test.red

(Though the code still runs, because full path is passed to the 2nd command )

OxeStone commented 7 years ago

geekyi: you say I have a syntax error in my code: PS D:> cd "D:\Projects\Programming\Red" That command is issued by the VSCode extension. However, if I manually switch to that directory, then yes, the script executes without any errors. For some reason the 'cd' command drops the drive letter from the full path.

geekyi commented 7 years ago

@nc-x, @OxeStone silly me! I should've checked my settings to confirm before I replied. What do you have in settings? (Ctrl+,) I have something like:

{
    "red.redPath": "C:/Users/XX/red-07jun17-dcc13d8.exe",
}

Also: image

OxeStone commented 7 years ago
vscode about vscode settings
geekyi commented 7 years ago

@OxeStone possibly, changing the backslashes to forward slashes might help in redPath and buildDir (nope, still works for me with \\) Also, since it still happens with an empty buildDir for @nc-x.. Can you try to switch to / and remove the buildDir if no problem? Sorry, just ruling everything out (and download latest red.exe to a portable folder) I probably need to check with vscode 1.13 I'm pretty sure this is a vscode error, but just in case, latest build for me works:

>> system/build
== make object! [
    date: "15-Jun-2017/2:49:29+5:00"
geekyi commented 7 years ago

@OxeStone can't still reproduce with 1.13.1 (I have the portable version btw) image

Can you toggle developer tools and check? Things like Value of redSettings.redConsolePath:

[Extension Host] ---------------------------
 cwd: 
 C:\Users\XX\.vscode\extensions\red-auto.red-0.2.1\redFiles
 ---------------------------
 child_process.spawn in redProxy
 Value of redSettings.redConsolePath is : C:\ProgramData\Red\console-2017-6-14-59021.exe
 ---------------------------
 cwd: 
 C:\Users\XX\.vscode\extensions\red-auto.red-0.2.1\redFiles
 ---------------------------
 child_process.spawn in redProxy
 Value of redSettings.redConsolePath is : C:\ProgramData\Red\console-2017-6-14-59021.exe
ghost commented 7 years ago

Changing https://github.com/red/VScode-extension/blob/f4198c27d87a5309a13b43becceaca8f99910e65/src/providers/commandsProvider.ts#L104 to

buildDir = path.dirname(filePath);

fixes the issue for me.

ghost commented 7 years ago

This issue occurs if you have used "Open File" for opening the file.

If you have opened the folder as well, then this issue does not occur. Maybe, that was what you were doing @geekyi ?

geekyi commented 7 years ago

@nc-x precisely. I always organize in projects 😝

ghost commented 7 years ago

Well, I am not that hygienic :rofl: