Skip to content

Commit

Permalink
fixed getting settings from AppSourceCop
Browse files Browse the repository at this point in the history
  • Loading branch information
waldo committed Dec 5, 2022
1 parent d584e65 commit c0f30f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,7 +1,7 @@
# Change Log
All notable changes to the "crs-al-language-extension" extension:

## [1.5.21] - 2022-12-05
## [1.5.22] - 2022-12-05
- Snippet contribution from [christianbraeunlich](https://github.com/christianbraeunlich). Thanks!
- Support for multiple affixes by [pri-kise](https://github.com/pri-kise). Thanks for [the PR](https://github.com/waldo1001/crs-al-language-extension/pull/254)!

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "crs-al-language-extension",
"displayName": "waldo's CRS AL Language Extension",
"description": "Make working with the (Dynamics NAV / 365) AL Language easier and more efficient.",
"version": "1.5.21",
"version": "1.5.22",
"publisher": "waldo",
"icon": "images/waldo.png",
"author": {
Expand Down
28 changes: 22 additions & 6 deletions src/Settings.ts
Expand Up @@ -150,14 +150,30 @@ export class Settings {
}

private static getAppSourceCopSettings(ResourceUri: vscode.Uri) {
let appSourceCopSettings = ResourceUri ?
require(join(vscode.workspace.getWorkspaceFolder(ResourceUri).uri.fsPath, "AppSourceCop.json")) :
vscode.window.activeTextEditor ?
require(join(vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri.fsPath, "AppSourceCop.json")) :
vscode.workspace.workspaceFolders ?
require(join(vscode.workspace.workspaceFolders[0].uri.fsPath, "AppSourceCop.json")): null;
// let appSourceCopSettings = ResourceUri ?
// require(join(vscode.workspace.getWorkspaceFolder(ResourceUri).uri.fsPath, "AppSourceCop.json")) :
// vscode.window.activeTextEditor ?
// require(join(vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri.fsPath, "AppSourceCop.json")) :
// vscode.workspace.workspaceFolders ?
// require(join(vscode.workspace.workspaceFolders[0].uri.fsPath, "AppSourceCop.json")): null;

let appSourceCopSettings;

try {
appSourceCopSettings = ResourceUri ?
require(join(vscode.workspace.getWorkspaceFolder(ResourceUri).uri.fsPath, "AppSourceCop.json")) :
vscode.window.activeTextEditor ?
require(join(vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri.fsPath, "AppSourceCop.json")) :
vscode.workspace.workspaceFolders ?
require(join(vscode.workspace.workspaceFolders[0].uri.fsPath, "AppSourceCop.json")) : null;
} catch {
appSourceCopSettings = null;
}

if (appSourceCopSettings) {
this.SettingCollection[this.MandatoryAffixes] = appSourceCopSettings.mandatoryAffixes
} else {
this.SettingCollection[this.MandatoryAffixes] = null
}
}

Expand Down

0 comments on commit c0f30f2

Please sign in to comment.