napi-rs / website

Website for napi.rs
https://napi.rs
MIT License
21 stars 38 forks source link

Feedback for “A simple package” #233

Open Elysian10 opened 4 days ago

Elysian10 commented 4 days ago

I really have a hard time debugging the rust code with vs code. Its very difficult to find info about how to attatch my debugger to rust libraries that is used by node.js. Yarn build appears to make a project.so in the release folder. Is that what I need to debug my rust? I wish there was more information.

Elysian10 commented 4 days ago

It took me the whole day to figure out how to debug rust in napi-rs. I finally got it to work. Here is the vs code configuration. It requires the CodeLLDB extention.

{ "type": "lldb", "request": "launch", "sourceLanguages": ["rust"], "name": "Rust", "program": "node", "args": ["${workspaceFolder}/test.mjs"], "preLaunchTask": "build:debug", "cwd": "${workspaceFolder}" }

    oh, it runs a task. vs code will ask you to create one.

    {
"version": "2.0.0",
"tasks": [
    {
        "type": "shell",
        "command":"napi build --platform",
        "label": "build:debug"
    }
]

}

Other scripts of interests are in package.json. I assume they all run as a shell type. "yarn": "yarn build" might also be handy to add to package.json scripts in rare scenarios.