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

Creating an untitled paw draw file will not open the paw draw editor #100238

Closed
rchiodo opened this issue Jun 15, 2020 · 7 comments
Closed

Creating an untitled paw draw file will not open the paw draw editor #100238

rchiodo opened this issue Jun 15, 2020 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) verified Verification succeeded
Milestone

Comments

@rchiodo
Copy link
Contributor

rchiodo commented Jun 15, 2020

  • VSCode Version: Version: 1.47.0-insider (user setup)
  • OS Version: Windows_NT x64 10.0.19041

Steps to Reproduce:

  1. Modify the custom-editor-sample to have a 'create new pawdraw' file.
  2. Change extension.ts to have code like so:
import * as vscode from 'vscode';
import * as path from 'path';
import * as os from 'os';
import { CatScratchEditorProvider } from './catScratchEditor';
import { PawDrawEditorProvider } from './pawDrawEditor';

export function activate(context: vscode.ExtensionContext) {
	// Register our custom editor providers
	context.subscriptions.push(CatScratchEditorProvider.register(context));

	if (+vscode.version.match(/1\.(\d+)/)![1] >= 45) {
		context.subscriptions.push(PawDrawEditorProvider.register(context));
	}

	vscode.commands.registerCommand('catCustoms.createnew', newPawDraw);
}

function newPawDraw() {
	const file = path.join(os.tmpdir(), 'test-1.pawdraw');
	const uri = vscode.Uri.file(file);
	const untitled = uri.with({ scheme: 'untitled', path: uri.fsPath });
	vscode.commands.executeCommand('vscode.openWith', untitled, 'catCustoms.pawDraw' );
}
  1. Modify the package.json to support the new 'catCustoms.pawDraw' command:
"commands": [
            {
                "command": "catCustoms.createnew",
				"title": "Create new Paw Draw",
				"category": "Paw Draw"
            }
		],
  1. Run the extension
  2. Attempt to run the command
  3. This comes up instead of the paw draw editor:

image

Does this issue occur when all extensions are disabled?: N/A

Note this might be related to:
#93441

@rchiodo rchiodo changed the title Creating Creating an untitled paw draw file will not open the paw draw editor Jun 15, 2020
@mjbvz mjbvz added this to the June 2020 milestone Jun 20, 2020
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) labels Jun 30, 2020
@mjbvz mjbvz closed this as completed in bbaabb5 Jun 30, 2020
mjbvz added a commit that referenced this issue Jul 1, 2020
For #100238. The data for this parameter already exists on options
@rebornix rebornix added verified Verification succeeded and removed verified Verification succeeded labels Jul 2, 2020
@rebornix
Copy link
Member

rebornix commented Jul 2, 2020

I am seeing exceptions after running this command

Unable to open 'test-1.pawdraw': No file system provider found for resource 'untitled:/var/folders/j7/py1_06vs0y3bbcdpsn0pd66h0000gn/T/test-1.pawdraw'.

I'm wondering if we should always recommend creating untitled file by #98992 (comment)

@rebornix rebornix added the verification-found Issue verification failed label Jul 2, 2020
@connor4312
Copy link
Member

reopening due to -found tag

@connor4312 connor4312 reopened this Jul 6, 2020
@mjbvz mjbvz modified the milestones: June 2020, July 2020 Jul 7, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Jul 23, 2020

Should be fixed by cf0094f

@mjbvz mjbvz closed this as completed Jul 23, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Jul 23, 2020

Actually never mind, that was for a different issue.

I think the bug here is that the example extension does not handle untitled files properly. The root problem is that we try using the vscode.fs with an untitled: uri, which is not supported. That limitation probably makes sense considering how fs works, but makes handling untitled custom editors more difficult

@mjbvz mjbvz reopened this Jul 23, 2020
@connor4312 connor4312 added verified Verification succeeded and removed verification-found Issue verification failed labels Aug 6, 2020
@rchiodo
Copy link
Contributor Author

rchiodo commented Aug 7, 2020

Creating a new file works, but you can't close it.

When I attempt to close the file this happens:

image

@rchiodo
Copy link
Contributor Author

rchiodo commented Aug 7, 2020

@mjbvz is this a known limitation or should I open a separate bug? You kinda made it sound like untitled files just aren't supported.

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 7, 2020

A separate issue would be best. We haven't focused on support for untitled files, in part be because we're still seeing how people use custom editors. We also need proper apis for creating untitled files in the first place

@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2020
Nic30 pushed a commit to Nic30/vscode-extension-digitalcircuitanalysis that referenced this issue Jan 11, 2023
Fixes microsoft/vscode#100238

This is not well supported at the moment since we need some new APIs for working with untitled custom editors, how the current example shows how it can be implemented
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug custom-editors Custom editor API (webview based editors) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@rebornix @connor4312 @mjbvz @rchiodo and others