Command line args for VSCode
The command line args did not work on my setup (code.exe not on PATH, reuse-window option). Here's my modification:
--- a/DGVisualStudioCodeIntegration.pas
+++ b/DGVisualStudioCodeIntegration.pas
@@ -130,12 +131,11 @@ begin
if not SaveAllModules then
exit;
- var cmdline:string;
- if sourceInfos.Line < 0 then
- cmdline := Format('cmd /c "code --reuse-window %s"', [ProjectPath])
- else
- cmdline := Format('cmd /c "code --reuse-window %s -g %s:%d:%d"', [ProjectPath, FileName, sourceInfos.Line, sourceInfos.Column]);
-
+ var cmdline: string;
+ if sourceInfos.Line < 0 then
+ cmdline := Format('"%s" -r "%s"', ['C:\Program Files\Microsoft VS Code\Code.exe', FileName])
+ else
+ cmdline := Format('"%s" -r -g "%s":%d:%d', ['C:\Program Files\Microsoft VS Code\Code.exe', FileName, sourceInfos.Line, sourceInfos.Column]);
var executor := TOSCommandLineExecutor.Create(nil);
try
Well, this is odd, because on my pc the "code" command not only is not located in the "program files" folder, but it is not even an exe file:
C:\Users\Carlo>where code C:\Users\Carlo\AppData\Local\Programs\Microsoft VS Code\bin\code C:\Users\Carlo\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd
it is a shell script
I did install visual studio code by using the microsoft store.
There also is the option to install VSCode (Code.exe) in the user-specific folder. Might be an idea to have the file path configurable in asettings dialog instead of hard-coded.