Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix autocompletions #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix autocompletions #228

wants to merge 1 commit into from

Conversation

s-cork
Copy link
Contributor

@s-cork s-cork commented Dec 3, 2024

close #201

Approach:

  • I wrote a script to do the replacement

before

  @anvil_prop
  def align(self, value):
    ...

  #!componentProp(m3.Button)!1: {name:"align",type:"enum",options:["left", "right", "center"],description:"The position of this component in the available space."}

after

  @anvil_prop
  @property
  def align(self, value) -> str:
    """The position of this component in the available space."""
    ...

  #!componentProp(m3.Button)!1: {name:"align",type:"enum",options:["left", "right", "center"],description:"The position of this component in the available space."}
  • I checked the autocompletions worked
  • I checked for the code still loaded by doing import m3.components as m3 in a client repl

Worth checking the change to _utils.properties
We only use anvil_prop as a decorator now

before

  show_label = anvil_prop("show_label")

after

  show_label = simple_prop("show_label")

This seems to be enough for the autocompleter to work as expected
while maintaining the existing helpers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocompletions
1 participant