8000 "vscode ." command always opens notebook folder · Issue #898 · winpython/winpython · GitHub
[go: up one dir, main page]

Skip to content

"vscode ." command always opens notebook folder #898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yilmazdurmaz opened this issue Nov 1, 2020 · 9 comments
Closed

"vscode ." command always opens notebook folder #898

yilmazdurmaz opened this issue Nov 1, 2020 · 9 comments

Comments

@yilmazdurmaz
Copy link
yilmazdurmaz commented Nov 1, 2020

hey there,

I am used to use vscode as portable and it is just a path among my environment variables. I also use Total Commander as the file explorer, and run vscode simply by typing "code ." in any directory. other times I open a command prompt anywhere, browse through folders with old good console commands and then again use "code ." to start editing.

today I am trying to work with python, and to be honest I dont like installing things system wide, thus the portables. I renamed "VS Code.exe" to "vscode.exe" to write without spaces, but this dot problem I met is annoying.

whenever I type "vscode .", it uses notebooks folder in WinPython directory. "vscode %cd%" works but it is tiresome to both remember and write.

I dont know how popular vscode is with WinPython, but I am hoping you would fix this behaviour to open current directory.

version: WPy64-3830

@stonebig
Copy link
Contributor
stonebig commented Nov 7, 2020

No idea on this one.

The icon is calling "\WPy64-3830\scripts\winvscode.bat".
Can you try to make your dream work by playing with "\WPy64-3830\scripts\winvscode.bat ." ?

@stonebig
Copy link
Contributor
stonebig commented Nov 7, 2020

in fact, there is a solution:

change "\WPy64-3830\scripts\winvscode.bat"

@echo off
rem launcher for VScode
call "%~dp0env_for_icons.bat"
rem cd/D "%WINPYWORKDIR%"
if exist "%WINPYDIR%\..\t\vscode\code.exe" (
    "%WINPYDIR%\..\t\vscode\code.exe" %*
) else (
if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe" (
    "%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe"  %*
) else (
    "code.exe" %*
))

that is modify one line:

rem cd/D "%WINPYWORKDIR%"

instead of

cd/D "%WINPYWORKDIR%"

@stonebig
Copy link
Contributor
stonebig commented Nov 7, 2020

you may have to call the "winvscode.bat" directly, so maybe create a copy with a shorter name, like "vsc.bat"

@yilmazdurmaz
Copy link
Author

I guess you mean exe files are interfacing to run these scripts. that is nice.

but this rem ... thing didn't changed it. still opening the scripts directory

@stonebig
Copy link
Contributor
stonebig commented Nov 7, 2020

as I said, you must call the ".bat" directly: "\WPy64-3830\scripts\winvscode.bat ."
but nothing forbid you to copy it, and rename the copy to something small ("vsc.bat") and type "vsc .",

the icons have been volontary stripped down to just call "noshell.vbs" with the batch as parameter. to make the logic as "hackable" as you want. but I think your "." context is lost forever in this process. so you may simply shortcut directly to the "winvscode.bat".

@yilmazdurmaz
Copy link
Author

again my bad, I forgot the terminal in the 3760's scripts folder. it was running its script :P

using the batch file directly starts nicely.

but unlike my assumption "VS Code.exe" does not directly execute this batch file, so the problem half solved

@yilmazdurmaz
Copy link
Author

@stonebig
I have just noticed that with the edit you gave, "VS Code.exe" now opens "WPy64-3830\scripts" folder instead of "WPy64-3830\notebooks". just a guess but it may just be ignoring parameters used when it starts.

@yilmazdurmaz
Copy link
Author

I copied&edited the content to fit my need. It uses batch file to open other portable VS Code I use with the portability of winpython added. It closes console used to run the script by the use of "start" command. it does fine for now until the time I forgot I had this file edited :P

@echo off
rem launcher for VScode
call "%~dp0env_for_icons.bat"
start t:\Tools\VSCode-win32-x64\code.exe %*

though it would be better to have winpython's vscode executable accept parameters.

@stonebig
Copy link
Contributor
stonebig commented Nov 8, 2020

I'll remove "cd/D "%WINPYWORKDIR%" from next release so you can drop your file or directory on the "VS Code .exe" icon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
2A4D
0