I guess they might finally get me to use those things since they take the “configuring” and “remembering shortcuts” part out, but so much of this doesn’t look new at all. Super old, actually.
If I have a JSON structure, I can paste that into the file as a comment, e.g.:
# {"foo": 1, "bar": "test", "baz"}
@dataclass
class FooBar:
foo:
and the AI will/can autocomplete/generate that to: @dataclass
class FooBar:
foo: int
bar: str
baz: int
using the JSON example. Then if you type: def __str__(self):
the AI could then contextually generate, e.g.: return f'Foo(foo={self.foo}, bar={self.bar}, baz={self.baz})'
Or if you have a SQLAlchemy model: class Foo(Base):
__tablename__ = 'foos'
bar_id: Mapped[int | None] = mapped_column(ForeignKey('bars.id'), default=None)
typing `bar:` the AI can autocomplete: bar: Mapped[Optional['Bar']] = relationship()
picking up that you have a `Bar` class in the file. Especially if you have other similar id/object definitions in the file.