-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate: Migrate deprecated APIs to support hot deployment
- Loading branch information
vito
committed
Sep 13, 2022
1 parent
3e3e2b2
commit 45bc05b
Showing
2 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<idea-plugin> | ||
<id>com.jinsihou.react.snippets</id> | ||
<name>React snippets</name> | ||
<version>1.1.0</version> | ||
<version>1.1.1</version> | ||
<vendor email="[email protected]">jinsihou</vendor> | ||
|
||
<description><![CDATA[ | ||
|
@@ -10,6 +10,8 @@ | |
]]></description> | ||
|
||
<change-notes><![CDATA[ | ||
<strong>v1.1.1</strong> <br/> | ||
<li>Migrate deprecated APIs to support hot deployment</li> | ||
<strong>v1.1.0</strong> <br/> | ||
<li> Supported react 16.8.0 hooks</li> | ||
<li> add cref snippet</li> | ||
|
@@ -22,7 +24,7 @@ | |
</change-notes> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description --> | ||
<idea-version since-build="145.0"/> | ||
<idea-version since-build="202.6397.94"/> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html | ||
on how to target different products --> | ||
|
@@ -33,7 +35,8 @@ | |
<depends>com.intellij.modules.platform</depends> | ||
|
||
<extensions defaultExtensionNs="com.intellij"> | ||
<defaultLiveTemplatesProvider implementation="com.jinsihou.react.snippets.ReactTemplateProvider"/> | ||
<defaultLiveTemplates file="/liveTemplates/React.xml"/> | ||
<liveTemplateContext implementation="com.jinsihou.react.snippets.ReactTemplateProvider"/> | ||
</extensions> | ||
|
||
<actions> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package com.jinsihou.react.snippets; | ||
|
||
|
||
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; | ||
import org.jetbrains.annotations.Nullable; | ||
import com.intellij.codeInsight.template.TemplateActionContext; | ||
import com.intellij.codeInsight.template.TemplateContextType; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* @author jinsihou | ||
* @date 2017/10/18 | ||
*/ | ||
public class ReactTemplateProvider implements DefaultLiveTemplatesProvider { | ||
@Override | ||
public String[] getDefaultLiveTemplateFiles() { | ||
return new String[]{"liveTemplates/React"}; | ||
public class ReactTemplateProvider extends TemplateContextType { | ||
protected ReactTemplateProvider() { | ||
super("REACT", "React"); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String[] getHiddenLiveTemplateFiles() { | ||
return new String[0]; | ||
public boolean isInContext(@NotNull TemplateActionContext templateActionContext) { | ||
String name = templateActionContext.getFile().getName(); | ||
return name.endsWith(".js") || name.endsWith(".jsx") || name.endsWith(".html") || name.endsWith(".ts"); | ||
} | ||
} |