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

Adopt vscode.open or vscode.diff in built-in extensions #110497

Closed
4 tasks done
bpasero opened this issue Nov 12, 2020 · 13 comments
Closed
4 tasks done

Adopt vscode.open or vscode.diff in built-in extensions #110497

bpasero opened this issue Nov 12, 2020 · 13 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan tree-views Extension tree view issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Nov 12, 2020

With #85636 landed, it is now recommended that an extension sets the TreeItem command to vscode.open or vscode.diff if the resource is know upfront.

Example from ref view:

https://github.com/microsoft/vscode-references-view/blob/730800271aa5ef52b1c49608d68f14ee585f7821/src/calls/model.ts#L176-L186

List of extensions with custom views we ship:

Git support is tracked in #110397 and timeline in #110496

//cc @isidorn @weinand not sure if debug has custom views where we should support this as well?

@isidorn
Copy link
Contributor

isidorn commented Nov 12, 2020

Debug had loaded scripts view, but it is now in the vscode core. So we should be covered there.

@connor4312 connor4312 removed their assignment Nov 12, 2020
@connor4312
Copy link
Member

connor4312 commented Nov 12, 2020

We have some views in debug land but don't open sources from them.

@alexr00
Copy link
Member

alexr00 commented Nov 13, 2020

NPM involves opening package.json files and finding specific scripts in them. Adopting vscode.open there should wait until #110498

@alexr00 alexr00 added feature-request Request for new features or functionality tasks Task system issues labels Nov 13, 2020
@alexr00 alexr00 added this to the On Deck milestone Nov 13, 2020
@bpasero
Copy link
Member Author

bpasero commented Nov 13, 2020

@alexr00 can you clarify? at the time I have expanded the NPM tree to see scripts, we should have already resolved everything, no?

@alexr00
Copy link
Member

alexr00 commented Nov 13, 2020

The view uses fetchTasks to populate the tree view, which gives no information about where in the package.json file the task is coming from. The code can always be refactored to not do this, but it isn't just a simple adoption then.

@alexr00
Copy link
Member

alexr00 commented Nov 13, 2020

It probably should be refactored that way since it will be more efficient then.

@bpasero
Copy link
Member Author

bpasero commented Nov 13, 2020

After a quick check, I think the only blocker is this code:

let document: TextDocument = await workspace.openTextDocument(uri);

If the position was known upfront, this could be changed from:

'open': {
title: 'Edit Script',
command: 'npm.openScript',
arguments: [this]
},

to something like:

'open': {
	title: 'Edit Script',
	command: 'vscode.open',
	arguments: [uri, selection]
}

@alexr00
Copy link
Member

alexr00 commented Nov 13, 2020

That is correct. I don't want to go and open every package.json multiple times up front, so the extension will need to be refactored to determine the line number up front.

@alexr00 alexr00 modified the milestones: On Deck, November 2020 Nov 13, 2020
alexr00 added a commit that referenced this issue Nov 13, 2020
@alexr00 alexr00 closed this as completed Nov 13, 2020
meganrogge pushed a commit that referenced this issue Nov 18, 2020
@alexr00
Copy link
Member

alexr00 commented Nov 30, 2020

@connor4312 and @jrieken FYI I have made a test plan item for NPM scripts, but we will still need test items for the other extensions.

@alexr00 alexr00 assigned jrieken and unassigned alexr00 Nov 30, 2020
@alexr00 alexr00 added tree-views Extension tree view issues and removed tasks Task system issues labels Nov 30, 2020
@jrieken
Copy link
Member

jrieken commented Nov 30, 2020

I have a verificated-needed item for this

@bpasero
Copy link
Member Author

bpasero commented Nov 30, 2020

I had this for my #111417 already spelled out, but having individual issues for each extension makes more sense to me:

image

Maybe I leave my thing in for SCM at least (@joaomoreno fyi)

@joaomoreno
Copy link
Member

@bpasero I have this for Git/SCM: #111519

@bpasero
Copy link
Member Author

bpasero commented Nov 30, 2020

Ok good then I will simply remove that part from my test plan item, thanks for covering it in other issues 👍

@github-actions github-actions bot locked and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests

7 participants