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

Custom editor for TextDocumentContentProvider content #100612

Closed
davidanthoff opened this issue Jun 19, 2020 · 4 comments
Closed

Custom editor for TextDocumentContentProvider content #100612

davidanthoff opened this issue Jun 19, 2020 · 4 comments
Assignees
Labels
custom-editors Custom editor API (webview based editors) feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Milestone

Comments

@davidanthoff
Copy link
Contributor

I'm trying to integrate the awesome new custom editor (or rather viewer) for profile results that ships with the new JS debugger with the Julia extension.

Here is how I generally imagine that: we have a Julia REPL process where users can run some code in the profiler. We then provide a function that sends the profile results to the extension itself, and the extension displays the profile results using the fancy new profile results viewer. I don't want to write a .cpuprofile file, though. So what I'm trying right now is to add a custom TextDocumentContentProvider provider to our extension that exposes the profiler results as a virtual document. That part works well, but I can't get the custom editor that displays .cpuprofile files to also display the virtual documents I'm providing.

The uri I'm creating for a profile result is const uri = vscode.Uri.parse('juliavsodeprofilerresults:' + new_uuid.toString() + '.cpuprofile'). I would have thought that the .cpuprofile would then automatically trigger the custom editor jsProfileVisualizer.cpuprofile.table that is defined in here, but that doesn't seem to be the case.

Is this scenario generally not supported? Or is this just a bug and it should in theory work? It would make for a very nice and smooth integration for the Julia extension!

CC @connor4312

@connor4312
Copy link
Member

connor4312 commented Jun 19, 2020

Related: #93441 I wanted to do the a similar thing for js-debug (open the profile as untitled and let the user save it if they want to) and ran into the same issue 😛

@mjbvz mjbvz added the custom-editors Custom editor API (webview based editors) label Jun 20, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 20, 2020

@davidanthoff Can you share the extension code for what you've tried so far?

@davidanthoff
Copy link
Contributor Author

@mjbvz, sure, the PR is julia-vscode/julia-vscode#1378. Just ignore the Julia side of things :)

@mjbvz mjbvz added this to the October 2020 milestone Oct 20, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Oct 20, 2020

I'm going to close this as by-design. Our fs apis do not work with virtual text documents created by TextDocumentContentProvider, which really limits what you can do.

The TextDocumentContentProvider api was designed for showing text content to the user in an editor. If you want to show virtual documents using custom editors, try using a custom file system provider instead. These can be used with custom editors

@mjbvz mjbvz closed this as completed Oct 20, 2020
@mjbvz mjbvz added *out-of-scope Posted issue is not in scope of VS Code feature-request Request for new features or functionality labels Oct 20, 2020
@mjbvz mjbvz modified the milestones: October 2020, Backlog Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
custom-editors Custom editor API (webview based editors) feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

3 participants