launch.json and tasks.json pin only if config file is created

#8727
This commit is contained in:
isidor
2016-07-05 15:35:26 +02:00
parent 5da820a3b5
commit 79bdfd4a2d
2 changed files with 11 additions and 5 deletions
@@ -337,6 +337,7 @@ export class ConfigurationManager implements debug.IConfigurationManager {
public openConfigFile(sideBySide: boolean): TPromise<boolean> {
const resource = uri.file(paths.join(this.contextService.getWorkspace().resource.fsPath, '/.vscode/launch.json'));
let configFileCreated = false;
return this.fileService.resolveContent(resource).then(content => true, err =>
this.getInitialConfigFileContent().then(content => {
@@ -344,10 +345,11 @@ export class ConfigurationManager implements debug.IConfigurationManager {
return false;
}
configFileCreated = true;
return this.fileService.updateContent(resource, content).then(() => true);
}
)).then(configFileCreated => {
if (!configFileCreated) {
)).then(errorFree => {
if (!errorFree) {
return false;
}
this.telemetryService.publicLog('debugConfigure');
@@ -355,8 +357,9 @@ export class ConfigurationManager implements debug.IConfigurationManager {
return this.editorService.openEditor({
resource: resource,
options: {
forceOpen: true
}
forceOpen: true,
pinned: configFileCreated // pin only if config file is created #8727
},
}, sideBySide).then(() => true);
}, (error) => {
throw new Error(nls.localize('DebugConfig.failed', "Unable to create 'launch.json' file inside the '.vscode' folder ({0}).", error));
@@ -202,6 +202,7 @@ class ConfigureTaskRunnerAction extends Action {
return TPromise.as(undefined);
}
let sideBySide = !!(event && (event.ctrlKey || event.metaKey));
let configFileCreated = false;
return this.fileService.resolveFile(this.contextService.toResource('.vscode/tasks.json')).then((success) => {
return success;
}, (err:any) => {
@@ -247,6 +248,7 @@ class ConfigureTaskRunnerAction extends Action {
if (editorConfig.editor.insertSpaces) {
content = content.replace(/(\n)(\t+)/g, (_, s1, s2) => s1 + strings.repeat(' ', s2.length * editorConfig.editor.tabSize));
}
configFileCreated = true;
return this.fileService.createFile(this.contextService.toResource('.vscode/tasks.json'), content);
});
});
@@ -258,7 +260,8 @@ class ConfigureTaskRunnerAction extends Action {
return this.editorService.openEditor({
resource: stat.resource,
options: {
forceOpen: true
forceOpen: true,
pinned: configFileCreated // pin only if config file is created #8727
}
}, sideBySide);
}, (error) => {