Solidity support for Visual Studio code – 对visualstudio代码的稳定性支持区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Solidity support for Visual Studio code – 对visualstudio代码的稳定性支持区块链毕设代写 是一篇很好的国外资料

Solidity support for Visual Studio code

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持 Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持 Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持 Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Solidity is the language used in Ethereum to create smart contracts, this extension provides:

  • Syntax highlighting
  • Snippets
  • Compilation of the current contract (Press F1 Solidity : Compile Current Solidity Contract), or F5
  • Compilation of all the contracts (Press F1 Solidity : Compile all Solidity Contracts), or Ctrl+F5 / Cmd+F5
  • Code completion for all contracts / libraries in the current file and all referenced imports
  • Default project structure (solidity files needs to be in the ‘src’ directory, and libraries in the ‘lib’ directory). Libraries will follow the same structure.
  • Compilation supporting EIP82 (dappfile and dependency packages)
  • Support for different solidity versions (Remote and local)
  • Code generation using https://github.com/Nethereum/Nethereum, it includes currently the default template for Nethereum service, dtos generation. (Open ‘contractName.json’ after compilation from the bin folder. Press F1 and press Solidity: Code generate from compilation output..) Auto generation of Nethereun files on compilation
  • Linting using Solhint or Solium

Instructions

Using a different version of the solidity compiler

Sometimes you may want to use a different compiler than the one provided. You can find all the different versions in the solc-bin repository https://github.com/ethereum/solc-bin/tree/gh-pages/bin

Currently we support three ways supported to use a different version of the solidity compiler.

Remote download

When selecting remote download the compiler gets download from the solc-bin repository.

You will need to change the following user setting, with the version required, for example 'latest' or 'v0.4.3+commit.2353da71', for your workspace user setting (current project) or global user setting (all projects)

"solidity.compileUsingRemoteVersion" : "latest" 

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

You can simply change this setting using the context menu:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Using a Local file

If you don’t have an internet connection, you can download the compiler from https://github.com/ethereum/solc-bin/tree/gh-pages/bin and change your user settings to use this.

This setting takes prefernce over the remote installation.

"solidity.compileUsingLocalVersion" : "C:\Users\JuanFran\Downloads\soljson-v0.4.15%2Bcommit.bbb8e64f.js" 

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Npm / node installation

Another option, is to use the solc npm package in your project, if this setting is enabled it will try to find the compiler in your node_modules.

npm install solc  
"solidity.enableLocalNodeCompiler": false

Note: The above compilers, have an order of preference when using different settings are: Local node installation (Npm / node installation) will be used first, Local file second and finally remote.

If you are working on an specific project using an older version, you can use npm install locally to target that specefic version, without affecting the global setting.

But if you want to use the latest version of solidity for all the projects and have online connectivity all the time, use the setting:

"solidity.compileUsingRemoteVersion" : "latest"

In case one of your dependencies has a nested dependency on a solc version, effectively breaking the remote version setting from above, you have to disable the node compiler like so:

"solidity.enableLocalNodeCompiler": false

ERC, ERC drafts and Smart contracts snippets / reference

It is pretty hard sometimes to find interfaces or information about an EIP (ERC) or specific libraries to simply get started working with Solidity. The solidity extension now includes ERC approved and most drafts (wip) to help get you started.

Just type “`erc“ and select the erc example or interface you want.

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持 Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Smart contract project interfaces

In a similar to way to ERCs and as we work towards to more interoperable smart contracts, being able to quickly examine those interfaces that you want to integrate is a time saver.

The current release includes the interfaces for Uniswap V2 (to get started), just type “`uni“ to list them all. Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持 Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Note: If an ERC or your project is not included, please create a pull request. Note: Only established projets will be included.

Compiler optimization

Optimize for how many times you intend to run the code. Lower values will optimize more for initial deployment cost, higher values will optimize more for high-frequency usage. The default value is 200. "solidity.compilerOptimization": 200

Project structure

OpenZeppelin (Default)

If you’re using @openzeppelin/contracts, the OpenZeppelin Contracts will be found in your node_modules folder, so the user settings will be the following, assuming your solidity project is at root.

  "solidity.packageDefaultDependenciesContractsDirectory": "",   "solidity.packageDefaultDependenciesDirectory": "node_modules" 

If you have a deeper structure, like

Solution └───solidity_project │   │ |   │   xx.sol │   └───node_modules │    └───Nethereum_Project |   │   xx.cs |   │   yy.cs | └───Web3Js_Project |   │   xx.js |   │   yy.js 

Your user settings configuration will need to represent the full structure:

  "solidity.packageDefaultDependenciesContractsDirectory": "",   "solidity.packageDefaultDependenciesDirectory": "solidity_project/node_modules" 

Dappsys (old ERC)

The project / library dependency structure can use the DappSys library model, this was the default mode before as it was part of an ERC:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Libraries will have the same name as their folder they are included. Solidity files will be in the ‘src’ folder. Libraries will be included in the ‘lib’ folder.

Currently there is no name conflicting resolution, so the first library found matching a name, will be the first one used.

The user settings for this structure is:

  "solidity.packageDefaultDependenciesContractsDirectory": "src",   "solidity.packageDefaultDependenciesDirectory": "lib" 

Code completion

Just press Ctrl + Space or Command + Space to autocomplete statements, currently supported all the storage variables, functions and events (with snippets) included in the current document and every document in the import chain. Also supported all the global variables, global functions, types and units.

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Auto compilation and error highlighting

Auto compilation of files and error highlighting can be enabled or disabled using user settings. Also a default delay is implemented for all the validations (compilation and linting) as solidity compilation can be slow when you have many dependencies.

"solidity.enabledAsYouTypeCompilationErrorCheck": true, "solidity.validationDelay": 1500 

Linting

There are two linters included with the extension, solhint and solium / ethlint. You can chose your preferred linter using this setting, or disable it by typing ”

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Solhint

To lint Solidity code you can use the Solhint linter https://github.com/protofire/solhint, the linter can be configured it using the following user settings:

"solidity.linter": "solhint", "solidity.solhintRules": {   "avoid-sha3": "warn" }

This extension supports .solhint.json configuration file. It must be placed to project root directory. After any changes in .solhint.json it will be synchronized with current IDE configuration.

This is the default linter now.

NOTE: Solhint plugins are not supported yet.

Solium / Ethlint

Solium is also supported by the extension https://github.com/duaraghav8/Solium, you can configure it using the following user settings:

"solidity.linter": "solium", "solidity.soliumRules": {     "quotes": ["error", "double"],     "indentation": ["error", 4] },

Formatting using Prettier and the Prettier Solidity Plugin

Formatting is provided thanks to the Prettier plugin for Solidity for more info check https://prettier.io/ and https://github.com/prettier-solidity/prettier-plugin-solidity

Formatting uses the default formatting settings provided by prettier, if you want to provide your custom settings create a .prettierrc file as follows

{   "overrides": [     {       "files": "*.sol",       "options": {         "printWidth": 80,         "tabWidth": 4,         "useTabs": true,         "singleQuote": false,         "bracketSpacing": true,         "explicitTypes": "always"       }     }   ] }

If you would like to format on save, add this entry to your user / workspace settings:

"editor.formatOnSave": true

Code generation Nethereum

The extension integrates with the Nethereum code generator to create Contract integration definitions. You can either generate the api for a single contract, all compiled contracts, or automatically every time you compile a smart contract solidity file.

The simplest way to code generate a the contract definition for a smart contract is to right click and select the project / language you require:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Automatic code generation and the Nethereum Code generation settings file.

If you want to automatically code generate your api, every time to you compile, you can do this creating a file “nethereum-gen.settings” at the root of your project, with the following contents. You can create it automatically using the context menu too.

{     "projectName": "Solidity.Samples",     "namespace": "Solidity.Samples",     "lang":0,     "autoCodeGen":true,     "projectPath": "../SoliditySamples" }

“lang” indicates what language to generate the code, 0 = CSharp, 1 = Vb.Net and 3 = FSharp

The “projectName” and “namespace” settings will be used for the manual code generation also.

Use the “projectPath” to set the relative path of your .Net project, this allows to work in a “solution” mode so you can work as an both in Visual Studio Code and Visual Studio (Fat) with your .Net project, or two windows of vscode.

Abi contract code generation

You may have only the abi of a smart contract and want to code generate the contract definition. Just create a file containing the abi, with the extension .abi and another with the .bin content (if needed) and use this context menu.

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Single smart contract manual code generation

To code generate the Nethereum contract api from a single smart contract, you need to select the compiled “json” output file from the “bin” folder, press F1 and start typing “Solidity: Code generate” and select what language you want to generate for the current selected file.

All smart contracts manual code generation

To code generate the Nethereum contract for all smart contracts already compiled, just press F1, and start typing “Solidity: Code generate” and select the option for all contracts for your desired language.

