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

Get the editor for a TextDocumentContentProvider provided content #10379

Closed
eamodio opened this issue Aug 10, 2016 · 6 comments
Closed

Get the editor for a TextDocumentContentProvider provided content #10379

eamodio opened this issue Aug 10, 2016 · 6 comments
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@eamodio
Copy link
Contributor

eamodio commented Aug 10, 2016

  • VSCode Version: Version 1.5.0-insider (1.5.0-insider) 13b6e6d
  • OS Version: Version 10.11.6 (15G31)

From a TextDocumentContentProvider is there any way to get access to the editor the content will be opened into?

I am trying to apply decorations to the provided content, but I haven't found a reliable (non-hack) way to get access to the opened editor. You can see my hack here

Also is there any way to control the order of "reference" in the peek ui? I'm attempting to hijack that UI to provide git blame history but I can't control the order -- so it will be very confusing :)

Thanks!

@jrieken jrieken added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Aug 10, 2016
@jrieken
Copy link
Member

jrieken commented Aug 10, 2016

From a TextDocumentContentProvider is there any way to get access to the editor the content will be opened into?

No, that's not possible and because a document can be opened outside of an editor (openTextDocument) or in multiple editors it's not the right place to add it to the provider. Most likely the active editor will change but we also have a request for an event when any of the visible editors has changed.

Also is there any way to control the order of "reference" in the peek ui? I'm attempting to hijack that UI to provide git blame history but I can't control the order -- so it will be very confusing :)

Do you implement a ReferenceProvider or do you just use the command to show the reference UI?

@jrieken jrieken closed this as completed Aug 10, 2016
@jrieken
Copy link
Member

jrieken commented Aug 10, 2016

The issue about an event when editors have changed: #643 (comment)

@eamodio
Copy link
Contributor Author

eamodio commented Aug 10, 2016

@jrieken How can I best provide text decorations for a custom document provided by my TextDocumentContentProvider?

I don't currently have a ReferenceProvider. I am triggering the command based of my code lens.

@jrieken
Copy link
Member

jrieken commented Aug 10, 2016

Being a CodeLens provider is a good approach for this. So, is that you wanna control the order of the inline reference window? How they appear on the right hand side list and what editor is shown first?

screen shot 2016-08-10 at 11 51 22

@eamodio
Copy link
Contributor Author

eamodio commented Aug 10, 2016

@jrieken Yes exactly -- the virtual doc is on the right pane of the peek, and the ordering I'm looking for is exactly what you are pointing to.

image

I was also toying with the idea of trying to get a diff view in that right pane, but I don't even know if that is possible.

@jrieken
Copy link
Member

jrieken commented Aug 11, 2016

Cool - so the sorting was definitely not designed for your use-case but I provide some internals that you can work with ;-) So the references are sorted by their uri and range. Also, the widget tries to find and reveal the nearest reference. Not really made for this use-case but you might get it to work better with that knowledge.

I guess what you really want is this: #3220. It's currently not planned but it is likely to happen

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants