oleg-shilo / cs-script.vscode

VSCode extension for CS-Script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

script debugging not working anymore

psrivastava opened this issue · comments

seems related to recent commit "- Added tunneling StartDebug request when workspace is loaded"

Now, trying ctrl+F5 just launches the .NET Core debugger and not Mono cs-script debugger anymore.
If I run the script with no .vscode folder, it prompts to create one & still wont start a mono based csscript debugger.

The change in that commit is simple. Previously the F5 press was completely ignored by the extension. Bu now if there is a folder loaded the plugin raises the request for debugging with the first available configuration.

const launchFile = vscode.workspace.getConfiguration("launch");
const configs = launchFile.get<any[]>("configurations");
vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], configs[0]);

I guess that may be in your environment the first debug config is the .NET Core one. I will make the tunneling controlled via the settions. In a mean time you can simply remove or remap cs-script.debug to something else. Thus way VSCode standard startDebug will be handled the usual way.

Presence of .vscode is actually irrelevant.

When no folder loaded (NO FOLDER OPENED) there should be no changes as the code has not changed at all. And the mono debugger is actually hard-codded. Can you please do the test:

  1. Close the folder (Win: Ctrl+K, Ctrl+F)
  2. Create new script: image
    3.a. Run script without debugger:
    image
    3.b. Run script with debugger:
    image
    This is what I expect you to see:
    image

Let me know the outcome.

Note that your key binding are different to mine so I prefer you to use command or buttons.

Thank you

This is working Oleg.
My issue is specific to folder open. I have a top level .netcore project to turn on intellisense.
Then I just use cs-script to individually run the scripts.

a week or two ago, even in this scenario, mono-debug would start using the cs-script debug option, all by itself.
Now, like you said, only launch configs[0] is invoked, which is true, I have .NET core.

but note, I don't have any cs-script lunch settings in my json either.

btw, I got something going for myself by manually adding a 'cs-script' launch settings in my launch.json & making it first entry in the list.

{ "name": "CS-Script (console)", "type": "mono", "request": "launch", "program": "${env:APPDATA}/Code/User/cs-script.user/cscs.exe", "args": ["-d", "-inmem:0", "-co:/debug:pdbonly", "-ac:2", "${file}"], "cwd": "${fileDirname}", "console": "internalConsole" }

Yes it is one of the possible solutions.

Another one is to use coderunner extension

"code-runner.executorMap": {
    "csharp": "%CSSCRIPT_DIR%/cscs -noconfig -nl"...
  },

I will prepare a hotfix release to allow disabling tunneling and allowing (optionally) starting debugging cs-script with a workspace loaded.

I do prefer disabling debugging the workspaces as it creates certain ambiguity. But I have no problems with users enabling it when they choose to.

Done. The new release v1.5.2 has the behavior you want by default. Any variation to it is done via user custom settings file.