(Depricated) Analysis of smart contracts with Mythx

Mythx analysis tool, has been moved to its own stand alone extension, please download it here.

Contributing / Issues / Requests

For ideas, issues, additions, modifications please raise an issue or a pull request at https://github.com/juanfranblanco/vscode-solidity/ and send a message on gitter at https://gitter.im/vscode-solidity/Lobby or https://gitter.im/Nethereum/Nethereum to get an instant notification.

Credits

Many thanks to:

Christian Reitwiessner and the Ethereum team for Solidity https://github.com/ethereum/solidity

Raghav Dua and everyone that contributed to Solium, the solidity linter, and the solidity parser.

Ilya Drabenia for creating the Solhint linter and the integration into the extension.

Nexus team for the original creation of the dappfile to structure contracts in projects https://github.com/nexusdev/dapple.

Beau Gunderson for contributing the initial integration of solium https://github.com/juanfranblanco/vscode-solidity/issues/24, the initial server and error mappings.

Mattia Richetto, Klaus Hott Vidal and Franco Victorio for creating the Prettier Solidity plugin and of course all the developers of Prettier. Please go to https://github.com/prettier-solidity/prettier-plugin-solidity for help and collaboration.

Bram Hoven for starting the multiple package dependency support for different environments (node_modules, lib)

Piotr Szlachciak for refactoring the syntaxes

Forest Fang for providing the implementation of the “Go to definition”, allowing you to navigate to structs, contracts, functions calls, etc

Bernardo Vieira for adding the capability to read the solium settings from a file in the workspace root directory.

Mirko Garozzo and Rocky Bernstein for the work on creating and integrating the Mythx api to analyse smart contracts.

Nick Addison, Elazar Gershuni, Joe Whittles, Iñigo Villalba, Thien Toan, Jonathan Carter, Stefan Lew, Nikita Savchenko, Josh Stevens, Paul Berg for their contributions.

Sebastian Bürgel for keeping reminding me of the offline installation suppport

David Krmpotic and Ralph Pichler for the original Sublime extension https://github.com/davidhq/SublimeEthereum

Everyone for their support and feedback!

Added experimental solparse to fix abstrace, receive and fallback. En…


Solidity support for Visual Studio code

<Solidity support for Visual Studio code><Solidity support for Visual Studio code><Solidity support for Visual Studio code><Solidity support for Visual Studio code><Solidity support for Visual Studio code><Solidity support for Visual Studio code><Solidity support for Visual Studio code>

Solidity是以太坊eth中用于创建智能合约的语言,此扩展提供:

有时您可能希望使用与所提供的编译器不同的编译器。您可以在solc-bin存储库中找到所有不同的版本https://github.com/ethereum/solc-bin/tree/gh-pages/bin

目前,我们支持三种使用不同版本solidity编译器的方法。

选择“远程下载”时,编译器将从solc bin存储库下载。

您需要根据所需版本更改以下用户设置,例如“latest”或“v0.4.3+commit.2353da71”,对于工作区用户设置(当前项目)或全局用户设置(所有项目)

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

您只需使用上下文菜单更改此设置:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

<Solidity support for Visual Studio code>

如果您没有internet连接,你可以从编译器下载https://github.com/ethereum/solc-bin/tree/gh-pages/bin并更改用户设置以使用此设置。

此设置优先于远程安装。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

另一个选项是在项目中使用solc npm包,如果启用此设置,它将尝试在节点模块中查找编译器。

注意:在使用不同设置时,以上编译器的优先顺序是:首先使用本地节点安装(Npm/node安装),然后使用本地文件,最后使用远程。

如果您正在使用旧版本处理特定项目,则可以使用本地npm install来针对该特定版本,而不影响全局设置。

但是,如果您想在所有项目中使用最新版本的solidity并一直保持在线连接,请使用该设置:

如果您的某个依赖项与solc版本有嵌套依赖关系,则从上面有效地打破了远程版本设置,您必须像这样禁用节点编译器:

有时很难找到有关EIP(ERC)或特定库的接口或信息,以便开始使用Solidity。solidity扩展现在包括ERC批准和大多数草稿(wip),以帮助您开始。

只需键入“erc”,然后选择所需的erc示例或接口。

<Solidity support for Visual Studio code><Solidity support for Visual Studio code>Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

以与ERC类似的方式,随着我们朝着更具互操作性的智能合约的方向努力,能够快速检查您想要集成的接口是一种节省时间的方法。

