profelis / daScript-plugin

daScript language support
https://marketplace.visualstudio.com/items?itemName=profelis.dascript-plugin
MIT License
9 stars 4 forks source link

How to use this plugin? #7

Closed zhmt closed 1 year ago

zhmt commented 1 year ago

I failed to figure out how to configure project files, and how to run das script. Will you please upload a sample vs code project?

zhmt commented 1 year ago

hi_main.das

// require daslib/media
// options debugger            // uncomment for debug in VS Code
// require daslib/debug        // uncomment for debug in VS Code

[export]
def main
    print("hi..............\n")

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "dascript",
            "request": "launch",
            "name": "daScript: launch",
            "program": "${config:dascript.compiler} ${file}",
            // "cwd": "${fileDirname}",
            "connectTimeout": 4,
            "console": "internalTerminal"
        }
    ]
}

output:

EConnRefused.

> D:\prog\dascript\daScript\bin\daScript.exe extension-output-profelis.dascript-plugin-#7-daScript debug output -- --das-debug-port 10899 --das-wait-debugger

da: Something wrong with debug session, maybe wasn't started debug session
Try to inject debugger explicitly, add these 2 lines in the main module
options debugger
require daslib/debug

Or increase launch configuration option: "connectTimeout"
"configurations": [
{
    "type": "dascript",
    "connectTimeout": 4
}
profelis commented 1 year ago

here https://github.com/profelis/daScript-plugin/tree/lsp/samples/hello_world is smallest simple project.

btw, require daslib/debug and etc are optional currently and default dascript compiler automatically add this options, just press debug from vscode.

Also was added daScript: profiler launch config, it's just in initial state, but you can try it. Result perf.json file can be opened with Google Chrome profiler

Tests sample will be added later, I have some work with this.

profelis commented 1 year ago

just added tests sample https://github.com/profelis/daScript-plugin/commit/e4ff463a3a2892657755d4f47a3f908edb500b7f

but this commit requires this PR https://github.com/GaijinEntertainment/daScript/pull/375 to be merged firstly

zhmt commented 1 year ago

Nice, Thanks.