Skip to content

Commit

Permalink
Merge pull request #54 from PraneshASP/staging
Browse files Browse the repository at this point in the history
✨ Version 1.4.1
  • Loading branch information
PraneshASP authored Sep 3, 2024
2 parents b1b8226 + 1c2d2aa commit 4ee6c3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-solidity-inspector",
"displayName": "Solidity Inspector",
"description": "A vscode extension used to inspect Solidity files",
"version": "1.4.0",
"version": "1.4.1",
"engines": {
"vscode": "^1.72.0"
},
Expand Down
5 changes: 2 additions & 3 deletions src/commands/contract-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,12 @@ function getContractSizes(fileName) {
const foundryJsonPath = path.join(workspaceRoot, foundryOutDir, `${path.basename(fileName)}`, `${contractName}.json`);
let hardhatJsonPath = null;
if (hardhatOutDir) {
const relativePath = path.relative(path.join(workspaceRoot, 'contracts'), fileName);
const relativePath = path.relative(workspaceRoot, fileName);
hardhatJsonPath = path.join(hardhatOutDir, relativePath, `${contractName}.json`);
}

const jsonPaths = [foundryJsonPath, hardhatJsonPath].filter(Boolean);

for (const jsonPath of jsonPaths) {
for (const jsonPath of jsonPaths) {
try {
if (fs.existsSync(jsonPath)) {
const jsonContent = JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
Expand Down
6 changes: 4 additions & 2 deletions src/completionItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ async function loadRemappings(rootPath) {
}

const completionItem = new vscode.CompletionItem(`${name} from "${finalPath}"`, vscode.CompletionItemKind.File);
completionItem.insertText = `{ ${name} } from "${finalPath}";`;

const currentLineRange = document.lineAt(position.line).text.length;
const rangeToRemove = new vscode.Range(position.line, 0, position.line, position.character + currentLineRange);
completionItem.insertText = `import { ${name} } from "${finalPath}";`;
completionItem.additionalTextEdits = [vscode.TextEdit.delete(rangeToRemove)];
return completionItem;
});
});
Expand Down

0 comments on commit 4ee6c3b

Please sign in to comment.