当前版本包含Uniswap V2的接口(入门),只需键入“uni”即可列出所有接口。Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

注意:如果不包括ERC或您的项目,请创建拉取请求。注:只包括已建立的项目。

优化要运行代码的次数。较低的值将优化更多的初始部署成本,较高的值将优化更多的高频使用。默认值为200。“solidity.compilerOptimization公司“:200

如果您使用@openzeppelin/contracts,openzeppelin合同将在node_modules文件夹中找到,因此用户设置如下,假设solidity项目位于根目录下。

如果您有更深层的结构,例如

您的用户设置配置将需要表示完整的结构:

项目/库依赖关系结构可以使用DappSys库模型,这是以前的默认模式,因为它是ERC的一部分:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

库将具有与包含它们的文件夹同名。Solidity文件将位于“src”文件夹中。库将包含在“lib”文件夹中。

当前没有名称冲突解决方案,因此找到的第一个与名称匹配的库将是第一个使用的库。

此结构的用户设置是:

只需按Ctrl+Space或Command+Space即可自动完成语句,当前支持当前文档和导入链中每个文档中包含的所有存储变量、函数和事件(带代码段)。还支持所有全局变量、全局函数、类型和单位。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

可以使用用户设置启用或禁用文件自动编译和错误突出显示。此外,所有验证(编译和linting)都实现了默认延迟,因为当您有许多依赖项时,solidity编译可能会很慢。

扩展名中包含两个linter,solhint和solium/ethlint。您可以使用此设置选择您的首选过梁,或通过键入“

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

将其禁用。您可以使用Solhint linterhttps://github.com/protofire/solhint, 可以使用以下用户设置对linter进行配置:

此扩展支持。solhint.json文件配置文件。它必须放在项目根目录下。在发生任何变化后。solhint.json文件它将与当前IDE配置同步。

现在这是默认的皮棉。

注意:尚不支持Solhint插件。

Solium也受到扩展的支持https://github.com/duaraghav8/Solium请使用下面的插件进行设置https://prettier.io/以及https://github.com/prettier-solidity/prettier-plugin-solidity

如果要在保存时格式化,将此项添加到您的用户/工作区设置:

“编辑器.formatOnSave“:true

扩展与Nethereum代码生成器集成,以创建合同集成定义。你可以为每一次编译一个完整的合同,或者自动生成一个合同。

要为智能合约生成合约定义,最简单的方法是右键单击并选择所需的项目/语言:

<Solidity support for Visual Studio code>

如果要自动生成api代码,每次编译时,都可以创建一个文件“nethereum”-发电机设置“在根上包含以下内容。您也可以使用上下文菜单自动创建它。

“lang”表示生成代码的语言,0=CSharp,1=Vb.Net和3=FSharp

“projectName”和“namespace”设置也将用于手动代码生成。

使用“projectPath”来设置.Net项目的相对路径,这样就可以在“解决方案”模式下工作,这样您就可以同时在Visual Studio代码和Visual Studio(Fat)中使用.Net项目或两个vscode窗口。

您可能只有智能合约的abi,并且希望代码生成合约定义。只需创建一个包含abi的文件,扩展名为.abi,另一个扩展名为.bin(如果需要),然后使用这个上下文菜单。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

要从单个智能合约生成Nethereum合约api,您需要从“bin”文件夹中选择已编译的“json”输出文件,按F1并开始键入“Solidity:code generate”,然后选择要为当前所选文件生成的语言。为“已编译的合同”选择“生成所有合同代码”选项。

Mythx分析工具,已经被移动到它自己的独立扩展,请下载到这里。

有关想法、问题、补充和修改,请在以下地址提出问题或请求:https://github.com/juanfranblanco/vscode-solidity/在gitter上发个信息https://gitter.im/vscode-solidity/Lobby或者https://gitter.im/Nethereum/Nethereum得到即时通知。

多亏了:

克里斯蒂安·雷特维斯纳和以太坊eth团队https://github.com/ethereum/solidity

Raghav Dua和所有为Solium、solidity linter和solidity解析器做出贡献的人。

Ilya Drabenia,用于创建Solhint linter并将其集成到扩展中。

Nexus团队负责最初创建dappfile以构建项目中的合同https://github.com/nexusdev/dapple。

Beau Gunderson为solium的初始整合做出了贡献https://github.com/juanfranblanco/vscode-solidity/issues/24,初始服务器和错误映射。

