VSCodium, not possible to run both Dart and JS in terminal

30 Views Asked by At

So I have this config rn in my launch.json file:

"launch": {




       "version": "0.2.0",
       "configurations": [
        {
            "name": "Launch Program",
            "program": "${JS}/app.js",
            "request": "launch",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        },
      {
            "name": "Dart",
            "request": "launch",
            "type": "dart",
            "program": "${file}",
            "console": "terminal"
        }
        
    ]

    }

It is probably wrong but I already tried hundreds of different settings (in JS config as above, Dart works just fine ) and none of them work. Main problem is that no matter what after hitting 'RUN' codium tries to run .js file using .dart debuger(? - newbie here not sure if this is what that thing is called) here's terminal log:

~/Desktop/DEVSTUFF/JS/Tutorials&shit$  cd /home/elbarto/Desktop/DEVSTUFF/JS/Tutorials\&shit ; /usr/lib/dart/bin/dart --disable-dart-dev --enable-asserts /home/elbarto/Desktop/DEVSTUFF/JS/Tutorials\&shit/app.js 
../../../Desktop/DEVSTUFF/JS/Tutorials&shit/app.js:7:1: Error: A function declaration needs an explicit list of parameters.
Try adding a parameter list to the function declaration.
console.log("why am I not working FFS!");
^^^^^^^

.... and so on. So and basically I have no clue how to set this back to JS debugger, when I manually go ( to the terminal within vscodium ) to the folder with js file and type node app.js it works, but it won't while hitting 'run' button, which is pretty annoying. Pls help I spent like 2 days on it already and it drives me crazy, thanks!

    

1

There are 1 best solutions below

0
Ejdzbikej On

Okay so immediately after posting here I seem to found an answer, or at least one I am sorta happy with. Firstly I changed launch.json JS config to:

{
            "name": "Node: Current File",
            "type": "node",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }

Secondly, previously I would open VSC and immediately go to File -> Open File ( CTRL + O ) to - you guessed it - open a file, and depending on the file type ( dart or js ) after hitting "RUN" the appropriate debugger would open, and due to some reason if you opened second file ( say first was dart and second js ) also without opening a folder ( where these files sit in ) first the debugger would not switch to the language of that opened file, and that was all there was to it lmao. THE SOLUTION is to simply open a folder containing required file (File -> Open Folder ) and now depending on the language those files were written in, appropriate debugger starts once 'RUN' is pressed. Idk maybe I am an idiot and the whole stuff is obvious for you all, but it took me liek 2 days to solve it and I'm proud and happy I did, and maybe someone else will come across it in future:) Peace