An open API service indexing awesome lists of open source software.

https://github.com/tintinweb/vscode-solidity-flattener

Flatten Solidity Contracts using `truffle-flattener`
https://github.com/tintinweb/vscode-solidity-flattener

Last synced: 11 months ago
JSON representation

Flatten Solidity Contracts using `truffle-flattener`

Awesome Lists containing this project

README

          

[get in touch with Consensys Diligence](https://diligence.consensys.net)


[[ 🌐 ](https://diligence.consensys.net) [ 📩 ](mailto:diligence@consensys.net) [ 🔥 ](https://consensys.github.io/diligence/)]


# VSCode Solidity Contract Flattener

[truffle-flattener](https://www.npmjs.com/package/truffle-flattener) context menu integration for vscode.

Adds a context menu to flatten solidity contracts from truffle projects:
* **NOTE/REQUIRED**: Make sure you've installed truffle and the project's dependencies (`npm install`).
* select files, `right-click` -> `Solidity: flatten selected file(s)`
* or `cmd + shift + p` -> `Solidity Flattener - flatten current file`.

context-menu

### Developers

`truffle-flattener.contextMenu.flatten` can be called by any other extension as following:

* `files` .. an array of files to flatten
* `callback` .. function to be called as `callback(string:filepath, string:truffle-path, string:flattened_contract)` on flatten success
* `showErrors` .. enable or suppress vscode info/error notifications

```js

vscode.commands.executeCommand("vscode-solidity-flattener.flatten", {files: files, callback:callback, showErrors:showErrors})
.catch(error =>{
// command not available
vscode.window.showWarningMessage("Error running `tintinweb.vscode-solidity-flattener`. Please make sure the extension is installed.\n" + error)
})
```

## Credits

* [truffle-flattener](https://www.npmjs.com/package/truffle-flattener)

## Release Notes

see [CHANGELOG](./CHANGELOG.md)

-----------------------------------------------------------------------------------------------------------