Skip to content

Commit 5c7748d

Browse files
committed
feat: add settings to disable contract size
1 parent a678479 commit 5c7748d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"onLanguage:tree"
3434
],
3535
"contributes": {
36+
3637
"commands": [
3738
{
3839
"command": "vscode-solidity-inspector.activeFile.irOptimizer",
@@ -103,7 +104,13 @@
103104
"configuration": {
104105
"type": "object",
105106
"title": "Solidity Inspector",
106-
"properties": {}
107+
"properties": {
108+
"solidityInspector.showContractSize": {
109+
"type": "boolean",
110+
"default": true,
111+
"description": "Show contract size information in the editor"
112+
}
113+
}
107114
},
108115
"keybindings": [
109116
{

src/commands/contract-size.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ function findArtifactsDir(dir) {
8181
}
8282

8383
function updateDecorations(document) {
84+
const config = vscode.workspace.getConfiguration('solidityInspector');
85+
const showContractSize = config.get('showContractSize');
86+
87+
if (!showContractSize) {
88+
// Clear decorations if the feature is disabled
89+
vscode.window.activeTextEditor?.setDecorations(decorationType, []);
90+
return;
91+
}
8492
const text = document.getText();
8593
const contractSizes = getContractSizes(document.fileName);
8694
const decorations = [];
@@ -97,7 +105,7 @@ function updateDecorations(document) {
97105
range,
98106
renderOptions: {
99107
after: {
100-
contentText: ` (${formatSize(size)})`,
108+
contentText: ` [${formatSize(size)}]`,
101109
color: getSizeColor(size),
102110
}
103111
}

0 commit comments

Comments
 (0)