Mattia Richetto,Klaus Hott Vidal和Franco Victorio为创建更漂亮的Solidity插件,当然还有Prettier的所有开发者。请转到https://github.com/prettier-solidity/prettier-plugin-solidity寻求帮助和合作。

Bram Hoven启动对不同环境的多包依赖性支持(node_modules,lib)

Piotr Szlacchiak用于重构语法

Forest Fang,提供“转到定义”的实现,允许您导航到结构、协定、函数调用,etc

Bernardo Vieira添加了从工作区根目录中的文件读取solium设置的功能。

Mirko Garozzo和Rocky Bernstein在创建和集成Mythx api以分析智能合约方面的工作。

Nick Addison、Elazar Gershuni、Joe Whittles、Iñigo Villalba、Thien Toan、Jonathan Carter、Stefan Lew、Nikita Savchenko、Josh Stevens、Paul Berg感谢他们的贡献。

Sebastian Bürgel不断提醒我离线安装支持

Solidity是以太坊eth中用于创建智能合约的语言,此扩展提供:

  • Syntax highlighting
  • Snippets
  • Compilation of the current contract (Press F1 Solidity : Compile Current Solidity Contract), or F5
  • Compilation of all the contracts (Press F1 Solidity : Compile all Solidity Contracts), or Ctrl+F5 / Cmd+F5
  • Code completion for all contracts / libraries in the current file and all referenced imports
  • Default project structure (solidity files needs to be in the ‘src’ directory, and libraries in the ‘lib’ directory). Libraries will follow the same structure.
  • Compilation supporting EIP82 (dappfile and dependency packages)
  • Support for different solidity versions (Remote and local)
  • Code generation using https://github.com/Nethereum/Nethereum, it includes currently the default template for Nethereum service, dtos generation. (Open ‘contractName.json’ after compilation from the bin folder. Press F1 and press Solidity: Code generate from compilation output..) Auto generation of Nethereun files on compilation
  • Linting using Solhint or Solium

Instructions

Using a different version of the solidity compiler

有时您可能希望使用与所提供的编译器不同的编译器。您可以在solc-bin存储库中找到所有不同的版本https://github.com/ethereum/solc-bin/tree/gh-pages/bin

目前,我们支持三种使用不同版本solidity编译器的方法。

Remote download

选择“远程下载”时,编译器将从solc bin存储库下载。

您需要根据所需版本更改以下用户设置,例如“latest”或“v0.4.3+commit.2353da71”,对于工作区用户设置(当前项目)或全局用户设置(所有项目)

"solidity.compileUsingRemoteVersion" : "latest" 

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

您只需使用上下文菜单更改此设置:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

<Solidity support for Visual Studio code>

Using a Local file

如果您没有internet连接,你可以从编译器下载https://github.com/ethereum/solc-bin/tree/gh-pages/bin并更改用户设置以使用此设置。

此设置优先于远程安装。

"solidity.compileUsingLocalVersion" : "C:\Users\JuanFran\Downloads\soljson-v0.4.15%2Bcommit.bbb8e64f.js" 

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Npm / node installation

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

npm install solc  
"solidity.enableLocalNodeCompiler": false

另一个选项是在项目中使用solc npm包,如果启用此设置,它将尝试在节点模块中查找编译器。

注意:在使用不同设置时,以上编译器的优先顺序是:首先使用本地节点安装(Npm/node安装),然后使用本地文件,最后使用远程。

如果您正在使用旧版本处理特定项目,则可以使用本地npm install来针对该特定版本,而不影响全局设置。

"solidity.compileUsingRemoteVersion" : "latest"

但是,如果您想在所有项目中使用最新版本的solidity并一直保持在线连接,请使用该设置:

"solidity.enableLocalNodeCompiler": false

ERC, ERC drafts and Smart contracts snippets / reference

如果您的某个依赖项与solc版本有嵌套依赖关系,则从上面有效地打破了远程版本设置,您必须像这样禁用节点编译器:

有时很难找到有关EIP(ERC)或特定库的接口或信息,以便开始使用Solidity。solidity扩展现在包括ERC批准和大多数草稿(wip),以帮助您开始。

只需键入“erc”,然后选择所需的erc示例或接口。

Smart contract project interfaces

In a similar to way to ERCs and as we work towards to more interoperable smart contracts, being able to quickly examine those interfaces that you want to integrate is a time saver.

<Solidity support for Visual Studio code><Solidity support for Visual Studio code>Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

