Skip to content

Commit

Permalink
add document link (#107)
Browse files Browse the repository at this point in the history
* add document link

* change documents order
  • Loading branch information
koxudaxi committed Apr 22, 2020
1 parent c605c4b commit cda090b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
23 changes: 10 additions & 13 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@

[A JetBrains PyCharm plugin](https://plugins.jetbrains.com/plugin/12861-pydantic) for [`pydantic`](https://github.com/samuelcolvin/pydantic).

## Help
See [documentation](https://koxudaxi.github.io/pydantic-pycharm-plugin/) for more details.

## Quick Installation
The plugin is in Jetbrains repository ([Pydantic Plugin Page](https://plugins.jetbrains.com/plugin/12861-pydantic))

You can install the stable version on PyCharm's `Marketplace` (Preference -> Plugins -> Marketplace) [Offical Document](https://www.jetbrains.com/help/idea/managing-plugins.html)

![search plugin](search_plugin.png)

## Example:
![type check1](typecheck1.png)

## Features
### Implemented
#### pydantic.BaseModel
Expand All @@ -34,6 +21,16 @@ You can install the stable version on PyCharm's `Marketplace` (Preference -> Plu
* Support same features as `pydantic.BaseModel`
* (After PyCharm 2020.1 and this plugin version 0.1.0, PyCharm treats `pydantic.dataclasses.dataclass` as third-party dataclass.)

## Example:
![type check1](typecheck1.png)

## Quick Installation
The plugin is in Jetbrains repository ([Pydantic Plugin Page](https://plugins.jetbrains.com/plugin/12861-pydantic))

You can install the stable version on PyCharm's `Marketplace` (Preference -> Plugins -> Marketplace) [Offical Document](https://www.jetbrains.com/help/idea/managing-plugins.html)

![search plugin](search_plugin.png)


## Contribute
We are waiting for your contributions to `pydantic-pycharm-plugin`.
Expand Down
1 change: 1 addition & 0 deletions docs/type-checking.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Inspection for type-checking
**Experimental**

**In version 0.1.1, This feature is broken. Please use it in [0.1.2](https://github.com/koxudaxi/pydantic-pycharm-plugin/releases/tag/0.1.2) or later.**

This plugin provides an inspection for type-checking, which is compatible with pydantic.
Expand Down
1 change: 1 addition & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<h2>version 0.1.3</h2>
<p>Features</p>
<ul>
<li>Add documents and link to documents [#105, #106, #107] </li>
<li>Support acceptable type [#104] </li>
<li>Support parsable type highlight level [#103] </li>
</ul>
Expand Down
26 changes: 21 additions & 5 deletions src/com/koxudaxi/pydantic/PydanticConfigPanel.form
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.koxudaxi.pydantic.PydanticConfigPanel">
<grid id="27dc6" binding="configPanel" default-binding="true" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="configPanel" default-binding="true" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="360" y="153" width="2880" height="5535"/>
</constraints>
<properties/>
<properties>
<enabled value="true"/>
</properties>
<border type="none"/>
<children>
<grid id="da542" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="da542" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
Expand Down Expand Up @@ -62,11 +64,25 @@
<text value="If enabled, raise a error whenever a field is declared on a model without explicitly specifying its type."/>
</properties>
</component>
<component id="35726" class="javax.swing.JTextPane" binding="textPane1" default-binding="true">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties>
<contentType value="text/html"/>
<editable value="false"/>
<font/>
<opaque value="false"/>
<text value="&lt;html&gt;&#10; &lt;head&gt;&#10;&#10; &lt;/head&gt;&#10; &lt;body&gt;&#10; &lt;p&gt;&#10; &#10; &lt;/p&gt;&#10; &lt;/body&gt;&#10;&lt;/html&gt;&#10;"/>
</properties>
</component>
</children>
</grid>
<vspacer id="a33f9">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
Expand Down
11 changes: 10 additions & 1 deletion src/com/koxudaxi/pydantic/PydanticConfigPanel.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.koxudaxi.pydantic;

import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.project.Project;

import javax.swing.*;
import javax.swing.event.HyperlinkEvent;

public class PydanticConfigPanel {

Expand All @@ -12,13 +14,21 @@ public class PydanticConfigPanel {
this.initTypedCheckBox.setSelected(pydanticConfigService.getInitTyped());
this.warnUntypedFieldsCheckBox.setSelected(pydanticConfigService.getWarnUntypedFields());

this.textPane1.setText("<p style=\"font-family:Arial, Helvetica, sans-serif;font-size:130%;\">" +
"See <a href=\"https://koxudaxi.github.io/pydantic-pycharm-plugin/\">documentation</a> for more details.</p>");
this.textPane1.addHyperlinkListener(e -> {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BrowserUtil.browse(e.getURL());
}
});
}

private JPanel configPanel;
private JCheckBox initTypedCheckBox;
private JTextPane ifEnabledIncludeTheTextPane;
private JCheckBox warnUntypedFieldsCheckBox;
private JTextPane ifEnabledRaiseATextPane;
private JTextPane textPane1;

public Boolean getInitTyped() {
return initTypedCheckBox.isSelected();
Expand All @@ -31,5 +41,4 @@ public Boolean getWarnUntypedFields() {
public JPanel getConfigPanel() {
return configPanel;
}

}

0 comments on commit cda090b

Please sign in to comment.