diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 48e341a0..00000000 --- a/package-lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lockfileVersion": 1 -} diff --git a/src/papyrus-lang-vscode/package.json b/src/papyrus-lang-vscode/package.json index 023c4088..1e600b9c 100644 --- a/src/papyrus-lang-vscode/package.json +++ b/src/papyrus-lang-vscode/package.json @@ -3,7 +3,8 @@ "onLanguage:papyrus", "onLanguage:papyrus-project", "workspaceContains:**/*.psc", - "workspaceContains:**/*.ppj" + "workspaceContains:**/*.ppj", + "onCommand:workbench.action.tasks.runTask" ], "author": { "email": "joelday@gmail.com", @@ -17,186 +18,6 @@ "Programming Languages" ], "contributes": { - "taskDefinitions": [ - { - "type": "papyrus", - "properties": { - "papyrus": { - "properties": { - "game": { - "enum": [ - "fallout4", - "skyrim", - "skyrimSpecialEdition" - ], - "description": "Which compiler to use." - }, - "imports": { - "type": "array", - "items": [ - { - "type": "string" - } - ], - "uniqueItems": true, - "description": "The compiler's import directories." - }, - "flags": { - "type": "string", - "description": "The file to use for user-defined flags." - }, - "optimize": { - "type": "boolean", - "description": "Turns on optimization of scripts." - }, - "emitCompiledScripts": { - "type": "boolean", - "description": "Generate compiled script (.pex) files." - }, - "emitAssemblyFiles": { - "type": "boolean", - "description": "Generate assembly (.pas) files." - }, - "debugOutput": { - "type": "boolean", - "description": "Turns on compiler debugging, outputting dev information to the screen." - }, - "output": { - "type": "string", - "description": "The compiler's output directory." - } - }, - "anyOf": [ - { - "properties": { - "game": { - "enum": [ - "fallout4" - ] - }, - "final": { - "type": "boolean", - "default": false, - "description": "Turns on final-mode processing, removing beta code from the script." - }, - "release": { - "type": "boolean", - "default": false, - "description": "Turns on release-mode processing, removing debug code from the script." - } - }, - "anyOf": [ - { - "properties": { - "project": { - "type": "string", - "description": "A Papyrus project file (.ppj) to use for compilation." - } - }, - "required": [ - "project" - ] - }, - { - "properties": { - "scripts": { - "oneOf": [ - { - "properties": { - "folder": { - "type": "string" - }, - "noRecurse": { - "type": "boolean", - "default": false, - "description": "Tells the compiler not to recurse into subdirectories." - } - }, - "required": [ - "folder" - ], - "additionalProperties": false - }, - { - "properties": { - "file": { - "type": "string" - } - }, - "required": [ - "file" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "scripts" - ] - } - ] - }, - { - "properties": { - "game": { - "enum": [ - "skyrim", - "skyrimSpecialEdition" - ] - }, - "scripts": { - "oneOf": [ - { - "properties": { - "folder": { - "type": "string" - } - }, - "required": [ - "folder" - ], - "additionalProperties": false - }, - { - "properties": { - "file": { - "type": "string" - } - }, - "required": [ - "file" - ], - "additionalProperties": false - } - ] - } - }, - "required": [ - "scripts" - ], - "not": { - "properties": { - "project": { - "type": "string" - } - }, - "required": [ - "project" - ] - } - } - ], - "required": [ - "game" - ] - } - }, - "required": [ - "papyrus" - ] - } - ], "configuration": { "properties": { "papyrus.fallout4.enabled": { diff --git a/src/papyrus-lang-vscode/src/PapyrusExtension.ts b/src/papyrus-lang-vscode/src/PapyrusExtension.ts index bf9a0c96..3f411670 100644 --- a/src/papyrus-lang-vscode/src/PapyrusExtension.ts +++ b/src/papyrus-lang-vscode/src/PapyrusExtension.ts @@ -6,7 +6,7 @@ import { LanguageClientManager, ILanguageClientManager } from './server/Language import { LanguageServiceStatusItems } from './features/LanguageServiceStatusItems'; import { LanguageConfigurations } from './features/LanguageConfigurations'; import { getInstance } from './common/Ioc'; -import { CompilerTaskProvider } from './features/CompilerTaskProvider'; +// import { CompilerTaskProvider } from './features/CompilerTaskProvider'; import { ICreationKitInfoProvider, CreationKitInfoProvider } from './CreationKitInfoProvider'; import { ScriptStatusCodeLensProvider } from './features/ScriptStatusCodeLensProvider'; @@ -17,7 +17,7 @@ class PapyrusExtension implements Disposable { private readonly _clientManager: ILanguageClientManager; private readonly _statusItems: LanguageServiceStatusItems; private readonly _languageConfigurations: LanguageConfigurations; - private readonly _taskProvider: CompilerTaskProvider; + // private readonly _taskProvider: CompilerTaskProvider; private readonly _scriptStatusCodeLensProvider: ScriptStatusCodeLensProvider; constructor(context: ExtensionContext) { @@ -36,13 +36,13 @@ class PapyrusExtension implements Disposable { this._clientManager = getInstance(this._serviceCollection, ILanguageClientManager); this._statusItems = this._instantiationService.createInstance(LanguageServiceStatusItems); - this._taskProvider = this._instantiationService.createInstance(CompilerTaskProvider); + // this._taskProvider = this._instantiationService.createInstance(CompilerTaskProvider); this._scriptStatusCodeLensProvider = this._instantiationService.createInstance(ScriptStatusCodeLensProvider); } dispose() { this._scriptStatusCodeLensProvider.dispose(); - this._taskProvider.dispose(); + // this._taskProvider.dispose(); this._statusItems.dispose(); this._clientManager.dispose(); this._configProvider.dispose(); diff --git a/src/papyrus-lang-vscode/src/Utilities.ts b/src/papyrus-lang-vscode/src/Utilities.ts index 7570838e..7fe1efb9 100644 --- a/src/papyrus-lang-vscode/src/Utilities.ts +++ b/src/papyrus-lang-vscode/src/Utilities.ts @@ -38,3 +38,7 @@ export async function resolveInstallPath(game: PapyrusGame, installPath: string) return null; } + +export function getDefaultFlagsFileNameForGame(game: PapyrusGame) { + return game === PapyrusGame.fallout4 ? 'Institute_Papyrus_Flags.flg' : 'TESV_Papyrus_Flags.flg'; +} diff --git a/src/papyrus-lang-vscode/src/bak/PapyrusCompiler.ts b/src/papyrus-lang-vscode/src/bak/PapyrusCompiler.ts deleted file mode 100644 index 652ea410..00000000 --- a/src/papyrus-lang-vscode/src/bak/PapyrusCompiler.ts +++ /dev/null @@ -1,293 +0,0 @@ -// import * as vscode from 'vscode'; -// import * as path from 'path'; -// import * as fs from 'fs'; - -// import { spawn } from 'child_process'; -// import { PapyrusConfig } from './PapyrusConfig'; - -// export class PapyrusCompiler { -// private RootPath: string; -// private OutputPath: string; -// private CompilerPath: string; -// private FlagsFileName: string; -// private AssemblySetting: string; -// private IsProject: boolean; -// private ImportList: Array; -// private ScriptList: Array; -// private FolderList: Array; -// private Config: PapyrusConfig; - -// private Channel: vscode.OutputChannel; -// private ProjectFolder: string; -// private errCount: number; - -// public IsRelease: boolean; -// public IsFinal: boolean; -// public DoOptimize: boolean; - -// constructor(Config: PapyrusConfig, ProjectFolder: string, DoOptimize: boolean, IsRelease: boolean, IsFinal: boolean, Scripts: Array, Channel: vscode.OutputChannel) { -// this.Config = Config; -// this.RootPath = this.Config.GetRootPath; -// this.OutputPath = this.Config.GetOutputPath; -// this.CompilerPath = this.Config.GetCompilerExecutablePath; - -// this.FlagsFileName = this.Config.GetFlagFileName; -// this.AssemblySetting = this.Config.GetAssemblyFlag; - -// this.IsProject = false; -// this.IsRelease = IsRelease; -// this.IsFinal = IsFinal; - -// this.DoOptimize = DoOptimize; - -// this.ImportList = this.Config.GetCompilerImports.slice(0); -// this.ScriptList = Scripts.slice(0); -// this.FolderList = new Array(); -// this.ProjectFolder = ProjectFolder; -// this.Channel = Channel; - -// this.errCount = 0; -// } - -// private GetCompileArgs(): Array { -// let Result = new Array(); -// switch (this.Config.GameID) { -// case PapyrusConfig.Type.Fallout4: -// if (this.IsProject) { -// Result.push(this.ScriptList[0]); -// } else { -// let filePath = path.join(this.ProjectFolder, 'PapyrusLangTemp.ppj'); -// if (!fs.existsSync(this.ProjectFolder)) { -// fs.mkdirSync(this.ProjectFolder); -// } - -// fs.writeFileSync(filePath, this.ProjectXML()); -// Result.push(filePath); -// } -// break; - -// case PapyrusConfig.Type.Skyrim: -// case PapyrusConfig.Type.SkyrimSpecialEdition: -// if (this.FolderList.length > 0) { -// Result.push(this.FolderList[0]); -// Result.push('-all'); -// } else { -// Result.push(this.ScriptList.join(';')); -// } - -// Result.push('-f=' + this.FlagsFileName); -// Result.push('-i=' + this.ImportList.join(';')); -// Result.push('-o=' + this.OutputPath); - -// switch (this.AssemblySetting.toLowerCase()) { -// case 'none': -// Result.push('-noasm'); break; -// case 'keep': -// Result.push('-keepasm'); break; -// case 'only': -// Result.push('-asmonly'); break; -// default: -// break; -// } - -// if (this.DoOptimize) { -// Result.push('-optimize'); -// } -// } - -// return Result; -// } - -// private IsPathNamespace(filePath: string): boolean { -// switch (this.Config.GameID) { -// case PapyrusConfig.Type.Fallout4: -// filePath = filePath.substring(path.dirname(filePath).length); -// return (filePath.split('\\').length > 3); - -// // Skyrim doesn't support namespaces -// case PapyrusConfig.Type.Skyrim: -// case PapyrusConfig.Type.SkyrimSpecialEdition: -// return false; -// } -// } - -// private IsPathNotNamespace(filePath: string): boolean { -// return (!this.IsPathNamespace(filePath)); -// } - -// private IsStringInArray(searchArray: Array, searchString: string): boolean { -// return (searchArray.findIndex(foundString => (path.normalize(foundString) === path.normalize(searchString))) > -1); -// } - -// private IsStringNotInArray(searchArray: Array, searchString: string): boolean { -// return (!this.IsStringInArray(searchArray, searchString)); -// } - -// private get AreImportsValid(): boolean { -// if (this.ImportList.length > 0) { -// return true; -// } - -// this.Channel.append('Error: No Valid Imports listed.'); -// ++this.errCount; return false; -// } - -// private get AreScriptsValid(): boolean { -// if ((this.ScriptList.length > 0) || (this.FolderList.length > 0)) { -// return true; -// } - -// this.Channel.append('Error: No Valid Scripts/Folders selected.'); -// ++this.errCount; return false; -// } - -// private get IsAssemblySettingValid(): boolean { -// switch (this.AssemblySetting.toLowerCase()) { -// case 'none': -// case 'keep': -// case 'only': -// case 'discard': -// return true; -// } - -// this.Channel.append(`Error: Invalid Assembly Setting [${this.AssemblySetting}].`); -// ++this.errCount; return false; -// } - -// private SortImports(): Array { -// let FinalList = new Array(); - -// this.ImportList.forEach((importPath) => { -// importPath = path.normalize(path.resolve(this.RootPath, importPath)); - -// if (fs.existsSync(importPath)) { -// if (fs.lstatSync(importPath).isDirectory()) { -// if (this.IsStringNotInArray(FinalList, importPath)) { -// if (this.IsPathNotNamespace(importPath)) { -// FinalList.push(importPath); -// } -// } -// } -// } -// }); - -// return FinalList; -// } - -// private SortScripts(): Array { -// let FinalList = new Array(); -// if (this.ScriptList.length === 0) { -// return FinalList; -// } - -// this.ScriptList.forEach((scriptFile) => { -// let scriptPath = path.resolve(this.RootPath, scriptFile); -// let scriptExt = path.extname(scriptFile); - -// switch (scriptExt) { -// case '.psc': -// this.ImportList.push(path.dirname(scriptPath) + '\\'); -// FinalList.push(scriptPath); -// break; - -// case '.ppj': -// this.IsProject = true; -// if (this.ScriptList.length > 1) { -// this.Channel.append('Script List is invalid, projects can only be compiled by themselves'); -// ++this.errCount; return new Array(); -// } -// break; - -// default: -// this.Channel.append(`Error: Unrecognized file type [${scriptExt}].`); -// ++this.errCount; -// } -// }); - -// return FinalList; -// } - -// public ProjectXML(): string { -// var XMLWriter = require('xml-writer'); -// let ProjectFile = new XMLWriter(true); - -// ProjectFile.startDocument(); -// ProjectFile.startElement('PapyrusProject'); -// ProjectFile.writeAttribute('xmlns', 'PapyrusProject.xsd'); -// ProjectFile.writeAttribute('Output', this.OutputPath); -// ProjectFile.writeAttribute('Flags', this.FlagsFileName); -// ProjectFile.writeAttribute('Asm', this.AssemblySetting); -// ProjectFile.writeAttribute('Optimize', this.DoOptimize.toString()); -// ProjectFile.writeAttribute('Release', this.IsRelease.toString()); -// ProjectFile.writeAttribute('Final', this.IsFinal.toString()); - -// ProjectFile.startElement('Imports'); -// for (let element of this.ImportList) { -// ProjectFile.startElement('Import'); -// ProjectFile.text(element); -// ProjectFile.endElement(); -// } ProjectFile.endElement(); - -// if (this.FolderList.length > 0) { -// ProjectFile.startElement('Folders'); -// for (let element of this.FolderList) { -// ProjectFile.startElement('Folder'); -// ProjectFile.text(element); -// ProjectFile.endElement(); -// } ProjectFile.endElement(); -// } - -// if (this.ScriptList.length > 0) { -// ProjectFile.startElement('Scripts'); -// for (let element of this.ScriptList) { -// ProjectFile.startElement('Script'); -// ProjectFile.text(element); -// ProjectFile.endElement(); -// } ProjectFile.endElement(); -// } - -// ProjectFile.endDocument(); -// return ProjectFile.toString(); -// } - -// public Run() { -// let RootPathValid = this.Config.IsRootPathValid; -// let OutputPathValid = this.Config.IsOutputPathValid; -// let CompilerPathValid = this.Config.IsCompilerPathValid; - -// if (RootPathValid && OutputPathValid && CompilerPathValid) { -// this.ScriptList = this.SortScripts(); -// this.ImportList = this.SortImports(); - -// let ImportsValid = this.AreImportsValid; -// let ScriptsValid = this.AreScriptsValid; -// let AsmSettValid = this.IsAssemblySettingValid; - -// if (ImportsValid && ScriptsValid && AsmSettValid) { -// switch (this.Config.GameID) { -// case PapyrusConfig.Type.Fallout4: -// break; -// case PapyrusConfig.Type.Skyrim: -// case PapyrusConfig.Type.SkyrimSpecialEdition: -// this.Channel.append("Papyrus Compiler Version 1.0.0.0 for Skyrim"); -// this.Channel.append("Copyright (C) ZeniMax Media. All rights reserved."); -// // Fake it for the sake of consistency -// } - -// var Compiler = spawn(this.CompilerPath, this.GetCompileArgs()); -// Compiler.stdout.on('data', (data) => { -// this.Channel.append(data.toString()); -// }); - -// Compiler.stderr.on('data', (data) => { -// this.Channel.append(data.toString()); -// }); - -// return; -// } -// } - -// this.Channel.append(''); -// this.Channel.append(`${this.errCount} errors logged. See above for details.`); -// } -// } diff --git a/src/papyrus-lang-vscode/src/features/CompilerTaskDefinition.ts b/src/papyrus-lang-vscode/src/features/CompilerTaskDefinition.ts index 9c0ab31b..61f27911 100644 --- a/src/papyrus-lang-vscode/src/features/CompilerTaskDefinition.ts +++ b/src/papyrus-lang-vscode/src/features/CompilerTaskDefinition.ts @@ -1,28 +1,28 @@ -import { TaskDefinition, Task } from 'vscode'; -import { PapyrusGame } from '../PapyrusGame'; +// import { TaskDefinition, Task } from 'vscode'; +// import { PapyrusGame } from '../PapyrusGame'; -export type TaskOf = { readonly definition: T } & Task; +// export type TaskOf = { readonly definition: T } & Task; -export interface IPapyrusTaskDefinition extends TaskDefinition { - readonly type: 'papyrus'; - readonly papyrus: IPapyrusTaskOptions; -} +// export interface IPapyrusTaskDefinition extends TaskDefinition { +// readonly type: 'papyrus'; +// readonly papyrus: IPapyrusTaskOptions; +// } -export interface IPapyrusTaskOptions { - readonly game: PapyrusGame; - readonly imports?: string[]; - readonly flags?: string; - readonly optimize?: boolean; - readonly emitCompiledScripts?: boolean; - readonly emitAssemblyFiles?: boolean; - readonly debugOutput?: boolean; - readonly output?: string; - readonly final?: boolean; - readonly release?: boolean; - readonly project?: string; - readonly scripts?: { - readonly file?: string; - readonly folder?: string; - readonly noRecurse?: boolean; - }; -} +// export interface IPapyrusTaskOptions { +// readonly game: PapyrusGame; +// readonly imports?: string[]; +// readonly flags?: string; +// readonly optimize?: boolean; +// readonly emitCompiledScripts?: boolean; +// readonly emitAssemblyFiles?: boolean; +// readonly debugOutput?: boolean; +// readonly output?: string; +// readonly final?: boolean; +// readonly release?: boolean; +// readonly project?: string; +// readonly scripts?: { +// readonly files?: string[]; +// readonly folders?: string[]; +// readonly noRecurse?: boolean; +// }; +// } diff --git a/src/papyrus-lang-vscode/src/features/CompilerTaskProvider.ts b/src/papyrus-lang-vscode/src/features/CompilerTaskProvider.ts index a5cffcea..d1b9aa14 100644 --- a/src/papyrus-lang-vscode/src/features/CompilerTaskProvider.ts +++ b/src/papyrus-lang-vscode/src/features/CompilerTaskProvider.ts @@ -1,24 +1,26 @@ -import { TaskProvider, Task, tasks } from 'vscode'; -import { CancellationToken, Disposable } from 'vscode-jsonrpc'; -import { IExtensionConfigProvider } from '../ExtensionConfigProvider'; -import { IPapyrusTaskDefinition, TaskOf, IPapyrusTaskOptions } from './CompilerTaskDefinition'; -import { ILanguageClientManager } from '../server/LanguageClientManager'; -import { PapyrusGame } from '../PapyrusGame'; -import { ICreationKitInfo } from '../CreationKitInfoProvider'; +// import { TaskProvider, Task, tasks, ProcessExecution, workspace, WorkspaceFolder, TaskScope } from 'vscode'; +// import { CancellationToken, Disposable } from 'vscode-jsonrpc'; +// import { IExtensionConfigProvider } from '../ExtensionConfigProvider'; +// import { IPapyrusTaskDefinition, TaskOf, IPapyrusTaskOptions } from './CompilerTaskDefinition'; +// import { ILanguageClientManager } from '../server/LanguageClientManager'; +// import { PapyrusGame } from '../PapyrusGame'; +// import { ICreationKitInfo, ICreationKitInfoProvider } from '../CreationKitInfoProvider'; +// import { getDefaultFlagsFileNameForGame } from '../Utilities'; +// import { take } from 'rxjs/operators'; +// import * as path from 'path'; // function taskOptionsToCommandLineArguments(options: IPapyrusTaskOptions, creationKitInfo: ICreationKitInfo) { // const args: string[] = []; // const isFallout4 = options.game === PapyrusGame.fallout4; +// const project = isFallout4 && options.project; -// if (isFallout4 && options.project) { -// args.push(options.project); -// } else { -// const imports = - -// if (options.scripts.file) { -// args.push(options.scripts.file); -// } else if (options.scripts.folder) { -// args.push(options.scripts.folder); +// if (project) { +// args.push(project); +// } else if (options.scripts) { +// if (options.scripts.files) { +// args.push(options.scripts.files.join(';')); +// } else if (options.scripts.folders) { +// args.push(options.scripts.folders.join(';')); // args.push('-all'); // if (isFallout4 && options.scripts.noRecurse) { @@ -27,43 +29,92 @@ import { ICreationKitInfo } from '../CreationKitInfoProvider'; // } // } +// if (isFallout4) { +// if (options.final) { +// args.push('-final'); +// } + +// if (options.release) { +// args.push('-release'); +// } + +// args.push('-ignorecwd'); +// } + // if (options.debugOutput) { // args.push('-debug'); // } -// if (options.final) { -// args.push('-final'); +// if (options.optimize) { +// args.push('-optimize'); // } -// args.push('-final'); +// const flags = !options.flags && !project ? getDefaultFlagsFileNameForGame(options.game) : options.flags; +// if (flags) { +// args.push(`-flags="${flags}"`); +// } + +// const output = !options.output && !project ? creationKitInfo.config.Papyrus.sScriptCompiledFolder : options.output; +// if (output) { +// args.push(`-output="${output}"`); +// } // return args; // } -export class CompilerTaskProvider implements TaskProvider, Disposable { - private _taskProviderHandle: Disposable; - private _configProvider: IExtensionConfigProvider; - private _clientManager: ILanguageClientManager; - - constructor( - @IExtensionConfigProvider configProvider: IExtensionConfigProvider, - @ILanguageClientManager clientManager: ILanguageClientManager - ) { - this._taskProviderHandle = tasks.registerTaskProvider('papyrus', this); - - this._configProvider = configProvider; - this._clientManager = clientManager; - } - - async provideTasks(token?: CancellationToken): Promise { - return []; - } - - resolveTask(task: TaskOf, token?: CancellationToken): Promise { - throw new Error('Method not implemented.'); - } - - dispose() { - this._taskProviderHandle.dispose(); - } -} +// export class CompilerTaskProvider implements TaskProvider, Disposable { +// private _taskProviderHandle: Disposable; +// private _creationKitInfoProvider: ICreationKitInfoProvider; + +// constructor(@ICreationKitInfoProvider creationKitInfoProvider: ICreationKitInfoProvider) { +// this._creationKitInfoProvider = creationKitInfoProvider; +// this._taskProviderHandle = tasks.registerTaskProvider('papyrus', this); +// } + +// async provideTasks(token?: CancellationToken): Promise { +// // const creationKitInfo = await this._creationKitInfoProvider.infos +// // .get(PapyrusGame.fallout4) +// // .pipe(take(1)) +// // .toPromise(); + +// // return workspace.workspaceFolders.map((folder) => { +// // const task = new Task( +// // { type: 'papyrus', papyrus: { game: PapyrusGame.fallout4, project: '' } }, +// // folder, +// // 'default', +// // 'papyrus' +// // ); + +// // task.execution = new ProcessExecution( +// // path.join(creationKitInfo.resolvedCompilerPath, 'PapyrusCompiler.exe'), +// // taskOptionsToCommandLineArguments(task.definition.papyrus, creationKitInfo) +// // ); + +// // return task; +// // }); + +// return undefined; +// } + +// async resolveTask(task: TaskOf, token?: CancellationToken): Promise { +// const creationKitInfo = await this._creationKitInfoProvider.infos +// .get(task.definition.papyrus.game) +// .pipe(take(1)) +// .toPromise(); + +// if (token.isCancellationRequested) { +// return null; +// } + +// task.execution = new ProcessExecution( +// path.join(creationKitInfo.resolvedCompilerPath, 'PapyrusCompiler.exe'), +// taskOptionsToCommandLineArguments(task.definition.papyrus, creationKitInfo) +// ); + +// return task; +// } + +// dispose() { +// this._taskProviderHandle.dispose(); +// } +// } diff --git a/src/papyrus-lang-vscode/src/server/LanguageClientHost.ts b/src/papyrus-lang-vscode/src/server/LanguageClientHost.ts index f6e8fe66..a4bae3f8 100644 --- a/src/papyrus-lang-vscode/src/server/LanguageClientHost.ts +++ b/src/papyrus-lang-vscode/src/server/LanguageClientHost.ts @@ -7,6 +7,7 @@ import { Observable, BehaviorSubject } from 'rxjs'; import { ICreationKitInfo } from '../CreationKitInfoProvider'; import { DocumentScriptInfo } from './messages/DocumentScriptInfo'; import { shareReplay, take } from 'rxjs/operators'; +import { getDefaultFlagsFileNameForGame } from '../Utilities'; export enum ClientHostStatus { none, @@ -105,7 +106,7 @@ export class LanguageClientHost implements ILanguageClientHost, Disposable { compilerAssemblyPath: this._creationKitInfo.resolvedCompilerPath, creationKitInstallPath: this._creationKitInfo.resolvedInstallPath, relativeIniPaths: this._config.creationKitIniFiles, - flagsFileName: getFlagsFileName(this._game), + flagsFileName: getDefaultFlagsFileNameForGame(this._game), ambientProjectName: `${getShortDisplayNameForGame(this._game)} Creation Kit`, defaultScriptSourceFolder: this._creationKitInfo.config.Papyrus.sScriptSourceFolder, defaultAdditionalImports: this._creationKitInfo.config.Papyrus.sAdditionalImports, @@ -170,7 +171,3 @@ function getToolPath(game: PapyrusGame) { const toolGameName = getToolGameName(game); return `./bin/Debug/net461/DarkId.Papyrus.Host.${toolGameName}/DarkId.Papyrus.Host.${toolGameName}.exe`; } - -function getFlagsFileName(game: PapyrusGame) { - return game === PapyrusGame.fallout4 ? 'Institute_Papyrus_Flags.flg' : 'TESV_Papyrus_Flags.flg'; -}