Skip to content

Intellisense not available for flask-sqlalchemy #4027

Closed

Description

Environment data

  • VS Code version: 1.30.2
  • Extension version (available under the Extensions sidebar): 2018.12.1
  • OS and version: macOS High Sierra 10.13.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: flask-sqlalchemy

Expected behaviour

Show intellisense option for Column

Actual behaviour

image

Steps to reproduce:

# services/users/project/__init__.py


import os
from flask import Flask, jsonify
from flask_sqlalchemy import SQLAlchemy


# instantiate the app
app = Flask(__name__)

# set config
app_settings = os.getenv('APP_SETTINGS')
app.config.from_object(app_settings)

# instantiate the db
db = SQLAlchemy(app)


# model
class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    fullname = db.Column(db.String(80))

User Settings

{
    "editor.renderWhitespace": "all",
    "files.associations": {
        "*.txt": "tsv"
    },
    "editor.renderControlCharacters": false,
    "workbench.startupEditor": "newUntitledFile",
    "explorer.confirmDragAndDrop": false,
    "python.venvPath": "~/.virtualenvs",
    "python.jediEnabled": false,
    "git.autofetch": true,
    "git.confirmSync": false
}

Workspace Settings

{
    "python.pythonPath": "/Users/nick.perkins/.virtualenvs/testdriven-app/bin/python",
    "python.linting.pylintArgs": ["--load-plugins", "pylint_flask"]
}

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
Microsoft Python Language Server version 0.1.75.0
Initializing for /Users/nick.perkins/.virtualenvs/testdriven-app/bin/python
Reloading modules... 
Reloading modules... 
done.
done.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)


Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Jan 17, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 17, 2019
  3. DonJayamanne commented on Feb 4, 2019

    @DonJayamanne

    Show intellisense option for Column

    Please could you be more specific about this.
    Looking at the screen samples, i can see you have intellisense.
    Please provide screen samples for where you would like intellisense to appear and isn't already.

  4. added
    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.
    info-neededIssue requires more information from poster
    on Feb 4, 2019
  5. changed the title [-]Intellisense not available for sqlalchemy[/-] [+]Intellisense not available for flask-sqlalchemy[/+] on Feb 6, 2019
  6. nickperkins commented on Feb 6, 2019

    @nickperkins
    Author

    Don Jayamanne (@DonJayamanne) As per the screenshot, Column method of db is not included as part of the intellisense drop down. This is also the case for db.Integer, #db.String, etc. This was first raised on #292 which got derailed to talk about linters.

  7. Plazmius commented on Feb 7, 2019

    @Plazmius

    I faced a similar issue. My first guess is that it is because attributes of class SQLAlchemy are initialized by setattr function (https://github.com/pallets/flask-sqlalchemy/blob/master/flask_sqlalchemy/__init__.py#L78-L81)

        for module in sqlalchemy, sqlalchemy.orm:
            for key in module.__all__:
                if not hasattr(obj, key):
                    setattr(obj, key, getattr(module, key))
    

    For example, Model is available:
    image
    However, Column is not:
    image

  8. milzer commented on Feb 15, 2019

    @milzer

    I faced the same issue on mac and decided to try out in Visual Studio 2017 on Windows. Same issue is present there so ArtemMelnychenko (@Plazmius) is probably right.

  9. ghost removed
    info-neededIssue requires more information from poster
    on Feb 19, 2019
  10. ghost removed on Feb 19, 2019
  11. locked as resolved and limited conversation to collaborators on Mar 19, 2019
  12. bschnurr commented on Dec 28, 2022

    @bschnurr
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions