custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
849 stars 45 forks source link

PyRight LSP #598

Open Hugo-Persson opened 4 months ago

Hugo-Persson commented 4 months ago

Foremost, I love this project. Really great work!

Is there any way to make pyright recognize the variables provided? I currently get a lot of annoying errors from my LSP. It would be really nice to not get errors and get completions.

For example:

image
ALERTua commented 4 months ago

Here's the cure for you: https://github.com/dmamelin/pyscript_autocomplete

Hugo-Persson commented 4 months ago

Thank you, I am going to try this!

Hugo-Persson commented 4 months ago

@ALERTua what is meant by this step? Copy the apps/pyscript_autocomplete folder to your PyScript directory.

Where is the apps folder?

ALERTua commented 4 months ago

apps = /config/pyscript/apps

Hugo-Persson commented 4 months ago

@ALERTua I do not have this folder, I only have my scripts under config/pyscript/

My config looks like this:

pyscript:
  allow_all_imports: true
  hass_is_global: true
  apps:
    pyscript_autocomplete:
ALERTua commented 4 months ago

then create it.

Hugo-Persson commented 4 months ago

But what should be copied:

Copy the apps/pyscript_autocomplete folder to your PyScript directory.
Hugo-Persson commented 4 months ago

I also do not have the service pyscript.autocomplete_generator service.

Hugo-Persson commented 4 months ago

Omg I am stupid, the files are in the repo