Skip to content

Commit

Permalink
Don't try creating untitled files in a refactoring
Browse files Browse the repository at this point in the history
Fixes #75132
  • Loading branch information
mjbvz committed Jun 10, 2019
1 parent 69940c9 commit a1c33c6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { VersionDependentRegistration } from '../utils/dependentRegistration';
import TelemetryReporter from '../utils/telemetry';
import * as typeConverters from '../utils/typeConverters';
import FormattingOptionsManager from './fileConfigurationManager';
import { file } from '../utils/fileSchemes';

const localize = nls.loadMessageBundle();

Expand Down Expand Up @@ -79,7 +80,10 @@ class ApplyRefactoringCommand implements Command {
private async toWorkspaceEdit(body: Proto.RefactorEditInfo) {
const workspaceEdit = new vscode.WorkspaceEdit();
for (const edit of body.edits) {
workspaceEdit.createFile(this.client.toResource(edit.fileName), { ignoreIfExists: true });
const resource = this.client.toResource(edit.fileName);
if (resource.scheme === file) {
workspaceEdit.createFile(resource, { ignoreIfExists: true });
}
}
typeConverters.WorkspaceEdit.withFileCodeEdits(workspaceEdit, this.client, body.edits);
return workspaceEdit;
Expand Down

0 comments on commit a1c33c6

Please sign in to comment.