Fixes #4741 allow creation of sub-files and/or sub-folders if name has "/"#4764
Fixes #4741 allow creation of sub-files and/or sub-folders if name has "/"#4764benoitf merged 1 commit intoeclipse-theia:masterfrom
Conversation
| const childUri = new URI(parent.uri).resolve(name).toString(); | ||
| this.fileSystem.exists(childUri).then(exists => { | ||
| if (exists && dialog) { | ||
| dialog.error(`A file or folder <strong>${fileName}</strong> already exists at this location.`); |
There was a problem hiding this comment.
We should change a type of validation function to MaybPromise<DialogError> to allow async validation. Inside the dialog we will need to make sure that concurrent validation does not occur, i.e. queue them or cancel.
|
I wonder can we override |
|
It does not work if i create the same path twice from the root, it seems to pick the wrong parent then which is very confusing. Not sure whether it is a new bug or something which was not apparent before. In order to reprdoce with Theia repo:
I would expect an error, but there are non and the second file is created at the bogus location: |
This is because of inconsistent selection bug when creating a new file. Sometimes the new file gets selected on creation (which is what it is supposed to do) and sometimes it doesn't. I've patched this on the latest commit. |
|
|
||
| protected async getFileStat(): Promise<FileStat | undefined> { | ||
| if (!this.fileSystem.exists(this.uriString)) { | ||
| if (!await this.fileSystem.exists(this.uriString)) { |
There was a problem hiding this comment.
how it used to work! ❤️ for fixing it!
akosyakov
left a comment
There was a problem hiding this comment.
It works nicely now, but there are some code clean up necessary to avoid breaking code org and race conditions.
This allow creation of files and folders recursive path. improve validation check, add cancellationtoken separate validation for absolutpath and leading/trailing spaces Signed-off-by: Uni Sayo <unibtc@gmail.com>
|
i've separated the validation checks for absolute paths and leading and trailing spaces as per suggested. Squashed commits. |
Fixes #4741. Creation of sub-files and/or sub-folders are already available,however, validation check does not allow
/on the input box, making it impossible to create nested sub-folders and/or sub-files.This PR allows recursive creation of folders or files via
/./Example:
test/scripts/index.jswill create test andtest/scriptsfolder if it still does not exists and lastly it creates the filetest/scripts/index.jsSigned-off-by: Uni Sayo unibtc@gmail.com