-
Notifications
You must be signed in to change notification settings - Fork 27.9k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -426,14 +426,14 @@ export abstract class AbstractTextFileService extends Disposable implements ITex | |
} | ||
} | ||
|
||
// Revert the source if result is success | ||
if (success) { | ||
await this.revert(source); | ||
|
||
return target; | ||
if (!success) { | ||
return undefined; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bpasero
Author
Member
|
||
} | ||
|
||
return undefined; | ||
// Revert the source | ||
await this.revert(source); | ||
|
||
return target; | ||
} | ||
|
||
private async doSaveAsTextFile(sourceModel: IResolvedTextEditorModel | ITextModel, source: URI, target: URI, options?: ITextFileSaveOptions): Promise<boolean> { | ||
|
5 comments
on commit 42a43eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to properly return false
, you should return false
. While I do not see any need to properly return false
, the commit summary does not reflect what happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what is the issue? Maybe best if you showcase it in a PR with a suggested fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what is the issue? Maybe best if you showcase it in a PR with a suggested fix?
There is no issue, just a trifle: the commit summary does not match the commit. I would say:
TextFileService.save
: return valueundefined
on failure
That would be easier to find in changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree. The actual behaviour change are these two:
42a43eb#diff-013267b5ed968fe933b3c450853a4492a20babb59f1ce1a77cb76fe3d6cb1818R714
and
42a43eb#diff-0dc06494259be4c5123e46208d2f359c93e85ad6ab409a515482f34123a40e1aR767
Previously they would always return true
even if the save failed and the working copy was dirty. Now we probe on the saved state.
The other changes are more or less an adoption of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK then
TextFileService.save
: return whether document saved
just
return;
would be enough