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

Docs are missing info on how to enable inline errors(configure pyright) (at least in VSCode they are not automatic) #62

Open
8 tasks done
toinbis opened this issue Aug 31, 2021 · 3 comments
Labels
feature New feature or request

Comments

@toinbis
Copy link

toinbis commented Aug 31, 2021

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the SQLModel documentation, with the integrated search.
  • I already searched in Google "How to X in SQLModel" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to SQLModel but to Pydantic.
  • I already checked if it is not related to SQLModel but to SQLAlchemy.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

"""Main module"""
from typing import Optional

from sqlmodel import Field, SQLModel


class Hero(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: Optional[int] = None


hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name='Tom')

a = hero_1.name + 5

Description

https://github.com/tiangolo/sqlmodel/blob/main/docs/index.md#editor-support suggests that inline errors will be automatic. At least in VSCode, they are not. Docs need clarification on how to achieve this.

Wanted Solution

Docs should note that additional vscode config is needed to get inline errors.

Wanted Code

"python.analysis.diagnosticSeverityOverrides": {
        "reportGeneralTypeIssues": "information"
    }


### Alternatives

_No response_

### Operating System

macOS

### Operating System Details

_No response_

### SQLModel Version

0.0.4

### Python Version

3.9.0

### Additional Context

This is the default result you get using sqlmodel in vscode:
![Screenshot 2021-08-31 at 14 43 26](https://user-images.githubusercontent.com/68685/131496606-c6a5f232-af59-440c-920b-ab29b8057832.png) . And it's different from what the docs state.
@toinbis toinbis added the feature New feature or request label Aug 31, 2021
@toinbis
Copy link
Author

toinbis commented Aug 31, 2021

The issue ended up being missformated. Here is the screenshot that was expected to be attached:

Screenshot 2021-08-31 at 14 43 26

@faresbakhit
Copy link

Wouldn't it be better to just advice enabling all type checking errors at basic mode instead of reportGeneralTypeIssues only?

"python.analysis.typeCheckingMode": "basic"

In my experience, other type checking errors can be very helpful too.

@toinbis
Copy link
Author

toinbis commented Aug 31, 2021

@FaresAhmedb - sure, "reportGeneralTypeIssues": "information" was just the first setting that allowed me to replicate the behvaiour from screenshot presented in docs. My main point was that additional elaboration in when inline errors appear, probably customized for each and every IDE/editor. Which particular setting to advise using - I have no competence to advise :)

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

No branches or pull requests

2 participants