pytask icon indicating copy to clipboard operation
pytask copied to clipboard

ENH: vscode links in console only give relative paths

Open NickCrews opened this issue 2 years ago • 5 comments

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.

NickCrews avatar Jul 19 '23 18:07 NickCrews

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.

tobiasraabe avatar Jul 20 '23 16:07 tobiasraabe

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

NickCrews avatar Jul 22 '23 21:07 NickCrews

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 avatar Oct 05 '23 21:10 tobiasraabe

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

image

tobiasraabe avatar Oct 27 '23 07:10 tobiasraabe

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.

tobiasraabe avatar May 03 '24 20:05 tobiasraabe