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

createing default workspace #1111

Merged
merged 7 commits into from
Apr 14, 2021
Merged

createing default workspace #1111

merged 7 commits into from
Apr 14, 2021

Conversation

LianaHus
Copy link
Collaborator

@LianaHus LianaHus commented Apr 13, 2021

fix #1028

@@ -563,8 +563,6 @@ class FileManager extends Plugin {
if (file.startsWith('browser')) {
return this._deps.filesProviders.browser
}
const provider = this._deps.filesProviders.workspace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we don't need to show that error anymore

@@ -109,6 +117,18 @@ export const Workspace = (props: WorkspaceProps) => {
}
}, [])

const createNewWorkspace = async (workspaceName) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would make sense to refactor this with onFinishCreateWorkspace because they do the same thing.

} catch (error) {
console.error(error)
else {
this._deps.fileProviders.workspace.setWorkspace(workspaceName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the else here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is changing nothing just increasing readability of the code

@@ -8,6 +9,7 @@ class WorkspaceFileProvider extends FileProvider {
super('')
this.workspacesPath = '.workspaces'
this.workspace = null
this.event = new EventManager()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using require('../../lib/events') you could also use const EventEmitter = require('events') which is the oob solution. The previous one is no longer used for new features.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not working with a change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might need to update the function, it should work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just check where it is used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can find example where it's being used there https://github.com/ethereum/remix-project/search?q=EventEmitter


createWorkspace (name) {
if (!name) name = 'default_workspace'
this.event.trigger('create_workspace', [name])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of the events are usually camel case I think createWorkspace

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

} catch (error) {
console.error(error)
else {
this._deps.fileProviders.workspace.setWorkspace(workspaceName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when no workspace is selected and a plugin try to write to remix, did you make sure the app switch to the new created workspace? cause I am not sure doing fileProviders.workspace.setWorkspace(workspaceName) is enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is selected or available?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant "selected".
I am not sure doing this._deps.fileProviders.workspace.setWorkspace(workspaceName) is the best way to handle that, but that seem to be ok for the moment

@LianaHus LianaHus merged commit 35be771 into master Apr 14, 2021
@LianaHus LianaHus deleted the workspaces branch April 14, 2021 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handle error on file/folder creation in internal/external plugins
3 participants