以与ERC类似的方式,随着我们朝着更具互操作性的智能合约的方向努力,能够快速检查您想要集成的接口是一种节省时间的方法。

当前版本包含Uniswap V2的接口(入门),只需键入“uni”即可列出所有接口。Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

注意:如果不包括ERC或您的项目,请创建拉取请求。注:只包括已建立的项目。

优化要运行代码的次数。较低的值将优化更多的初始部署成本,较高的值将优化更多的高频使用。默认值为200。“solidity.compilerOptimization公司“:200

如果您使用@openzeppelin/contracts,openzeppelin合同将在node_modules文件夹中找到,因此用户设置如下,假设solidity项目位于根目录下。

如果您有更深层的结构,例如

您的用户设置配置将需要表示完整的结构:

项目/库依赖关系结构可以使用DappSys库模型,这是以前的默认模式,因为它是ERC的一部分:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

库将具有与包含它们的文件夹同名。Solidity文件将位于“src”文件夹中。库将包含在“lib”文件夹中。

当前没有名称冲突解决方案,因此找到的第一个与名称匹配的库将是第一个使用的库。

此结构的用户设置是:

只需按Ctrl+Space或Command+Space即可自动完成语句,当前支持当前文档和导入链中每个文档中包含的所有存储变量、函数和事件(带代码段)。还支持所有全局变量、全局函数、类型和单位。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

可以使用用户设置启用或禁用文件自动编译和错误突出显示。此外,所有验证(编译和linting)都实现了默认延迟,因为当您有许多依赖项时,solidity编译可能会很慢。

扩展名中包含两个linter,solhint和solium/ethlint。您可以使用此设置选择您的首选过梁,或通过键入“

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

将其禁用。您可以使用Solhint linterhttps://github.com/protofire/solhint, 可以使用以下用户设置对linter进行配置:

此扩展支持。solhint.json文件配置文件。它必须放在项目根目录下。在发生任何变化后。solhint.json文件它将与当前IDE配置同步。

现在这是默认的皮棉。

注意:尚不支持Solhint插件。

Solium也受到扩展的支持https://github.com/duaraghav8/Solium请使用下面的插件进行设置https://prettier.io/以及https://github.com/prettier-solidity/prettier-plugin-solidity

如果要在保存时格式化,将此项添加到您的用户/工作区设置:

“编辑器.formatOnSave“:true

扩展与Nethereum代码生成器集成,以创建合同集成定义。你可以为每一次编译一个完整的合同,或者自动生成一个合同。

要为智能合约生成合约定义,最简单的方法是右键单击并选择所需的项目/语言:

<Solidity support for Visual Studio code>

如果要自动生成api代码,每次编译时,都可以创建一个文件“nethereum”-发电机设置“在根上包含以下内容。您也可以使用上下文菜单自动创建它。

“lang”表示生成代码的语言,0=CSharp,1=Vb.Net和3=FSharp

“projectName”和“namespace”设置也将用于手动代码生成。

使用“projectPath”来设置.Net项目的相对路径,这样就可以在“解决方案”模式下工作,这样您就可以同时在Visual Studio代码和Visual Studio(Fat)中使用.Net项目或两个vscode窗口。

您可能只有智能合约的abi,并且希望代码生成合约定义。只需创建一个包含abi的文件,扩展名为.abi,另一个扩展名为.bin(如果需要),然后使用这个上下文菜单。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

要从单个智能合约生成Nethereum合约api,您需要从“bin”文件夹中选择已编译的“json”输出文件,按F1并开始键入“Solidity:code generate”,然后选择要为当前所选文件生成的语言。为“已编译的合同”选择“生成所有合同代码”选项。

Mythx分析工具,已经被移动到它自己的独立扩展,请下载到这里。

有关想法、问题、补充和修改,请在以下地址提出问题或请求:https://github.com/juanfranblanco/vscode-solidity/在gitter上发个信息https://gitter.im/vscode-solidity/Lobby或者https://gitter.im/Nethereum/Nethereum得到即时通知。

多亏了:

克里斯蒂安·雷特维斯纳和以太坊eth团队https://github.com/ethereum/solidity

Raghav Dua和所有为Solium、solidity linter和solidity解析器做出贡献的人。

Ilya Drabenia,用于创建Solhint linter并将其集成到扩展中。

Nexus团队负责最初创建dappfile以构建项目中的合同https://github.com/nexusdev/dapple。

Beau Gunderson为solium的初始整合做出了贡献https://github.com/juanfranblanco/vscode-solidity/issues/24,初始服务器和错误映射。

