Open isidorn opened 7 years ago
@sandy081 I'm just trying to step through this code to understand why my links aren't being detected, but I'm really confused by this code:
while (match !== null) {
let resource: uri = null;
if (!resource) {
match = pattern.exec(text);
continue;
}
As far as I can tell, the rest of the code in this block will never execute - resource
is always initialised as null then the if statement continue
s?
In fact, it looks like maybe the minifier stripped all the code out because of that?
@isidorn Is anyone able to review the comments above? Am I misreading the code or is this a bug that means this will never work? :(
@DanTup yes this seems like a clear bug on our end. Would you be interested in providing a PR which fixes this. This was initialy done by our previous internt @michelkaporin
@isidorn I haven't contributed any real code before, do I need to (and if so, are there instructions on how to) run Code from source? (I checked contributing.md but it doesn't seem to cover it). Also, are there automated tests around this sort of functionality I could extend?
@DanTup https://github.com/Microsoft/vscode/wiki/How-to-Contribute We do not have tests around link detection unfortunetly, so you would have to manually test it out
@gregvanl our contributing.md should have a pointer to our wiki how to contribute page imho
I did have this on my list to try and look at, but I never gotten around to it. I think it's unlikely to happen anytime soon so it may be better for someone else to look at.
(I do a lot of people would benefit in fixing - many issues have been closed as dupes of this, though is in the backlog marked as debt, when the above is really a bug).
@isidorn Coming back to this, I noticed fixing the detection won't work for us, as our links have been rewritten as URIs, like:
flutter: #0 _GalleryAppState.build (package:flutter_gallery/gallery/app.dart:131:5)
flutter: #1 StatefulElement.build (package:flutter/src/widgets/framework.dart:3809:27)
Was there any progress on allowing extensions to contribute rules for link detection? (I couldn't find anything)
No porgress here
I just made a Pull Request that brings this feature back (#65929). I'm curious to hear your thoughts, @isidorn.
FWIW, while setting up a repro using the mock debugger today, I noticed that OutputEvents can be given source locations (it didn't show in the completion until I cast it like new OutputEvent(
${message}\n, category) as OutputEvent & DebugProtocol.OutputEvent
.
So, I realised I could regex my paths out of the call stacks and just attach them to each line this way.
Before (no links):
After (links):
As an advantage, this allows mapping the package:
URIs to the correct source file, and also allows truncating the visible file path if desired to take up less space.
@isidorn This issue was also used to track making it possible for extensions to add additional regex's (see your comment at the end of https://github.com/Microsoft/vscode/pull/30882). Is that now possible, or should I open a new issue?
@gregg-miskelly let's reopen this issue. We have cleaned up some link detection however it is still not perfect obviously.
Extension host protocol does also break
Would love to get a link detection API I can use internally for hover/completion when doing plaintext handling in completion / hover: https://github.com/microsoft/vscode/issues/79841
Please fix this for GDB under msys2.
I've noticed that link detection is inconsistent between debug console and terminal. So for example "http://example.com/abcd(efgh)"
will be detected as a link in both, but the final )
will be (correctly) detected as being part of the link in the terminal but not in the debug console. Is this the same issue as this one or should I open a new one?
Not sure if this is entirely related, but I have a watch task compiling my TypeScript code in the background. When it errors, it produces an output like so:
main.ts:14:11 - error TS2551: Property 'losg' does not exist on type 'Console'. Did you mean 'log'?
14 console.losg(`${p_data.name} => ${p_data.json ? JSON.stringify(p_data.json) : p_data.interval}`);
It would be ideal to be able to left click on that main.ts:14:11
string to get me to that line, similar to the debug window functionality.
As a work-around I can ctrl-click on that string, which seems to copy that text to the search field in the main editor, after which I can press enter, to get me to the correct file/line. That's workable, but obviously not as quick as a single click.
Case moved here from #135770
For this Python stacktrace snippet the integrated terminal correctly detects the link including the line 99
.
On the internal console it only detects the file path but not the line information which is quite annoying.
File "/Users/levrik/code/project/api/context.py", line 99, in __init__
self.document_service = DocumentService(
I am running into the same issue as @levrik. Clicking on a Python stacktrace takes me to the top of the file (not the line of code) when using internal console. MacOS Monterey VScode Version: 1.66.0
Any consideration to fix this? Thanks
I notice that the link detection has changed in release 1.75.0 - and from my point of view the changes have made it worse. I frequently have links that look like https://example.com/path(abc,def)
, and previously this link would be correctly detected in the terminal (but not in the debug console, where the final )
would be omitted)... but now in the terminal the link is wrongly terminated before the ,
.
Terminal link detection is not related to this, please file a separate issue @jribbens
@roblourens What is this ticket about then? If it's about the debug console link detection, then my comment from April 2021 still stands - given a URL like https://example.com/path(abc,def)
the debug console omits the close bracket from the link.
It's about the debug console, but if I understand your comment correctly, you are saying that something in the terminal regressed?
The debug console behaves the same as it has for a long time, in that for URLs of the form I mentioned (which I use a lot), it fails to include the final )
. Obviously "URL guessing" can never be perfect, but I expected VSCode's debug tab to get it right, because VSCode's terminal tab got it right. The recent regression is that the terminal tab now gets it even wronger than the debug tab, and terminates the URL at the ,
. So previously one tab got it right and one got it wrong, now they both get it wrong, but in different ways ;-)
Yes, sharing link detection implementation would also be a good thing for us to get to. It would be helpful to file an issue for the terminal regression so that we can fix that.
@roblourens Ok I've opened a separate issue #174009
FWIW, while setting up a repro using the mock debugger today, I noticed that OutputEvents can be given source locations (it didn't show in the completion until I cast it like
new OutputEvent(
${message}\n, category) as OutputEvent & DebugProtocol.OutputEvent
.So, I realised I could regex my paths out of the call stacks and just attach them to each line this way.
Before (no links):
After (links):
As an advantage, this allows mapping the
package:
URIs to the correct source file, and also allows truncating the visible file path if desired to take up less space.
@DanTup I also face this problem, but I didn't understand how you did. Could you please guide it in some detail? Many thanks
@ngduchuan are you an extension author, or a Flutter user? If an extension author, you need to set the source
field on your OutputEvent
s. If you're a Flutter user and not seeing these links, please ensure you're on the latest version of Flutter and if you're not seeing links you'd expect, please file an issue at https://github.com/Dart-Code/Dart-Code.
I still have issues with link detection (and specifically Ctrl Clicking the link) in vscode as well. For instance vscode does seem to detect the following link, and I'm able to Ctrl click it
TypeError: fetch failed
at fetch (C:\git\myproject\node_modules\undici\index.js:115:13)
But when prefixed with file:///
, the link is recognized, but I'm not able to Ctrl click it:
at async apiCall (file:///C:/git/myproject/src/lib/api.js:284:19)
Any thoughts?
But when prefixed with file:///, the link is recognized, but I'm not able to Ctrl click it:
at async apiCall (file:///C:/git/myproject/src/lib/api.js:284:19)
This is probably related to https://github.com/microsoft/vscode/issues/150702. VS Code doesn't handle file:///
URIs that have line/col on the end using colons. The argument is that the colons could be part of the filename. Personally I think it's the wrong call given how many languages are outputting links in this format.
Yes, especially since the first one (on the call stack) has a "correct" url, but ends up deep in the nodejs library. The actual link that would make sense for me to focus on would be the second one. And that one cannot be clicked. Not ideal 😉
Have there been changes around this? In the latest release notes I see:
File protocol URIs (file://) now support line and column number extensions at the end, like most other links. The new #
format is also supported.
But I can't find any issue or PR related to this. I'm specifically interested in what "line and column number extensions" mean. Is file:///foo:1:2
finally supported, or is this meant to be a description of https://github.com/microsoft/vscode/issues/193384 (which is not about file URIs, but file paths ending with ranges)?
In the release notes, that is specifically for the terminal. No progress in the debug console, unfortunately.
@roblourens do you know where the Issue/PR for the change that was made is? I'm just about the specifics of it because I'd opened some issues like https://github.com/microsoft/vscode/issues/150702 (which I think might be a terminal now?) with issues in this area, but it's not clear if this fix helps (the suggestion was that colons on a file:///
URI are not allowed because they're valid as part of a filename, and I'm wondering if this stance has changed).
Also consider a way for extensions to contribute link detection rules