Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
fix: ignore files based on the path within the workspace folder
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Feb 22, 2024
1 parent e07a9b3 commit 1702def
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions toolchains/solidity/extension/src/gas-estimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ export function registerGasEstimation() {
// Generate the report when the file is opened or saved
vscode.workspace.onDidOpenTextDocument(async (document) => {
// gas estimate only the main contracts
if (document.uri.path.includes("lib") || document.uri.path.includes("test") || document.uri.path.includes("script") || document.uri.path.includes(".git") || !forgeInstalled) {
const workspacePath = vscode.workspace.workspaceFolders?.[0].uri.path;
if (!workspacePath) {
return;
}
const cleanPath = document.uri.path.replace(workspacePath, "");
if (cleanPath.includes("lib") || cleanPath.includes("test") || cleanPath.includes("script") || cleanPath.includes(".git") || !forgeInstalled) {
return;
}
const report = await gasReport(document.getText(), document.uri.path);
Expand All @@ -299,7 +304,12 @@ export function registerGasEstimation() {
});
vscode.workspace.onDidSaveTextDocument(async (document) => {
// gas estimate only the main contracts
if (document.uri.path.includes("lib") || document.uri.path.includes("test") || document.uri.path.includes("script") || document.uri.path.includes(".git") || !forgeInstalled) {
const workspacePath = vscode.workspace.workspaceFolders?.[0].uri.path;
if (!workspacePath) {
return;
}
const cleanPath = document.uri.path.replace(workspacePath, "");
if (cleanPath.includes("lib") || cleanPath.includes("test") || cleanPath.includes("script") || cleanPath.includes(".git") || !forgeInstalled) {
return;
}
const report = await gasReport(document.getText(), document.uri.path);
Expand Down

0 comments on commit 1702def

Please sign in to comment.