Mattia Richetto,Klaus Hott Vidal和Franco Victorio为创建更漂亮的Solidity插件,当然还有Prettier的所有开发者。请转到https://github.com/prettier-solidity/prettier-plugin-solidity寻求帮助和合作。

Bram Hoven启动对不同环境的多包依赖性支持(node_modules,lib)

Piotr Szlacchiak用于重构语法

Forest Fang,提供“转到定义”的实现,允许您导航到结构、协定、函数调用,etc

Bernardo Vieira添加了从工作区根目录中的文件读取solium设置的功能。

Mirko Garozzo和Rocky Bernstein在创建和集成Mythx api以分析智能合约方面的工作。

Nick Addison、Elazar Gershuni、Joe Whittles、Iñigo Villalba、Thien Toan、Jonathan Carter、Stefan Lew、Nikita Savchenko、Josh Stevens、Paul Berg感谢他们的贡献。

Sebastian Bürgel不断提醒我离线安装支持

以与ERC类似的方式,随着我们朝着更具互操作性的智能合约的方向努力,能够快速检查您想要集成的接口是一种节省时间的方法。

Compiler optimization

当前版本包含Uniswap V2的接口(入门),只需键入“uni”即可列出所有接口。Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Project structure

OpenZeppelin (Default)

注意:如果不包括ERC或您的项目,请创建拉取请求。注:只包括已建立的项目。

  "solidity.packageDefaultDependenciesContractsDirectory": "",   "solidity.packageDefaultDependenciesDirectory": "node_modules" 

优化要运行代码的次数。较低的值将优化更多的初始部署成本,较高的值将优化更多的高频使用。默认值为200。“solidity.compilerOptimization公司“:200

Solution └───solidity_project │   │ |   │   xx.sol │   └───node_modules │    └───Nethereum_Project |   │   xx.cs |   │   yy.cs | └───Web3Js_Project |   │   xx.js |   │   yy.js 

如果您使用@openzeppelin/contracts,openzeppelin合同将在node_modules文件夹中找到,因此用户设置如下,假设solidity项目位于根目录下。

  "solidity.packageDefaultDependenciesContractsDirectory": "",   "solidity.packageDefaultDependenciesDirectory": "solidity_project/node_modules" 

Dappsys (old ERC)

如果您有更深层的结构,例如

您的用户设置配置将需要表示完整的结构:

项目/库依赖关系结构可以使用DappSys库模型,这是以前的默认模式,因为它是ERC的一部分:

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

库将具有与包含它们的文件夹同名。Solidity文件将位于“src”文件夹中。库将包含在“lib”文件夹中。

  "solidity.packageDefaultDependenciesContractsDirectory": "src",   "solidity.packageDefaultDependenciesDirectory": "lib" 

Code completion

当前没有名称冲突解决方案,因此找到的第一个与名称匹配的库将是第一个使用的库。

此结构的用户设置是:

Auto compilation and error highlighting

只需按Ctrl+Space或Command+Space即可自动完成语句,当前支持当前文档和导入链中每个文档中包含的所有存储变量、函数和事件(带代码段)。还支持所有全局变量、全局函数、类型和单位。

"solidity.enabledAsYouTypeCompilationErrorCheck": true, "solidity.validationDelay": 1500 

Linting

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

可以使用用户设置启用或禁用文件自动编译和错误突出显示。此外,所有验证(编译和linting)都实现了默认延迟,因为当您有许多依赖项时,solidity编译可能会很慢。

Solhint

扩展名中包含两个linter,solhint和solium/ethlint。您可以使用此设置选择您的首选过梁,或通过键入“

"solidity.linter": "solhint", "solidity.solhintRules": {   "avoid-sha3": "warn" }

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

将其禁用。您可以使用Solhint linterhttps://github.com/protofire/solhint, 可以使用以下用户设置对linter进行配置:

此扩展支持。solhint.json文件配置文件。它必须放在项目根目录下。在发生任何变化后。solhint.json文件它将与当前IDE配置同步。

Solium / Ethlint

现在这是默认的皮棉。

"solidity.linter": "solium", "solidity.soliumRules": {     "quotes": ["error", "double"],     "indentation": ["error", 4] },

Formatting using Prettier and the Prettier Solidity Plugin

注意:尚不支持Solhint插件。

Solium也受到扩展的支持https://github.com/duaraghav8/Solium请使用下面的插件进行设置https://prettier.io/以及https://github.com/prettier-solidity/prettier-plugin-solidity

