sultanahamer / nvim-dap-reactnative

Standalone debug adapter protocol for react native. Hopefully won't have any specific editor/ide stuff
Other
24 stars 3 forks source link

Getting project's working directory from environment variables #3

Closed felipejoribeiro closed 1 year ago

felipejoribeiro commented 1 year ago

With this pull request, we get the project's working directory from environment variables. This is great, as this allows us to change the debugger working directory in run time.

With this change, the necessity for a ts compile command whenever we change the project is no longer required.

Interestingly enough, you can configure neovim to ask the emulator to enter in debug mode and execute the node command with the correct variable, as follows:

attachToReactNative = function()
    vim.fn.system("adb shell input keyevent 82")
    openTmuxPane(
        "export RN_DEBBUGER_WD="
            .. vim.fn.system("pwd")
            .. "; node ~/.config/nvim/local_dap/nvim-dap-reactnative/src/standalone.js"
    )
end

The behavior follows:

https://user-images.githubusercontent.com/39244876/220223374-4684a583-6350-4e85-ad6c-851b0b6b5a52.mp4

I love this setup, thanks for the great tool, i hope this can be useful for you as well.

sultanahamer commented 1 year ago

Looks great..