Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ You can create a local config file for your project named `.openedge.json`, with
"${workspaceFolder}"
],
"dlc": "C:/Progress/OpenEdge", //optional override
"proPathMode": "append", // overwrite, prepend
"proPathMode": "append", // append, overwrite, prepend
"parameterFiles": [ // -pf
"default.pf"
],
"initializationFile": "default.ini", // -ininame
"startupProcedure" : "${workspaceFolder}/vsc-oe-startup.p",
"dbDictionary": [
"myDatabaseForAutoComplete"
],
"format": {
"trim": "right" // none
}
"trim": "right" // right, none
},
"checkSyntaxWindowExecutable": "prowin" // prowin, _progres
}
```

Expand Down
119 changes: 64 additions & 55 deletions schemas/openedge.schema.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,64 @@
{
"definitions": {},
"id": "openedge.json",
"properties": {
"parameterFiles": {
"id": "/properties/parameterFiles",
"description": "Path to .pf files",
"items": {
"type": "string"
},
"type": "array"
},
"dlc": {
"id": "/properties/dlc",
"description": "Path to Progress OpenEdge installation (if not set use ENVVAR $DLC)",
"type": ["string", "array"]
},
"proPath": {
"id": "/properties/proPath",
"description": "Path to include in the PROPATH variable",
"items": {
"type": "string"
},
"type": "array"
},
"proPathMode": {
"default": "append",
"description": "Specify how the PROPATH is modified",
"enum": [
"append",
"prepend",
"overwrite"
],
"id": "/properties/proPathMode",
"title": "proPathMode",
"type": "string"
},
"workingDirectory": {
"id": "/properties/workingDirectory",
"description": "Current working directory (home)",
"type": "string"
},
"startupProcedure": {
"id": "/properties/startupProcedure",
"description": "Path to OpenEdge Startup Procedure",
"type": "string"
},
"dbDictionary": {
"id": "/properties/dbDictionary",
"description": "Logical names of database files for the auto-complete option (command: ABL Read Dictionary Structure)",
"type": "array"
}
},
"type": "object"
}
{
"definitions": {},
"id": "openedge.json",
"properties": {
"parameterFiles": {
"id": "/properties/parameterFiles",
"description": "Path to .pf files",
"items": {
"type": "string"
},
"type": "array"
},
"initializationFile": {
"id": "/properties/initializationFile",
"description": "Path to .ini file",
"type": "string"
},
"dlc": {
"id": "/properties/dlc",
"description": "Path to Progress OpenEdge installation (if not set use ENVVAR $DLC)",
"type": "string"
},
"proPath": {
"id": "/properties/proPath",
"description": "Path to include in the PROPATH variable",
"items": {
"type": "string"
},
"type": "array"
},
"proPathMode": {
"default": "append",
"description": "Specify how the PROPATH is modified",
"enum": ["append", "prepend", "overwrite"],
"id": "/properties/proPathMode",
"title": "proPathMode",
"type": "string"
},
"checkSyntaxWindowExecutable": {
"default": "prowin",
"description": "Specify executable to check syntax for window (.w) application",
"enum": ["prowin", "_progres"],
"id": "/properties/checkSyntaxWindowExecutable",
"title": "checkSyntaxWindowExecutable",
"type": "string"
},
"workingDirectory": {
"id": "/properties/workingDirectory",
"description": "Current working directory (home)",
"type": "string"
},
"startupProcedure": {
"id": "/properties/startupProcedure",
"description": "Path to OpenEdge Startup Procedure",
"type": "string"
},
"dbDictionary": {
"id": "/properties/dbDictionary",
"description": "Logical names of database files for the auto-complete option (command: ABL Read Dictionary Structure)",
"type": "array"
}
},
"type": "object"
}
9 changes: 7 additions & 2 deletions src/ablCheckSyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
import { getOpenEdgeConfig } from './ablConfig';
import { outputChannel } from './ablStatus';
import { createProArgs, getProBin, setupEnvironmentVariables } from './shared/ablPath';
import { createProArgs, getProBin, getProwinBin, setupEnvironmentVariables } from './shared/ablPath';

const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
// statusBarItem.command = 'abl.checkSyntax.showOutput';
Expand All @@ -30,12 +30,17 @@ export function checkSyntax(filename: string, ablConfig: vscode.WorkspaceConfigu
let cwd = path.dirname(filename);

return getOpenEdgeConfig().then((oeConfig) => {
const cmd = getProBin(oeConfig.dlc);
let cmd = "";
let regWindowFile = /^.*\.w$/
if (filename.match(regWindowFile) && oeConfig.checkSyntaxWindowExecutable != '_progres')
cmd = getProwinBin(oeConfig.dlc);
else cmd = getProBin(oeConfig.dlc);
const env = setupEnvironmentVariables(process.env, oeConfig, vscode.workspace.rootPath);
const args = createProArgs({
batchMode: true,
param: filename,
parameterFiles: oeConfig.parameterFiles,
initializationFile: oeConfig.initializationFile,
startupProcedure: path.join(__dirname, '../../abl-src/check-syntax.p'),
workspaceRoot: vscode.workspace.rootPath,
});
Expand Down
1 change: 1 addition & 0 deletions src/ablRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function run(filename: string, ablConfig: vscode.WorkspaceConfiguration):
batchMode: true,
param: filename,
parameterFiles: oeConfig.parameterFiles,
initializationFile: oeConfig.initializationFile,
startupProcedure: path.join(__dirname, '../../abl-src/run.p'),
workspaceRoot: vscode.workspace.rootPath,
});
Expand Down
1 change: 1 addition & 0 deletions src/ablTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ async function runTestFile(fileName, cmd, env, cwd, oeConfig: OpenEdgeConfig) {
batchMode: true,
param: `${fileName} -outputLocation ${outDir}`,
parameterFiles: oeConfig.parameterFiles,
initializationFile: oeConfig.initializationFile,
startupProcedure: 'ABLUnitCore.p',
temporaryDirectory: outDir,
});
Expand Down
1 change: 1 addition & 0 deletions src/debugAdapter/ablDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ class AblDebugSession extends DebugSession {
debugPort: args.port,
param: args.args ? args.args.join(' ') : '',
parameterFiles: oeConfig.parameterFiles,
initializationFile: oeConfig.initializationFile,
startupProcedure: path.join(__dirname, '../../../abl-src/run-debug.p'),
});

Expand Down
4 changes: 2 additions & 2 deletions src/parser/documentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export class ABLDocument {
this._temps = getAllTempTables(sourceCode);
// reference to db tables
this._temps.filter((item) => !isNullOrUndefined(item.referenceTable)).forEach((item) => {
const tb = getTableCollection().items.find((tn) => tn.label.toLowerCase() === item.referenceTable.toLowerCase());
const tb = getTableCollection().items.find((tn) => tn.label.toString().toLowerCase() === item.referenceTable.toLowerCase());
// tslint:disable-next-line:no-string-literal
if ((!isNullOrUndefined(tb)) && (!isNullOrUndefined(tb['fields']))) {
// tslint:disable-next-line:no-string-literal
Expand Down Expand Up @@ -472,7 +472,7 @@ export class ABLDocumentController {
if (document.languageId === ABL_MODE.language) {
const ablDoc: ABLDocument = this._documents[document.uri.fsPath];
const invoke = this.invokeUpdateDocument;
return new Promise((resolve, reject) => {
return new Promise<null | void>((resolve, reject) => {
if (ablDoc) {
// cancel any pending update request
if (ablDoc.debounceController) {
Expand Down
4 changes: 2 additions & 2 deletions src/providers/ablCompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ABLCompletionItemProvider implements vscode.CompletionItemProvider

private getCompletionFields(prefix: string, replacement?: string): vscode.CompletionItem[] {
// Tables
const tb = _tableCollection.items.find((item) => item.label.toLowerCase() === prefix);
const tb = _tableCollection.items.find((item) => item.label.toString().toLowerCase() === prefix);
if (tb) {
// tslint:disable-next-line:no-string-literal
let result = tb['completion'].items;
Expand Down Expand Up @@ -146,7 +146,7 @@ function unloadDumpFile(filename: string) {
}

export function watchDictDumpFiles() {
return new Promise<null>((resolve, reject) => {
return new Promise<null | void>((resolve, reject) => {
watcher = vscode.workspace.createFileSystemWatcher('**/.openedge.db.*');
watcher.onDidChange((uri) => loadAndSetDumpFile(uri.fsPath));
watcher.onDidDelete((uri) => unloadDumpFile(uri.fsPath));
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ablHoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ABLHoverProvider implements HoverProvider {
if ((words.length === 1) ||
((words.length > 1) && (selection.word === words[0]))) {
// check for table collection
const tb = getTableCollection().items.find((item) => item.label.toLocaleLowerCase() === selection.word);
const tb = getTableCollection().items.find((item) => item.label.toString().toLocaleLowerCase() === selection.word);
if (tb) {
const tbd = tb as ABLTableDefinition;
return new Hover([selection.word, '*' + tb.detail + '*', 'PK: ' + tbd.pkList], selection.wordRange);
Expand Down
4 changes: 4 additions & 0 deletions src/shared/ablPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ProArgsOptions {
startupProcedure: string;
param?: string;
parameterFiles?: string[];
initializationFile?: string;
databaseNames?: string[];
batchMode?: boolean;
debugPort?: number;
Expand Down Expand Up @@ -70,6 +71,9 @@ export function createProArgs(options: ProArgsOptions): string[] {
args.push('-T');
args.push(tempDir);
}
if(options.initializationFile){
args.push('-ininame', options.initializationFile.replace('${workspaceRoot}', options.workspaceRoot));
}
args = args.concat(pfArgs);
if (options.batchMode) {
args.push('-b');
Expand Down
2 changes: 2 additions & 0 deletions src/shared/openEdgeConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ export interface OpenEdgeConfig {
proPath?: string[];
proPathMode?: 'append' | 'overwrite' | 'prepend';
parameterFiles?: string[];
initializationFile?: string,
workingDirectory?: string;
test?: TestConfig;
startupProcedure?: string;
dbDictionary?: string[];
format?: OpenEdgeFormatOptions;
checkSyntaxWindowExecutable?: 'prowin' | '_progres';
}

export function loadConfigFile(filename: string): Thenable<OpenEdgeConfig> {
Expand Down