Skip to content

Commit

Permalink
Merge pull request #172 from joennlae/add-compile-on-open-setting
Browse files Browse the repository at this point in the history
adding `compileOnOpen` setting option
  • Loading branch information
joecrop committed Sep 14, 2022
2 parents 20913bb + aa9d070 commit cddd592
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -82,6 +82,8 @@ This VS Code extension provides features to read, navigate and write SystemVeril
- `systemverilog.compilerType`: _String_, Dropdown list to select a compiler type
- Default: `Verilator`
- `systemverilog.trace.server`: _String_, Dropdown to select verbosity of LSP message tracing
- `systemverilog.compileOnOpen`: _Boolean_, Compile all files when opened
- Default: `false`

### Customizations

Expand Down
7 changes: 6 additions & 1 deletion package.json
Expand Up @@ -215,7 +215,12 @@
"type": "boolean",
"default": false,
"description": "Run ANTLR verification on all files when opened."
}
},
"systemverilog.compileOnOpen": {
"type": "boolean",
"default": false,
"description": "Compile all files when opened."
}
}
}
],
Expand Down
9 changes: 7 additions & 2 deletions src/server.ts
Expand Up @@ -23,7 +23,8 @@ const compilerConfigurationsKeys: string[] = [
'systemverilog.launchConfigurationVerible',
'systemverilog.antlrVerification',
'systemverilog.verifyOnOpen',
'systemverilog.excludeCompiling'
'systemverilog.excludeCompiling',
'systemverilog.compileOnOpen'
];

const backend: ANTLRBackend = new ANTLRBackend();
Expand Down Expand Up @@ -115,7 +116,7 @@ function updateConfigurationsSettings(): Promise<any> {
}

/**
* If `compileOnSave` is set to true, the server will compile the document.
* If `compileOnSave` and/or `compileOnOpen` is set to true, the server will compile the document.
*
* @param saveEvent An object containing information about the saved file
*/
Expand Down Expand Up @@ -172,6 +173,10 @@ documents.onDidOpen(async (openEvent) => {
// Check for verifyOnOpen being true
verifyDocument(openEvent.document.uri);
}
if (configurations.get(compilerConfigurationsKeys[8])) {
// Check for compileOnOpen being true
compile(openEvent.document);
}
});

/**
Expand Down

0 comments on commit cddd592

Please sign in to comment.