diff --git a/integ/spec/common.ts b/integ/spec/common.ts index 30c10cc..394e79e 100644 --- a/integ/spec/common.ts +++ b/integ/spec/common.ts @@ -69,6 +69,9 @@ export async function initState(): Promise { const lfortranPathSetting: Setting = await settingsEditor.findSettingByID("LFortranLanguageServer.compiler.lfortranPath"); await lfortranPathSetting.setValue("./lfortran/src/bin/lfortran"); + const compilerFlagsSetting: Setting = + await settingsEditor.findSettingByID("LFortranLanguageServer.compiler.flags"); + await compilerFlagsSetting.setValue(""); const fontFamily: Setting = await settingsEditor.findSettingByID("editor.fontFamily"); await fontFamily.setValue('consolas, "DejaVu Sans Mono", monospace'); diff --git a/package.json b/package.json index d30fc18..a29aa06 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,12 @@ "default": "lfortran", "description": "The path to the LFortran compiler executable." }, + "LFortranLanguageServer.compiler.flags": { + "scope": "resource", + "type": "string", + "default": "", + "description": "Additional flags to pass to the LFortran compiler ( space separated )." + }, "LFortranLanguageServer.log.level": { "scope": "resource", "type": "string", diff --git a/server/src/lfortran-accessors.ts b/server/src/lfortran-accessors.ts index dbfa2f1..a9964b8 100644 --- a/server/src/lfortran-accessors.ts +++ b/server/src/lfortran-accessors.ts @@ -282,6 +282,9 @@ export class LFortranCLIAccessor implements LFortranAccessor { const start: number = performance.now(); const flags = ["--show-document-symbols", "--continue-compilation"]; + if (settings.compiler.flags !== "") { + flags.push(settings.compiler.flags); + } const stdout = await this.runCompiler(settings, flags, text, "[]"); let symbols: SymbolInformation[]; @@ -340,6 +343,9 @@ export class LFortranCLIAccessor implements LFortranAccessor { "--column=" + (column + 1), "--continue-compilation" ]; + if (settings.compiler.flags !== "") { + flags.push(settings.compiler.flags); + } const stdout = await this.runCompiler(settings, flags, text, "[]"); const results = JSON.parse(stdout); for (let i = 0, k = results.length; i < k; i++) { @@ -395,6 +401,9 @@ export class LFortranCLIAccessor implements LFortranAccessor { let stdout: string | null = null; try { const flags = ["--show-errors", "--continue-compilation"]; + if (settings.compiler.flags !== "") { + flags.push(settings.compiler.flags); + } stdout = await this.runCompiler(settings, flags, text, "[]", true); if (stdout.length > 0) { @@ -470,6 +479,9 @@ export class LFortranCLIAccessor implements LFortranAccessor { "--column=" + (column + 1), "--continue-compilation" ]; + if (settings.compiler.flags !== "") { + flags.push(settings.compiler.flags); + } const stdout = await this.runCompiler(settings, flags, text, "[]"); const obj = JSON.parse(stdout); for (let i = 0, k = obj.length; i < k; i++) { diff --git a/server/src/lfortran-types.ts b/server/src/lfortran-types.ts index 0de3df4..971c662 100644 --- a/server/src/lfortran-types.ts +++ b/server/src/lfortran-types.ts @@ -5,6 +5,7 @@ export interface LFortranSettings { maxNumberOfProblems: number; compiler: { lfortranPath: string; + flags: string; }; log: { level: string;