Skip to main content

Syntax Highlighting

When developing smart contracts for SolidCash it is useful to have the proper syntax highlighting in your code editor / IDE. If you use Visual Studio Code, there is a dedicated SolidCash extension. For other editors it is recommended to install a Solidity highlighting plugin and associate it with .scash files in your editor, since the syntaxes of the two languages are very similar.

For Visual Studio Code (and derived editors like Cursor) we have an official SolidCash extension. This extension works with .scash files and supports syntax highlighting, autocompletion, snippets and linting. Because of the first-class SolidCash support, Visual Studio Code with this SolidCash extension is the recommended way to develop SolidCash contracts.

To have the extension automatically suggested for any developer looking at your SolidCash contract in VScode, add the following configuration in a .vscode/extensions.json file:

~/.vscode/extensions.json
{
"recommendations": [
"cashscript.cashscript-vscode",
]
}

Cursor

Cursor and other VS Code forks can use the VS Code extension mentioned above. This extension should be findable in the extensions menu within the editor. If it is not, you can manually install it from the Open VSX Registry.

Sublime Text

The most popular Solidity plugin for Sublime Text 2/3 is Ethereum. Install this plugin with Package Control, open a .scash file and set Solidity as the syntax language in the Sublime menu bar:

View -> Syntax -> Open all with current extension as ... -> Solidity

This associates .scash files with Solidity, and enables syntax highlighting for your SolidCash files.

Atom

The most popular Solidity plugin for Atom is language-solidity. Install this plugin and add the following snippet to your Config file:

~/.atom/config.cson
core:
customFileTypes:
"source.solidity": ["scash"]

This associates .scash files with Solidity, and enables syntax highlighting for your SolidCash files.

Vim

The most popular Solidity plugin for Vim is vim-solidity. Install this plugin and add the following snippet to your .vimrc:

.vimrc
au BufRead,BufNewFile *.scash setfiletype solidity

This associates .scash files with Solidity, and enables syntax highlighting for your SolidCash files.

GitHub

GitHub has highlighting for Solidity built in. To associate .scash files with Solidity highlighting, add a .gitattributes file to your repository with the following contents:

.gitattributes
*.scash linguist-language=Solidity # GitHub

Unfortunately Gitlab does not have properly working Solidity highlighting through the gitattributes for now...

Others

If your editor is not mentioned above, the steps are likely very similar. Try to find a Solidity syntax highlighting plugin for your editor of choice and find a method to associate .scash files with this Solidity highlighting.