Fixes typescript compile error

This commit is contained in:
Eric Amodio 2016-09-09 21:34:40 -04:00
Родитель 716f2f5df6
Коммит 8b8dba6b5e
1 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -11,7 +11,7 @@ import * as vscode from 'vscode';
import * as tasks from 'vscode-tasks'; import * as tasks from 'vscode-tasks';
import {OmnisharpServer} from './omnisharp/server'; import {OmnisharpServer} from './omnisharp/server';
import * as serverUtils from './omnisharp/utils'; import * as serverUtils from './omnisharp/utils';
import * as protocol from './omnisharp/protocol.ts' import * as protocol from './omnisharp/protocol'
interface DebugConfiguration { interface DebugConfiguration {
name: string, name: string,
@ -60,7 +60,7 @@ interface Paths {
function getPaths(): Paths { function getPaths(): Paths {
const vscodeFolder = path.join(vscode.workspace.rootPath, '.vscode'); const vscodeFolder = path.join(vscode.workspace.rootPath, '.vscode');
return { return {
vscodeFolder: vscodeFolder, vscodeFolder: vscodeFolder,
tasksJsonPath: path.join(vscodeFolder, 'tasks.json'), tasksJsonPath: path.join(vscodeFolder, 'tasks.json'),
@ -83,7 +83,7 @@ function hasOperations(operations: Operations) {
function getOperations() { function getOperations() {
const paths = getPaths(); const paths = getPaths();
return getBuildOperations(paths.tasksJsonPath).then(operations => return getBuildOperations(paths.tasksJsonPath).then(operations =>
getLaunchOperations(paths.launchJsonPath, operations)); getLaunchOperations(paths.launchJsonPath, operations));
} }
@ -95,7 +95,7 @@ function getBuildOperations(tasksJsonPath: string) {
const text = buffer.toString(); const text = buffer.toString();
const tasksJson: tasks.TaskConfiguration = JSON.parse(text); const tasksJson: tasks.TaskConfiguration = JSON.parse(text);
const buildTask = tasksJson.tasks.find(td => td.taskName === 'build'); const buildTask = tasksJson.tasks.find(td => td.taskName === 'build');
resolve({ updateTasksJson: (buildTask === undefined) }); resolve({ updateTasksJson: (buildTask === undefined) });
}); });
} }
@ -123,7 +123,7 @@ function getLaunchOperations(launchJsonPath: string, operations: Operations) {
function promptToAddAssets() { function promptToAddAssets() {
return new Promise<boolean>((resolve, reject) => { return new Promise<boolean>((resolve, reject) => {
const item = { title: 'Yes' } const item = { title: 'Yes' }
vscode.window.showInformationMessage('Required assets to build and debug are missing from your project. Add them?', item).then(selection => { vscode.window.showInformationMessage('Required assets to build and debug are missing from your project. Add them?', item).then(selection => {
return selection return selection
? resolve(true) ? resolve(true)
@ -139,7 +139,7 @@ function computeProgramPath(projectData: TargetProjectData) {
} }
let result = '${workspaceRoot}'; let result = '${workspaceRoot}';
if (projectData.projectPath) { if (projectData.projectPath) {
result = path.join(result, path.relative(vscode.workspace.rootPath, projectData.projectPath.fsPath)); result = path.join(result, path.relative(vscode.workspace.rootPath, projectData.projectPath.fsPath));
} }
@ -258,10 +258,10 @@ function addTasksJsonIfNecessary(projectData: TargetProjectData, paths: Paths, o
if (!operations.addTasksJson) { if (!operations.addTasksJson) {
return resolve(); return resolve();
} }
const tasksJson = createTasksConfiguration(projectData); const tasksJson = createTasksConfiguration(projectData);
const tasksJsonText = JSON.stringify(tasksJson, null, ' '); const tasksJsonText = JSON.stringify(tasksJson, null, ' ');
return fs.writeFileAsync(paths.tasksJsonPath, tasksJsonText); return fs.writeFileAsync(paths.tasksJsonPath, tasksJsonText);
}); });
} }
@ -341,13 +341,13 @@ function hasWebServerDependency(targetProjectData: TargetProjectData): boolean {
if (projectJsonObject == null) { if (projectJsonObject == null) {
return false; return false;
} }
for (var key in projectJsonObject.dependencies) { for (var key in projectJsonObject.dependencies) {
if (key.toLowerCase().startsWith("microsoft.aspnetcore.server")) { if (key.toLowerCase().startsWith("microsoft.aspnetcore.server")) {
return true; return true;
} }
} }
return false; return false;
} }
@ -360,7 +360,7 @@ function addLaunchJsonIfNecessary(projectData: TargetProjectData, paths: Paths,
const isWebProject = hasWebServerDependency(projectData); const isWebProject = hasWebServerDependency(projectData);
const launchJson = createLaunchJson(projectData, isWebProject); const launchJson = createLaunchJson(projectData, isWebProject);
const launchJsonText = JSON.stringify(launchJson, null, ' '); const launchJsonText = JSON.stringify(launchJson, null, ' ');
return fs.writeFileAsync(paths.launchJsonPath, launchJsonText); return fs.writeFileAsync(paths.launchJsonPath, launchJsonText);
}); });
} }
@ -369,7 +369,7 @@ export function addAssetsIfNecessary(server: OmnisharpServer) {
if (!vscode.workspace.rootPath) { if (!vscode.workspace.rootPath) {
return; return;
} }
return serverUtils.requestWorkspaceInformation(server).then(info => { return serverUtils.requestWorkspaceInformation(server).then(info => {
// If there are no .NET Core projects, we won't bother offering to add assets. // If there are no .NET Core projects, we won't bother offering to add assets.
if ('DotNet' in info && info.DotNet.Projects.length > 0) { if ('DotNet' in info && info.DotNet.Projects.length > 0) {
@ -377,15 +377,15 @@ export function addAssetsIfNecessary(server: OmnisharpServer) {
if (!hasOperations(operations)) { if (!hasOperations(operations)) {
return; return;
} }
promptToAddAssets().then(addAssets => { promptToAddAssets().then(addAssets => {
if (!addAssets) { if (!addAssets) {
return; return;
} }
const data = findTargetProjectData(info.DotNet.Projects); const data = findTargetProjectData(info.DotNet.Projects);
const paths = getPaths(); const paths = getPaths();
return fs.ensureDirAsync(paths.vscodeFolder).then(() => { return fs.ensureDirAsync(paths.vscodeFolder).then(() => {
return Promise.all([ return Promise.all([
addTasksJsonIfNecessary(data, paths, operations), addTasksJsonIfNecessary(data, paths, operations),