Repository navigation
Intellisense not available for flask-sqlalchemy #4027
Copy link
Copy link
Closed
Labels
area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.
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
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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.

Activity
DonJayamanne commentedon Feb 4, 2019
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.
[-]Intellisense not available for sqlalchemy[/-][+]Intellisense not available for flask-sqlalchemy[/+]nickperkins commentedon Feb 6, 2019
Don Jayamanne (@DonJayamanne) As per the screenshot,
Columnmethod of db is not included as part of the intellisense drop down. This is also the case fordb.Integer, #db.String, etc. This was first raised on #292 which got derailed to talk about linters.Plazmius commentedon Feb 7, 2019
I faced a similar issue. My first guess is that it is because attributes of class SQLAlchemy are initialized by
setattrfunction (https://github.com/pallets/flask-sqlalchemy/blob/master/flask_sqlalchemy/__init__.py#L78-L81)For example, Model is available:


However, Column is not:
milzer commentedon Feb 15, 2019
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.
DonJayamanne commentedon Feb 19, 2019
Dup of https://github.com/Microsoft/vscode-python/issues/2271
bschnurr commentedon Dec 28, 2022
see this comment.
microsoft/pylance-release#3780 (comment)