forked from OlegKunitsyn/gnucobol-debug
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor adaptations for integration into SuperBOL
- Loading branch information
Showing
5 changed files
with
31 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,24 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
type InspectResult<T> = { | ||
key: string; | ||
defaultValue?: T; | ||
globalValue?: T; | ||
workspaceValue?: T; | ||
workspaceFolderValue?: T; | ||
defaultLanguageValue?: T; | ||
globalLanguageValue?: T; | ||
workspaceLanguageValue?: T; | ||
workspaceFolderLanguageValue?: T; | ||
languageIds?: string[]; | ||
} | undefined | ||
|
||
export class DebuggerSettings { | ||
private readonly extensionSettings: vscode.WorkspaceConfiguration; | ||
private readonly superbolExtensionSettings: vscode.WorkspaceConfiguration; | ||
private readonly debugSettings: vscode.WorkspaceConfiguration; | ||
|
||
constructor() { | ||
this.extensionSettings = vscode.workspace.getConfiguration("superbol-vscode-debug"); | ||
// Get SuperBOL base extension settings (for instance to get LibCob path) | ||
// Though shouls should be obtained by querying the extension instead ? | ||
this.superbolExtensionSettings = vscode.workspace.getConfiguration("superbol"); | ||
} | ||
|
||
private getWithFallback<T>(settings: vscode.WorkspaceConfiguration, section: string): T { | ||
const info: InspectResult<T> = settings.inspect<T>(section); | ||
if (info.workspaceFolderValue !== undefined) { | ||
return info.workspaceFolderValue; | ||
} else if (info.workspaceValue !== undefined) { | ||
return info.workspaceValue; | ||
} else if (info.globalValue !== undefined) { | ||
return info.globalValue; | ||
} | ||
return info.defaultValue; | ||
this.debugSettings = | ||
vscode.workspace.getConfiguration("superbol.debugger"); | ||
//this.globalSettings = | ||
// vscode.workspace.getConfiguration("superbol"); | ||
} | ||
|
||
public get displayVariableAttributes(): boolean { | ||
return this.getWithFallback<boolean>(this.extensionSettings, "displayVariableAttributes"); | ||
return this.debugSettings.get <boolean> ("display-variable-attributes"); | ||
} | ||
|
||
public get gdbpath(): string { | ||
return this.getWithFallback<string>(this.extensionSettings, "pathToGDB"); | ||
return this.debugSettings.get <string> ("gdb-path"); | ||
} | ||
|
||
public get libcobpath(): string { | ||
return this.getWithFallback<string>(this.extensionSettings, "pathToLibCob"); | ||
return this.debugSettings.get <string> ("libcob-path"); | ||
} | ||
} |