Skip to content

Commit 11f111b

Browse files
committed
Changed help animation
1 parent c3db788 commit 11f111b

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

intellij/src/util/groovy/in/oneton/snippet/util/intellij/Generator.groovy

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper
44
import in.oneton.snippet.util.Match
55

66
import static com.fasterxml.jackson.databind.SerializationFeature.INDENT_OUTPUT
7-
import static in.oneton.snippet.util.Util.getSnippetResources
8-
import static in.oneton.snippet.util.Util.nameToDescription
9-
import static in.oneton.snippet.util.Util.triggerName
7+
import static in.oneton.snippet.util.Util.*
108
import static java.util.regex.Pattern.compile
119
import static java.util.stream.Collectors.toList
1210

@@ -15,7 +13,7 @@ class Generator {
1513
static LONG_FORM_PATTERN = compile(/\$\s*\{\s*(\d+)\s*:\s*([^}]*)\s*}/)
1614
static SHORT_FORM_PATTERN = compile(/\$\s*(\d+)/)
1715

18-
void generateAll() {
16+
static void generateAll() {
1917
String resourcesPath = 'src/main/resources'
2018
String snippetsPath = '../snippets'
2119

@@ -60,7 +58,7 @@ class Generator {
6058
println "Regenerated flex layout template file. Saved to ${snippetXml.absolutePath}"
6159
}
6260

63-
private File generateFromMetadata(GeneratorMetadata metadata) {
61+
private static File generateFromMetadata(GeneratorMetadata metadata) {
6462
List<Template> templates = new ArrayList<>()
6563

6664
getSnippetResources(metadata.templateRootPath).forEach({ File snippetResource ->
@@ -98,31 +96,31 @@ class Generator {
9896
return file
9997
}
10098

101-
private String replaceWithVarFormat(String text, int index) {
99+
private static String replaceWithVarFormat(String text, int index) {
102100
String modifiedText = replaceWithVarFormat(text, index, true)
103101
if (modifiedText == text) {
104102
return replaceWithVarFormat(text, index, false)
105103
}
106104
return modifiedText
107105
}
108106

109-
private String replaceWithVarFormat(String text, int index, boolean longForm) {
107+
private static String replaceWithVarFormat(String text, int index, boolean longForm) {
110108
if (longForm) {
111109
def pattern = compile(/\$\s*\{\s*/ + index + /\s*:\s*([^}]*)\s*}/)
112110
return text.replaceAll(pattern, /\$/ + index + /\$/)
113111
} else {
114-
def pattern = compile(/\$\s*/+index)
112+
def pattern = compile(/\$\s*/ + index)
115113
return text.replaceAll(pattern, /\$/ + index + /\$/)
116114
}
117115
}
118116

119-
private Set<Match> parseAndGetMatches(String text) {
117+
private static Set<Match> parseAndGetMatches(String text) {
120118
def matches = parseAndGetMatches(text, true)
121119
matches.addAll(parseAndGetMatches(text, false))
122120
return matches
123121
}
124122

125-
private Set<Match> parseAndGetMatches(String text, boolean longForm) {
123+
private static Set<Match> parseAndGetMatches(String text, boolean longForm) {
126124
Set<Match> matches = new TreeSet<>()
127125
if (longForm) {
128126
def matcher = LONG_FORM_PATTERN.matcher(text)

intellij/src/util/groovy/in/oneton/snippet/util/intellij/Template.groovy

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty
55
import groovy.transform.builder.Builder
66
import in.oneton.snippet.util.Match
77

8+
import static java.lang.String.valueOf
9+
810
@Builder
911
class Template {
1012
@JacksonXmlProperty(isAttribute = true)
@@ -37,8 +39,8 @@ class TemplateVariable {
3739
boolean alwaysStopAt
3840

3941
static TemplateVariable from(Match match, String codePointVarString) {
40-
def builder = TemplateVariable.builder()
41-
.name(String.valueOf(match.index))
42+
def builder = builder()
43+
.name(valueOf(match.index))
4244
.alwaysStopAt(true)
4345
String suggestion = match.suggestion
4446
if (suggestion) {
@@ -63,12 +65,12 @@ class TemplateVariable {
6365
class ContextOption {
6466

6567
static final List<ContextOption> ALL = Collections.unmodifiableList(Arrays.asList(
66-
ContextOption.builder().name("HTML_TEXT").value(true).build(),
67-
ContextOption.builder().name("HTML").value(true).build(),
68-
ContextOption.builder().name("PHP").value(true).build(),
69-
ContextOption.builder().name("GSP").value(true).build(),
70-
ContextOption.builder().name("JSP").value(true).build(),
71-
ContextOption.builder().name("JSX_HTML").value(true).build()
68+
builder().name("HTML_TEXT").value(true).build(),
69+
builder().name("HTML").value(true).build(),
70+
builder().name("PHP").value(true).build(),
71+
builder().name("GSP").value(true).build(),
72+
builder().name("JSP").value(true).build(),
73+
builder().name("JSX_HTML").value(true).build()
7274
))
7375

7476
@JacksonXmlProperty(isAttribute = true)

vscode/.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.0
1+
0.13.0

vscode/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Since 0.12.0 (25 Oct 2017):
2+
3+
- Changed help animation
4+
15
### Since 0.12.0 (25 Oct 2017):
26

37
- Changed all triggers from `md` to `mat`

vscode/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Visual studio code (vscode) plugin/extension containing snippets for Angular Mat
33

44
This plugin works in both in the stable & the insiders build
55

6-
![Plugin in action](https://github.com/1tontech/material2-snippets/raw/vscode-0.12.0/vscode/help.gif)
6+
![Plugin in action](https://github.com/1tontech/material2-snippets/raw/vscode-0.13.0/vscode/help.gif)
77

88
The detailed list of supported template triggers are listed [below](#documentation)
99

vscode/help.gif

115 KB
Loading

0 commit comments

Comments
 (0)