{   "overrides": [     {       "files": "*.sol",       "options": {         "printWidth": 80,         "tabWidth": 4,         "useTabs": true,         "singleQuote": false,         "bracketSpacing": true,         "explicitTypes": "always"       }     }   ] }

如果要在保存时格式化,将此项添加到您的用户/工作区设置:

“编辑器.formatOnSave“:true

Code generation Nethereum

扩展与Nethereum代码生成器集成,以创建合同集成定义。你可以为每一次编译一个完整的合同,或者自动生成一个合同。

要为智能合约生成合约定义,最简单的方法是右键单击并选择所需的项目/语言:

<Solidity support for Visual Studio code>

Automatic code generation and the Nethereum Code generation settings file.

如果要自动生成api代码,每次编译时,都可以创建一个文件“nethereum”-发电机设置“在根上包含以下内容。您也可以使用上下文菜单自动创建它。

{     "projectName": "Solidity.Samples",     "namespace": "Solidity.Samples",     "lang":0,     "autoCodeGen":true,     "projectPath": "../SoliditySamples" }

“lang”表示生成代码的语言,0=CSharp,1=Vb.Net和3=FSharp

“projectName”和“namespace”设置也将用于手动代码生成。

使用“projectPath”来设置.Net项目的相对路径,这样就可以在“解决方案”模式下工作,这样您就可以同时在Visual Studio代码和Visual Studio(Fat)中使用.Net项目或两个vscode窗口。

Abi contract code generation

您可能只有智能合约的abi,并且希望代码生成合约定义。只需创建一个包含abi的文件,扩展名为.abi,另一个扩展名为.bin(如果需要),然后使用这个上下文菜单。

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

Single smart contract manual code generation

Solidity support for Visual Studio code - 对visualstudio代码的稳定性支持

All smart contracts manual code generation

要从单个智能合约生成Nethereum合约api,您需要从“bin”文件夹中选择已编译的“json”输出文件,按F1并开始键入“Solidity:code generate”,然后选择要为当前所选文件生成的语言。为“已编译的合同”选择“生成所有合同代码”选项。

(Depricated) Analysis of smart contracts with Mythx

Mythx分析工具,已经被移动到它自己的独立扩展,请下载到这里。

Contributing / Issues / Requests

有关想法、问题、补充和修改,请在以下地址提出问题或请求:https://github.com/juanfranblanco/vscode-solidity/在gitter上发个信息https://gitter.im/vscode-solidity/Lobby或者https://gitter.im/Nethereum/Nethereum得到即时通知。

Credits

多亏了:

克里斯蒂安·雷特维斯纳和以太坊eth团队https://github.com/ethereum/solidity

Raghav Dua和所有为Solium、solidity linter和solidity解析器做出贡献的人。

Ilya Drabenia,用于创建Solhint linter并将其集成到扩展中。

Nexus团队负责最初创建dappfile以构建项目中的合同https://github.com/nexusdev/dapple。

Beau Gunderson为solium的初始整合做出了贡献https://github.com/juanfranblanco/vscode-solidity/issues/24,初始服务器和错误映射。

Mattia Richetto,Klaus Hott Vidal和Franco Victorio为创建更漂亮的Solidity插件,当然还有Prettier的所有开发者。请转到https://github.com/prettier-solidity/prettier-plugin-solidity寻求帮助和合作。

Bram Hoven启动对不同环境的多包依赖性支持(node_modules,lib)

Piotr Szlacchiak用于重构语法

Forest Fang,提供“转到定义”的实现,允许您导航到结构、协定、函数调用,etc

Bernardo Vieira添加了从工作区根目录中的文件读取solium设置的功能。

Mirko Garozzo和Rocky Bernstein在创建和集成Mythx api以分析智能合约方面的工作。

Nick Addison、Elazar Gershuni、Joe Whittles、Iñigo Villalba、Thien Toan、Jonathan Carter、Stefan Lew、Nikita Savchenko、Josh Stevens、Paul Berg感谢他们的贡献。

Sebastian Bürgel不断提醒我离线安装支持

David Krmpotic and Ralph Pichler for the original Sublime extension https://github.com/davidhq/SublimeEthereum

Everyone for their support and feedback!

Added experimental solparse to fix abstrace, receive and fallback. En…

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/19319.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Solidity support for Visual Studio code – 对visualstudio代码的稳定性支持区块链毕设代写

提供最优质的资源集合

立即查看 了解详情