Description
A language server is what makes it possible to rich editing like to go to definition or code completions. The Solang Solidity Language server is very
rudimentary. Once the language server is working, developing Solidity code will be a much nicer developer experience.
The Solang project already has a solidity parser (the same parser as is used by the compiler side) and a rudimentary language server. During this
mentorship you will learn how language servers work, and you'll need to walk the syntax tree in various ways to for example find where a variable is
defined (Go to definition), or to find all usages of a variable (Find all references), or find the type definition (Go to type definition).
Additional Information
Learning Objectives
Expected Outcome
Language server features to implement:
- Markdown formatting of hovers
Currently the formatting is in plain text and quite ugly. This can be improved.
- Do not require you to save the solidity file
The language server reads the file, rather than using the source code which is
sent to it over requests.
- Drop diagnostics when closing solidity file with errors
When closing a file in VS code, all the warnings and errors remain in the list
of problems. This should be fixed.
- Go to definition
- Go to declaration
- Go to implementation
- Go to type defintion
- Go to/find all references
- Format code (using forge-fmt)
The forge-fmt crate can already format Solidity code. This crate should be
imported and connected in the language server. Formatting has a few settings,
that can be added in extensions settings.
- Rename
Implement variable renaming. Using the same algorithm for find all references,
replace the text in the source code with the new name. This should be done
for variables, functions, and types.
- code completion
Given a location in the code, determine which names are possible. For example,
if the user has type `block.` then `time` and `height` are possible (amongst
others).
Relation to Hyperledger
This mentorship is for the Hyperledger Solang project.
Mentee Skills
Understanding of parsers and syntax tree
You will need to walk the syntax tree in various ways, so an understanding of this representation of source code is helpful.
Some expose to Rust and TypeScript
The project is mostly written in rust, with some glue code in typescript. As Rust is a fairly new language, we don't expect you to know it, any other language will do.
Mentee Open Source Contribution Experience
Future plans
Mentor(s) Names and Contact Info
Sean Young,
github: seanyoung
discord: seanyoung