pytask-dev / pytask

pytask is a workflow management system that facilitates reproducible data analyses.
https://pytask-dev.readthedocs.io/en/stable
Other
113 stars 10 forks source link

ENH: vscode links in console only give relative paths #399

Open NickCrews opened 1 year ago

NickCrews commented 1 year ago

Is your feature request related to a problem?

I love how the tasks in the console are links so I can click through to the original file. But, it seems like the included path is only relative, so if I have both "users/tasks.py" and "orders/tasks.py", then the link only points to "tasks.py", and vscode isn't sure which file to use, so it gives me a dialog. I would like to avoid this dialog.

image

Describe the solution you'd like

The included path should be absolute so there is no ambiguity. I assume this would fix the dialog issue, but I'm not sure.

API breaking implications

I don't think any?

Additional context

IDK about pycharm and the file:///, but I assume they should be able to handle absolute paths as well.

I'm not sure if this is important, but I am using vscode in a workspace setup, where I have multiple git repos all getting tracked in the same workspace. So in the above screenshot it looks like vscode is getting confused between the two repos, but I bet this isn't super relevant, I think the absolute path is still the best solution. But I wanted to include this detail just in case.

tobiasraabe commented 1 year ago

I believe that the file links pytask creates are always using absolute paths. Can you show me a screenshot of the url you clicked on? Then, I can trace it back more easily.

NickCrews commented 1 year ago

OK, so the 🐍 <Module noatak/_tasks.py> link actually works and goes to the right file. It's the 📝 <Function _tasks.py::task_ascribe_donations> links that open up the dialog that I screenshotted above.

I'm not sure how to actually inspect the raw URLs in the terminal, before they are rendered as links. I tried cmd-clicking, copy-pasting, and looking around for a "show raw" option. Any tips?

image
tobiasraabe commented 1 year ago

I could replicate your problem. You are trying to click on the links within vscode, right? pytask creates a link only in the task name, the part that is underlined. But, when you hold the ALT key (on Windows, is it CMD on Mac) and hover over the task name, even the greyed-out part becomes underlined.

The problem is that vscode overlays pytask's links with its own link/file detection. And, within your vscode workspace, _tasks.py is ambiguous.

We would need to read up on what vscode is doing and whether there is a way to make it respect terminal links over its own.

tobiasraabe commented 12 months ago

Probably related to https://github.com/microsoft/vscode/issues/176812. Only normal http/https urls seem to work right now.

image

tobiasraabe commented 5 months ago

The latest vscode update should provide a fix. They enabled a lot more protocols.

Unfortunately, I cannot verify it right now since WSL2 is not supported yet and I do not have another machine around. The issue is tracked here: https://github.com/microsoft/vscode/issues/211443.