提交 df2cdb1a 编写于 作者: A Andre Weinand

call createInitialConfigurations command with root folder

上级 93dd7be4
......@@ -349,8 +349,15 @@ export class ConfigurationManager implements IConfigurationManager {
const resource = this.configFileUri;
let configFileCreated = false;
// temporary workaround: the folderUri should be an argument to openConfigFile
let folderUri: uri = undefined;
const workspace = this.contextService.getWorkspace();
if (workspace && workspace.roots.length > 0) {
folderUri = workspace.roots[0];
}
return this.fileService.resolveContent(resource).then(content => true, err =>
this.guessAdapter(type).then(adapter => adapter ? adapter.getInitialConfigurationContent() : undefined)
this.guessAdapter(type).then(adapter => adapter ? adapter.getInitialConfigurationContent(folderUri) : undefined)
.then(content => {
if (!content) {
return false;
......
......@@ -6,6 +6,7 @@
import fs = require('fs');
import path = require('path');
import * as nls from 'vs/nls';
import uri from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import * as strings from 'vs/base/common/strings';
import * as objects from 'vs/base/common/objects';
......@@ -139,12 +140,12 @@ export class Adapter {
return !!this.rawAdapter.initialConfigurations;
}
public getInitialConfigurationContent(): TPromise<string> {
public getInitialConfigurationContent(folderUri: uri): TPromise<string> {
const editorConfig = this.configurationService.getConfiguration<any>();
if (typeof this.rawAdapter.initialConfigurations === 'string') {
// Contributed initialConfigurations is a command that needs to be invoked
// Debug adapter will dynamically provide the full launch.json
return this.commandService.executeCommand<string>(<string>this.rawAdapter.initialConfigurations).then(content => {
return this.commandService.executeCommand<string>(<string>this.rawAdapter.initialConfigurations, folderUri).then(content => {
// Debug adapter returned the full content of the launch.json - return it after format
if (editorConfig.editor.insertSpaces) {
content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册