Skip to content

Commit

Permalink
Quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
K-dizzled committed Nov 8, 2023
1 parent 6cbdc16 commit 09e6b09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/extension/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ export interface CoqpilotConfig {

export class CoqpilotConfigWrapper {
private _config: CoqpilotConfig;
private autoUpdate: boolean;

get config(): CoqpilotConfig {
if (!this.autoUpdate) {
return this._config;
}

this._config = CoqpilotConfig.create(
vscode.workspace.getConfiguration('coqpilot')
);
Expand All @@ -32,10 +38,11 @@ export class CoqpilotConfigWrapper {
return this._config;
}

constructor(conf: CoqpilotConfig | undefined = undefined) {
constructor(conf: CoqpilotConfig | undefined = undefined, autoUpdate: boolean = true) {
this._config = conf ?? CoqpilotConfig.create(
vscode.workspace.getConfiguration('coqpilot')
)!;
this.autoUpdate = autoUpdate;
CoqpilotConfig.checkRequirements(this._config);
logger.info("Successfully created config.");
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/coqLlmInteractionTests/lspClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ suite('CoqLspClient tests', () => {
const statusItem = new StatusBarButton();
const wsConfig = workspace.getConfiguration("coqpilot");
const extensionConfig = new CoqpilotConfigWrapper(
updateCoqpilotConfig(CoqpilotConfig.create(wsConfig))
updateCoqpilotConfig(CoqpilotConfig.create(wsConfig)), false
);
console.log(extensionConfig);
console.log("EXTCONFIG", extensionConfig);
const client = new CoqLspClient(statusItem, wsConfig, extensionConfig);

assert.strictEqual(statusItem.runStatus, StatusBarState.Activating);
Expand Down
6 changes: 3 additions & 3 deletions src/test/coqLlmInteractionTests/proofView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suite('ProofView auxTheorem tests', () => {
const wsConfig = workspace.getConfiguration("coqpilot");
const dirname = path.dirname(path.dirname(path.dirname(__dirname)));
const extensionConfig = new CoqpilotConfigWrapper(
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig))
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig)), false
);

interface TestData {
Expand Down Expand Up @@ -122,7 +122,7 @@ suite('ProofView checkTheorems tests', () => {
const wsConfig = workspace.getConfiguration("coqpilot");
const dirname = path.dirname(path.dirname(path.dirname(__dirname)));
const extensionConfig = new CoqpilotConfigWrapper(
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig))
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig)), false
);

interface TestData {
Expand Down Expand Up @@ -209,7 +209,7 @@ suite('ProofView parseFile tests', () => {
const wsConfig = workspace.getConfiguration("coqpilot");
const dirname = path.dirname(path.dirname(path.dirname(__dirname)));
const extensionConfig = new CoqpilotConfigWrapper(
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig))
common.updateCoqpilotConfig(CoqpilotConfig.create(wsConfig)), false
);

interface TheoremData {
Expand Down

0 comments on commit 09e6b09

Please sign in to comment.