refactor(python): make mason optional during dap-python setup - #1565
Conversation
Review ChecklistDoes this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist: Proper conventional commit scoping:
|
Uzaaft
left a comment
There was a problem hiding this comment.
Took a quick look and something seems wrong/sketchy with this pr. I'll take a second look later.
Perhaps explaining my setup will help you understand this PR. Right now I’m running everything on nix, and all the binaries neovim needs (LSPs, formatters, etc.) are managed via nixpkgs, and I have disabled all mason related plugins in The debugpy‐adapter part might be a bit tricky, but I think calling |
|
That makes sense. Your implementation didnt imo. Im too busy atm to take a second look so Im gonna let this be open for now. |
Uzaaft
left a comment
There was a problem hiding this comment.
Went over this PR. This is what I noted down:
- Confusing fallback chain:
First you check for debygpy-adapter, and then fall back to python. But then it appears that you potentially overwrite this with the Mason path, which seems to make the initial check pointless. - Inconsistent path handling:
The path variable seems to be used for different things. First the executable name, then a directory path, then a full path to a python executable in a venv. - Unclear precedence: If both debugpy-adapter exists AND Mason has debugpy installed, which should take priority? The current code seems prefers Mason.
- Missing final path construction: When using Mason, it sets path to the venv Python, but dap-python likely needs the path to include -m
debugpy.adapter.
The logic should probably be:
- Check if Mason has debugpy installed → use it
- Else check for system debugpy-adapter → use it
- Else fall back to python -m debugpy.adapter
it is intended, cuz i think mason users are majority and we should keep them unaffected from the change (always use the one from mason if user have it installed via mason), result is the same, but yeah your logic is way clearer
it can take a path to
so the old approach is fine, or you want to change it to append |
- Change Python debugger adapter path to first check for `debugpy-adapter` before falling back to `python` - Only attempt to get `debugpy` package if Mason registry is available Signed-off-by: Sped0n <hi@sped0n.com>
|
@Uzaaft, would you mind reviewing the latest force-pushed commit and let me know if it meets your requirements? for me using a function with a early return seems to be the only way to escape from indentation hell, fell free to correct me if you have better idea on this |
5f6a4c3 to
365051d
Compare
|
@Sped0n I cleaned this up a bit and removed the necessity for the local function to save on computation time. Let me know if this works and I can go ahead and merge this! |
|
Actually I think we can clean this up quite a bit. Let me push another commit that should just clean this up completely |
|
Okay, this should be very clean and succinct now and not reliant on Mason, but will use it if it is available since Mason would install a |
yeah it works, thanks for the following up! |
📑 Description
debugpyinstallation, so we first check fordebugpy-adapterbefore falling back topythondebugpypackage if Mason registry is available (since mason is optional and user might disable it)ℹ Additional Information
N/A