Python Forum
VS Code Intellisense not working
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VS Code Intellisense not working
#1
In py file 1 I have data model classes.
In py file 2, I have imported a class from the first py file.
When I reference an instance of an imported class from file 1 in file 2, I can't get the IDE to show the properties of the class.
I've documented my attempts to resolve this here
Can anyone shed some light on this for me please.
(Using Python 3.6.5 on Windows 2012 RC2 and VS Code 1.23.1)
All I get as options are:
...
end
file
flush
sep
value
Reply
#2
Most difficult without seeing actual code
Reply
#3
The link had most of the code.... :-(

setup.py:
from distutils.core import setup
setup(
name='TidalConversion',
version='0.1dev',
packages=['tidalconversion',],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description=open('README.txt').read(),
)

__init__.py:
#!/usr/bin/env python
import os
from tidal import *
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
engine = create_engine(os.environ['DATABASE_URL'], echo=False) #echo='debug'
Session = sessionmaker(bind=engine)

main code
from tidalconversion import Session, engine, Jobmst
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first()

If I try and do something like
print(jobrow. and press ctrl+space I don't get any of the columns - like jobmst_id for example.
I can confirm that if I printed the type of jobrow - it would be of type tidal.Jobmst
[Image: Screen%2BShot%2B2018-05-11%2Bat%2B18.02.37.png]

The classes in the tidal.py file are just code generated by SQLACODEGEN, representing database tables and the relationships between for use with SQLAlchemy
Reply
#4
I recorded a video of the issue here

I posted on Stack Overflow here
Reply
#5
I found PEP0526 resolved this. Thanks to Ilja Everilä on Stack Overflow.
So I ended up with code like so:
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first() # type: Jobmst
Have asked guys at SQLAlchemy if they can integrate these code hint comments into their library rather than have it at the 'client' code level.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  code isnt working. nezercat33 1 649 Mar-14-2025, 03:45 AM
Last Post: deanhystad
  Simple code not working properly tmv 2 502 Feb-28-2025, 09:27 PM
Last Post: deanhystad
  I'm new to Python - can someone help with this code as it is not working? lminc123 1 526 Feb-13-2025, 06:13 PM
Last Post: lminc123
  my code is not working erTurko 1 653 Nov-11-2024, 08:43 AM
Last Post: buran
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 2,321 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  code not working when executed from flask app ThomasDC 1 3,218 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  I am new to python and Could someone please explain how this below code is working? kartheekdas 2 1,776 Dec-19-2022, 05:24 PM
Last Post: kartheekdas
Exclamation My code is not working as I expected and I don't know why! Marinho 4 2,184 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  Visual Studio Code Intellisense for Imported Modules Not Working hockinsk 1 4,297 Apr-23-2022, 04:41 PM
Last Post: deanhystad
  My Code isn't working... End3r 4 3,312 Mar-21-2022, 10:12 AM
Last Post: End3r

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020