Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to a file position in Output Channel #586

Open
seanmcbreen opened this issue Nov 24, 2015 · 29 comments
Open

Link to a file position in Output Channel #586

seanmcbreen opened this issue Nov 24, 2015 · 29 comments
Labels
feature-request Request for new features or functionality output Output channel system issues
Milestone

Comments

@seanmcbreen
Copy link

From @ArtemGovorov on October 19, 2015 2:0

As mentioned in this issue, output channel supports link rendering. I'd like to append a link to a workspace file position (by providing a file name, line and column in some form). If it's already possible, could you please paste an example on how to do it?

Copied from original issue: Microsoft/vscode-extensionbuilders#41

@seanmcbreen
Copy link
Author

From @bpasero on October 19, 2015 6:15

You should be able to link to a file line and column with the syntax <path>:<line>:<column>.

@seanmcbreen
Copy link
Author

From @ArtemGovorov on October 19, 2015 6:36

Thanks, I have been trying the syntax, didn't work for me with a relative path. Only works with a full path.

Is it possible to make it work with paths relative to the opened project/folder?

Also, is it possible to supply a custom text, but still render it as a file position link?

@seanmcbreen
Copy link
Author

From @bpasero on October 19, 2015 7:5

I see. We have a limited set of default patterns that we use to match against the output to show links. Currently relative paths are not in there.

@dbaeumer can also comment maybe. I think it is possible to contribute patterns from a task to control links in the output, but I might be wrong?

@seanmcbreen
Copy link
Author

From @dbaeumer on November 16, 2015 10:34

@bpasero: no the task framework doesn't contribute any link patterns. There is no API to do so.

@farfromrefug
Copy link

Is there any news on this?
I really need this. I would be ok writing an extension to handle this. But we would need an API to interact with the output.

@bpasero
Copy link
Member

bpasero commented Aug 20, 2016

Thanks so much for your interest in this issue! It is currently assigned to the backlog. Every month we pick items from the backlog to plan for the current iteration. Please see https://github.com/Microsoft/vscode/wiki/Issue-Tracking#planning for more information.

Since we are a small team of developers, there is only so many feature requests and issues we can work on for one milestone. Nevertheless we always welcome pull requests and are happy to accept them if they meet our quality standards.

@TurkeyMan
Copy link

TurkeyMan commented Sep 19, 2016

How is this not maximum priority? O_0
And how is it that there isn't a sea of complaints here... there must be some workaround that people are using?

@ArtemGovorov
Copy link
Contributor

We are using the vscode.languages.registerDocumentLinkProvider for this. Like this:

vscode.languages.registerDocumentLinkProvider({language: 'wallaby-output'}, {
        provideDocumentLinks: doc => {
          ...
        }
});

where the wallaby-output is our output channel language name, but for now unfortunately we have to apply it for all output channels (using "text/x-code-output" mimetype):

"contributes": {
    ...
    "languages": [
      {
        "id": "wallaby-output",
        "mimetypes": [
          "text/x-code-output"
        ]
      }
    ],
    ...
  },

Once this feature request is implemented, and specifying a language for an output channel is allowed, one could simply add any custom link provider to custom output channels.

@ChuckJonas
Copy link

Links don't seem to work for me even when I format them <path>:<line>:<column> with abs path

Example:
/Users/jonas/Documents/mm/Project/src/classes/MyClass.ts:9:1

@garethlewin
Copy link

Could we consider this to be taken out of the backlog please?

The different golang tools create relative paths, for example

./server_test.go:45: undefined: newServer

wayou added a commit to wayou/vscode-todo-highlight that referenced this issue Mar 1, 2017
@wayou
Copy link

wayou commented Mar 2, 2017

I find out that on Unix <path>:<line>:<column> this pattern works while on Windows is <path>#<line>

@frankcai
Copy link

+1

@linw1995
Copy link

linw1995 commented Apr 6, 2017

Can apply the same on the debug and terminal? manipulate the output

@andy-wood
Copy link

There are many extensions currently using the path#line format, and this appears to be broken across the board on Mac right now.
vscode_error

@felocru
Copy link

felocru commented Aug 3, 2017

I'm on linux, apparently the pattern <file>#<line> works.
Version:
VS: 1.14.2
Shell: 1.6.6
Node 7.4.0

So I had to put:
todohighlight.toggleURI to true

@dostrog
Copy link

dostrog commented Oct 19, 2017

On MAC. There is an error

screen shot 2017-10-19 at 10 33 40

@sarbash
Copy link

sarbash commented Nov 13, 2017

