Reputation: 13
Q: Are there ways to change the functionality of the file-explorer in the Visual Code editor?
Detail: I'd like to implement a typical folder structure where you can only ever see the contents of one folder at a time (much like regular folder-navigation in Windows). So the "root" in the file-explorer in Visual Code would always be the current folder navigated to.
Upvotes: 0
Views: 268
Reputation: 9222
Keep in mind that "can" does not always mean "should", but I believe you "can" accomplish this to a degree. Instead of changing the built in file explorer, though, you'd have to contribute your own "explorer" extension by following the docs. You specify that you are contributing an explorer in your extension's package.json
as so:
"contributes": {
"views": {
"explorer": [
{
"id": "myfileexplorer",
"name": "My File Explorer",
"when": ""
}
]
}
}
You then implement the TreeDataProvider interface in your extension.
The process is too involved to describe in a comment here, but you can see sample code here.
Upvotes: 1