Skip to content

Commit

Permalink
fix(sidebar/#2084): Don't show sidebar if no folder is open (#2711)
Browse files Browse the repository at this point in the history
__Issue:__ The first-run experience on some platforms isn't ideal - the explorer can take long to load, or in the case of MacOS, ask the user for permission to their documents folder - not a great first-time experience!

__Defect:__ If no folder was opened, we'd try and default to the user's documents folder - but this isn't really ideal for the above reasons.

__Fix:__ Create a 'no-workspace-opened' state, and don't show the sidebar in that case. Once a folder is explicitly specified, or we have one from persistence, then we can go ahead and show it. In addition, for the file explorer, add an empty experience (an open folder button) if the user opens the sidebar.

Fixes #2084 

__TODO:__
- [x] Update the extension host integration - if there is no workspace, we shouldn't call `$initializeWorkspace` with the initial directory.
- [x] Clean up the empty experience 
  - [x] Add descriptive text
  - [x] Center button
- [x] Wire up the 'open-folder' gesture to initiate an effect to open the native file dialog
  - [x] Verify on OSX
  - [x] Verify on Linux
  - [x] Verify on Windows - needs Win32 implementation of file picker (revery-ui/revery#1021)
  - [x] Use revery `master` once validated everywhere
- [x] Ensure 'open folder' button is available via keyboard
- [x] Command+P behavior when no workspace is open
  - [x] Just show active buffers
  • Loading branch information
bryphe authored Nov 24, 2020
1 parent 9d46d41 commit e61ffa6
Show file tree
Hide file tree
Showing 69 changed files with 1,154 additions and 722 deletions.
106 changes: 53 additions & 53 deletions bench.esy.lock/index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bench/lib/Helpers.re
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let simpleState = {
~extensionGlobalPersistence=Feature_Extensions.Persistence.initial,
~extensionWorkspacePersistence=Feature_Extensions.Persistence.initial,
~contributedCommands=[],
~maybeWorkspace=None,
~workingDirectory=Sys.getcwd(),
~extensionsFolder=None,
~licenseKeyPersistence=None,
Expand Down
48 changes: 25 additions & 23 deletions development_extensions/oni-dev-extension/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,36 +290,38 @@ function activate(context) {
}),
)

function createResourceUri(relativePath) {
const absolutePath = path.join(vscode.workspace.rootPath, relativePath)
return vscode.Uri.file(absolutePath)
}
if (vscode.workspace.rootPath) {
function createResourceUri(relativePath) {
const absolutePath = path.join(vscode.workspace.rootPath, relativePath)
return vscode.Uri.file(absolutePath)
}

// Test SCM
// Test SCM

const testSCM = vscode.scm.createSourceControl("test", "Test")
const testSCM = vscode.scm.createSourceControl("test", "Test")

const index = testSCM.createResourceGroup("index", "Index")
index.resourceStates = [
{ resourceUri: createResourceUri("README.md") },
{ resourceUri: createResourceUri("src/test/api.ts") },
]
const index = testSCM.createResourceGroup("index", "Index")
index.resourceStates = [
{ resourceUri: createResourceUri("README.md") },
{ resourceUri: createResourceUri("src/test/api.ts") },
]

const workingTree = testSCM.createResourceGroup("workingTree", "Changes")
workingTree.resourceStates = [
{ resourceUri: createResourceUri(".travis.yml") },
{ resourceUri: createResourceUri("README.md") },
]
const workingTree = testSCM.createResourceGroup("workingTree", "Changes")
workingTree.resourceStates = [
{ resourceUri: createResourceUri(".travis.yml") },
{ resourceUri: createResourceUri("README.md") },
]

testSCM.count = 13
testSCM.count = 13

testSCM.quickDiffProvider = {
provideOriginalResource: (uri, _token) => {
return vscode.Uri.file("README.md.old")
},
}
testSCM.quickDiffProvider = {
provideOriginalResource: (uri, _token) => {
return vscode.Uri.file("README.md.old")
},
}

testSCM.dispose()
testSCM.dispose()
};

// Text Document Content Provider

Expand Down
Loading

0 comments on commit e61ffa6

Please sign in to comment.