I have the same trouble on Linux with the latest code version (1.18.0)
As in the home as in the work.
As on Debian as on Ubuntu.
Links in the output panel of "TODO Parser" plugin don't work.
I've switched from path:file:line:char to path#file#line#char forth and back with no success.
default

@bpasero bpasero added output Output channel system issues and removed workbench labels Nov 16, 2017
@Apoorva-GA
Copy link

If the file path has a space in the file name. VSCode treats link only until the space is found. Is there a way to get around this problem?

How to handle links in output channel with space in the filename?

@AustinW4t1qbit
Copy link

Are there working workarounds for this right now for OSX?

@AndreasLuckert
Copy link

Even though this issue has been closed already, I didn't get how to implement what'd been said under
#586 (comment) in order to achieve the desired output:

Where do I have to insert "::" (in combination with "Callstack.itemToString()" ??) that the vs-code console shows me something like
"~/path/script.py in project_variable_return(..), line 66" I can jump directly to via Ctrl + Left-click, instead of having (in my case the default) output where only the file is clickable, but not the line mentioned in the error output:
~/path/script.py in project_variable_return(..)
64 blabla = "bla"
65 if not os.path.exists(blabla):
---> 66 os.mkdir(blabla)

Thanks in advance for stating more clearly how (or WHERE) to implement "::".

@zcfh
Copy link

zcfh commented Jan 12, 2021

image
Is this problem still unresolved?
Is there any special treatment for this first path? It can be opened, but the following can not click.
I run channel.appendLine('/Users/zcfh/myTest/vscode_test/xmake-vscode/src/terminal.ts: error'), output can not click.
image

Running cmake-tool through code can use cmd + click in the output panel.Did the cmake-tool extension do any special operations?
image

@zcfh
Copy link

zcfh commented Jan 12, 2021

image
Is this problem still unresolved?
Is there any special treatment for this first path? It can be opened, but the following can not click.
I run channel.appendLine('/Users/zcfh/myTest/vscode_test/xmake-vscode/src/terminal.ts: error'), output can not click.
image

Running cmake-tool through code can use cmd + click in the output panel.Did the cmake-tool extension do any special operations?
image

I may find the reason, because I needed to provide highlighting for the output pannel before, so I customized tmlanguage. But I still don’t know how to solve this problem.

@zcfh
Copy link

zcfh commented Jan 12, 2021

image
Is this problem still unresolved?
Is there any special treatment for this first path? It can be opened, but the following can not click.
I run channel.appendLine('/Users/zcfh/myTest/vscode_test/xmake-vscode/src/terminal.ts: error'), output can not click.
image
Running cmake-tool through code can use cmd + click in the output panel.Did the cmake-tool extension do any special operations?
image

I may find the reason, because I needed to provide highlighting for the output pannel before, so I customized tmlanguage. But I still don’t know how to solve this problem.
pakcage.json

  "languages": [
      {
          "id": "output-test",
          "mimetypes": [
              "text/x-code-output"
          ],
          "configuration": "./language-configuration.json"
      }
  ],
  "grammars": [
      {
          "language": "output-test",
          "scopeName": "source.text",
          "path": "./syntaxes/output-test.tmLanguage.json"
      }
  ],
{
    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
    "name": "Output-test",
    "patterns": [],
    "scopeName": "source.text"
}

After deleting mimetypes, the absolute path of the file in the workspace can be clicked.
image

Can I use cmd+click path while customizing output highlighting?

@johandanforth
Copy link

Regards to dotnet build and OmniSharp, ctrl+click on an error doesn't work if path contains spaces.

@smm-h
Copy link

smm-h commented Apr 12, 2021

Currently three things could be improved about this:

  1. Making relative to workspace paths also clickable and not just absolute ones.
  2. Making paths with spaces in them clickable.
  3. Allowing custom text to act as clickable.

@Toxicable
Copy link

I'm sure this had previously been working well when you have a TypeScript output like

some/file.ts:72:35 - error TS2322

However, something recently changed and now when ctrl + clicking a link like that takes me to the top of the file and not the line number

@starball5
Copy link

starball5 commented Feb 10, 2023

@gg569
Copy link

gg569 commented Dec 15, 2024

From @ArtemGovorov on October 19, 2015 2:0

As mentioned in this issue, output channel supports link rendering. I'd like to append a link to a workspace file position (by providing a file name, line and column in some form). If it's already possible, could you please paste an example on how to do it?

Copied from original issue: Microsoft/vscode-extensionbuilders#41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality output Output channel system issues
Projects
None yet
Development

No branches or pull requests