ericglau / cairo-ls

Cairo Language Server

Home Page:https://marketplace.visualstudio.com/items?itemName=ericglau.cairo-ls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a way to auto-generate `@external` contract functions

ericglau opened this issue · comments

According to the extensibility pattern, libraries must implement external functions under a namespace, and the external function name must not start with an underscore.

The pattern also states that contracts should implement @external functions if needed.

For some external library functions, it is reasonable that contracts always implement them. For example, Ownable.owner() is one such function.

User stories:

  1. As a contract developer, I want to be notified if I forgot to expose some external library functions, so that my users will not have missing functionality.
  2. As a contract developer, I want to be able to automatically generate @external functions from external library functions, so that I don't need to manually create them.

Proposed solution:
Provide a way to automate the generation of these functions. This could be in the form of code completions or quick fixes (perhaps with info-level diagnostic highlighting if some external library functions were not exposed).