koxudaxi / pydantic-pycharm-plugin

PyCharm plugin for pydantic. This plugin provides autocompletion, inspection, type-checking, inserting unfilled argument, and more.
https://koxudaxi.github.io/pydantic-pycharm-plugin/
MIT License
437 stars 14 forks source link

Prompt to install with using pydantic #35

Open samuelcolvin opened 4 years ago

samuelcolvin commented 4 years ago

I think pycharm sometimes prompts me to install packages based on what I'm using.

Is it possible to get pycharm to prompt users to install this plugin whenever they import or install pydantic?

koxudaxi commented 4 years ago

I don't know how to work the function. I will research it.

samuelcolvin commented 4 years ago

@pauleveritt, shamelessly tagging you for help.

Pycharm is sometimes keen on prompting people to install things (I had to email you about a package called pydantic-stubs which was not official, but pycharm was prompting everyone to use it whenever they imported pydantic - I know that was a python package not a pycharm plugin, but still).

Is there anyway we can tell pycharm users that this plugin might be useful when they're using pydantic?

I built a jinja template highlight package for vscode (the enemy :gun:, :pray:) and I'm pretty sure 99.9% of installs come because users get prompted to install a plugin when they open a .jinja or .jinja2 file. Hence why I'm advocating a prompt to spread the work about this great plugin.

pauleveritt commented 4 years ago

Thanks for tagging. I saw the ticket but I'm in a PyCharm 2019.3 planning meeting and haven't replied yet. (Can't wait for dataclass support in the plugin.)

Yes, there are ways to trigger such things. We have them all over the place. I'll see if I can get the team to comment on this ticket on (a) where is the hook and (b) what is a good example in the IntelliJ repo.

samuelcolvin commented 4 years ago

great, thanks.

koxudaxi commented 4 years ago

thank you for your help

pauleveritt commented 4 years ago

@samuelcolvin I should have asked...on your vscode plugin example, either the platform or another plugin would have to detect that situation and do the suggesting. Are you saying vscode maintains a registry of some kind suggesting one plugin versus another?

samuelcolvin commented 4 years ago

Not exactly.

My plugin is providing highlighting for jinja code (and html jinja templates), the plugin has a list of file extensions it should work with, eg .jinja, .jinja2. When you open a file with an extension vscode doesn't natively support, it looks for plugins that do support than extensions and suggests them. I think pycharm does something similar in this situation.

pauleveritt commented 4 years ago

@samuelcolvin That makes sense at a file extension level. This though is a package import. Does VS Code allow extensions to register support when an opened file imports something?

pauleveritt commented 4 years ago

@samuelcolvin To answer the question though, this page explains how to register for a filename. Note that PyCharm reserves some extensions (e.g. jinja2) for its own support, meaning we won't prompt a suggestion if we already support it.