Skip to content

Commit

Permalink
New snippets added, old snippets enhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
apushkarev committed Aug 23, 2019
1 parent 3585449 commit ed36e0d
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 22 deletions.
2 changes: 1 addition & 1 deletion KrpanoMarkup/krpano.YAML-tmLanguage
Expand Up @@ -122,7 +122,7 @@ repository:

# Instruction words
krpanoInstructionWords:
match: \s?\b(set|get|copy|delete|if|ifnot|resolvecondition|(stop)?delayedcall|for|asyncfor|loop|async(loop|call){1}|switch|push|pop|stopall|breakall|callwith|events\.dispatch|calc|def|nexttick|callwhen|exitcall|(set|clear)interval|toggle|break|assignstyle|this|scope|parentscopeset|copyattributes|strict|caller|(stop)?callwhen)\b
match: \s?\b(set|get|copy|delete|if|ifnot|resolvecondition|(stop)?delayedcall|for|asyncfor|loop|async(loop|call){1}|switch|push|pop|stopall|breakall|callwith|events\.dispatch|calc|def|nexttick|callwhen|exitcall|(set|clear)interval|toggle|break|assignstyle|new|this|scope|parentscopeset|copyattributes|strict|caller|(stop)?callwhen|sortby|createarrayitem|removearrayitem)\b
name: keyword.control

# Global variables
Expand Down
2 changes: 1 addition & 1 deletion KrpanoMarkup/krpano.tmLanguage
Expand Up @@ -265,7 +265,7 @@
<key>krpanoInstructionWords</key>
<dict>
<key>match</key>
<string>\s?\b(set|get|copy|delete|if|ifnot|resolvecondition|(stop)?delayedcall|for|asyncfor|loop|async(loop|call){1}|switch|push|pop|stopall|breakall|callwith|events\.dispatch|calc|def|nexttick|callwhen|exitcall|(set|clear)interval|toggle|break|assignstyle|this|scope|parentscopeset|copyattributes|strict|caller|(stop)?callwhen)\b</string>
<string>\s?\b(set|get|copy|delete|if|ifnot|resolvecondition|(stop)?delayedcall|for|asyncfor|loop|async(loop|call){1}|switch|push|pop|stopall|breakall|callwith|events\.dispatch|calc|def|nexttick|callwhen|exitcall|(set|clear)interval|toggle|break|assignstyle|new|this|scope|parentscopeset|copyattributes|strict|caller|(stop)?callwhen|sortby|createarrayitem|removearrayitem)\b</string>
<key>name</key>
<string>keyword.control</string>
</dict>
Expand Down
19 changes: 16 additions & 3 deletions README.md
Expand Up @@ -121,7 +121,7 @@ use the same process to modify color scheme.

There is a set of shortcuts to cover majority of writing code cases. Please feel free to troubleshoot;

### Snippets (tags mixed with actions code)
### Snippets and autocompletions
* action – creates action;
* actjs – creates JS action with CDATA wrap;
* asynccall – creates asynchronous call (mode in krpano devlib ;)
Expand Down Expand Up @@ -150,7 +150,6 @@ There is a set of shortcuts to cover majority of writing code cases. Please feel
* style;
* tag – for random tag;
* this – create this alias;
### Script autocompletions with alises
* fs – fullscreen;
* stw – stagewidth;
* sth – stageheight;
Expand Down Expand Up @@ -212,8 +211,9 @@ There is a set of shortcuts to cover majority of writing code cases. Please feel
* cwh – callwith(hotspot[$1], $2);
* cwl – callwith(layer[$1], $2);
* cw – callwith($1, $2);
* cwt – callwith(this, $2);
* ++ – ' + $1 + ' (for string operations in JS);
### XML autocompletions with alises
* pp – "+ ' ' + "
* ef – enabled="false";
* et – enabled="true";
* vf – visible="false";
Expand Down Expand Up @@ -252,6 +252,8 @@ There is a set of shortcuts to cover majority of writing code cases. Please feel
* kf – keep="false";
* w100 – width="100%";
* h100 – height="100%";
* wh – width=\"$1\" height=\"$2\"
* whm – width.mobile=\"$1\" height.mobile=\"$2\"
* bgc – bgcolor="0x$1";
* bga – bgalpha="$1";
* bgb – bgborder="$1";
Expand All @@ -262,9 +264,13 @@ There is a set of shortcuts to cover majority of writing code cases. Please feel
* bgc – bgcapture="$1";
* ov – onover="\n\t$1\n";
* od – ondown="\n\t$1\n";
* odt – ondown.touch="\n\t$1\n";
* oh – onhover="\n\t$1\n";
* oo – onout="\n\t$1\n";
* oc – onclick="\n\t$1\n";
* oct – onclick.touch="\n\t$1\n";
* oc1 – onclick=\"\n\tdelayedcall(0.1,\n\t\tonclick_actions();\n\t);\n\"
* oct1 – onclick.touch=\"\n\tdelayedcall(0.1,\n\t\tonclick_actions();\n\t);\n\"
* ou – onup="\n\t$1\n";
* ol – onloaded="\n\t$1\n";
* oa – onautosized="\n\t$1\n";
Expand Down Expand Up @@ -334,6 +340,13 @@ There is a set of shortcuts to cover majority of writing code cases. Please feel
* kg – krpano.get('$1');
* cl – console.log($1);
* cd – console.divider();
* cm – console.msg('$1');
* cv – console.var($1);
* sdc – stopdelayedcall($1);
* jsget – jsget($1, $2);
* new – new($1);
* nh – newhotspot(%1, %2);
* nl – newlayer(%1, %2);


Majority of other krpano words is also here.
47 changes: 30 additions & 17 deletions dist/completions/krpano-completions.sublime-completions
Expand Up @@ -8,10 +8,10 @@
{ "trigger": "fs", "contents": "fullscreen" },
{ "trigger": "fullscreen", "contents": "fullscreen" },

{ "trigger": "stw", "contents": "stagewidth" },
{ "trigger": "stw", "contents": "stagewidth " },
{ "trigger": "stagewidth", "contents": "stagewidth" },

{ "trigger": "sth", "contents": "stageheight" },
{ "trigger": "sth", "contents": "stageheight " },
{ "trigger": "stageheight", "contents": "stageheight" },

{ "trigger": "sts", "contents": "stagescale" },
Expand Down Expand Up @@ -45,6 +45,7 @@

{ "trigger": "dcss", "contents": "device.css3d" },
{ "trigger": "device.css3d", "contents": "device.css3d" },
{ "trigger": "rcss3d", "contents": "renderer=\"css3d\"" },


{ "trigger": "dwebgl", "contents": "device.webgl" },
Expand Down Expand Up @@ -196,6 +197,8 @@
{ "trigger": "set", "contents": "set($1, $2);" },
{ "trigger": "get", "contents": "get($1, $2);" },

{ "trigger": "sdc", "contents": "stopdelayedcall($1);" },

{ "trigger": "cp", "contents": "copy($1, $2);" },
{ "trigger": "cht", "contents": "copy(this, hotspot[%1]);$1" },
{ "trigger": "clt", "contents": "copy(this, layer[%1]);$1" },
Expand Down Expand Up @@ -278,8 +281,9 @@
{ "trigger": "Math.tan", "contents": "Math.tan($1);" },


{ "trigger": "cwh", "contents": "callwith(hotspot[$1], $2);" },
{ "trigger": "cwl", "contents": "callwith(layer[$1], $2);" },
{ "trigger": "cwh", "contents": "callwith(hotspot[get($1)], $2);" },
{ "trigger": "cwl", "contents": "callwith(layer[get($1)], $2);" },
{ "trigger": "cwt", "contents": "callwith(this, $2);" },

{ "trigger": "cw", "contents": "callwith($1, $2);" },
{ "trigger": "callwith", "contents": "callwith($1, $2);" },
Expand Down Expand Up @@ -350,7 +354,7 @@

{ "trigger": "js", "contents": "js( $1 );" },
{ "trigger": "jscall", "contents": "jscall( '$1' );" },
{ "trigger": "jsget", "contents": "jsget($1);" },
{ "trigger": "jsget", "contents": "jsget($1, $2);" },
{ "trigger": "showlog", "contents": "showlog($1);" },
{ "trigger": "debugvar", "contents": "debugvar($1);" },
{ "trigger": "debug", "contents": "debug($1);" },
Expand Down Expand Up @@ -509,10 +513,11 @@
{ "trigger": "oy", "contents": "oy" },
{ "trigger": "rotate", "contents": "rotate" },
{ "trigger": "w", "contents": "width=\"$1\" " },
{ "trigger": "pw", "contents": "pixelwidth" },
{ "trigger": "pw", "contents": "pixelwidth " },
{ "trigger": "h", "contents": "height=\"$1\" " },
{ "trigger": "ph", "contents": "pixelheight" },
{ "trigger": "ph", "contents": "pixelheight " },
{ "trigger": "wh", "contents": "width=\"$1\" height=\"$2\"" },
{ "trigger": "whm", "contents": "width.mobile=\"$1\" height.mobile=\"$2\"" },
{ "trigger": "scale", "contents": "scale" },
{ "trigger": "pixelhittest", "contents": "pixelhittest" },
{ "trigger": "smoothing", "contents": "smoothing" },
Expand All @@ -533,14 +538,7 @@
{ "trigger": "bgroundedge", "contents": "bgroundedge" },
{ "trigger": "bgshadow", "contents": "bgshadow" },
{ "trigger": "bgcapture", "contents": "bgcapture" },
{ "trigger": "onover", "contents": "onover" },
{ "trigger": "onhover", "contents": "onhover" },
{ "trigger": "onout", "contents": "onout" },
{ "trigger": "onclick", "contents": "onclick" },
{ "trigger": "ondown", "contents": "ondown" },
{ "trigger": "onup", "contents": "onup" },
{ "trigger": "onloaded", "contents": "onloaded" },


{ "trigger": "onenterfullscreen", "contents": "onenterfullscreen" },
{ "trigger": "onexitfullscreen", "contents": "onexitfullscreen" },
{ "trigger": "onxmlcomplete", "contents": "onxmlcomplete" },
Expand Down Expand Up @@ -751,10 +749,15 @@

{ "trigger": "ov", "contents": "onover=\"\n\t$1\n\"" },
{ "trigger": "od", "contents": "ondown=\"\n\t$1\n\"" },
{ "trigger": "odt", "contents": "ondown.touch=\"\n\t$1\n\"" },
{ "trigger": "oh", "contents": "onhover=\"\n\t$1\n\"" },
{ "trigger": "oo", "contents": "onout=\"\n\t$1\n\"" },
{ "trigger": "oc", "contents": "onclick=\"\n\t$1\n\"" },
{ "trigger": "oct", "contents": "onclick.touch=\"\n\t$1\n\"" },
{ "trigger": "oc1", "contents": "onclick=\"\n\tdelayedcall(0.1,\n\t\tonclick_actions();\n\t);\n\"" },
{ "trigger": "oct1", "contents": "onclick.touch=\"\n\tdelayedcall(0.1,\n\t\tonclick_actions();\n\t);\n\"" },
{ "trigger": "ou", "contents": "onup=\"\n\t$1\n\"" },
{ "trigger": "out", "contents": "onup.touch=\"\n\t$1\n\"" },
{ "trigger": "ol", "contents": "onloaded=\"\n\t$1\n\"" },
{ "trigger": "oa", "contents": "onautosized=\"\n\t$1\n\"" },
{ "trigger": "ovr", "contents": "onvideoready=\"\n\t$1\n\"" },
Expand Down Expand Up @@ -819,13 +822,23 @@
{ "trigger": "ic", "contents": "invisible_content" },
{ "trigger": "sic", "contents": "style=\"invisible_content\"" },
{ "trigger": "sicv", "contents": "style=\"invisible_content|visible\"" },

{ "trigger": "kc", "contents": "krpano.call('$1');" },
{ "trigger": "ks", "contents": "krpano.set('$1');" },
{ "trigger": "kg", "contents": "krpano.get('$1');" },

{ "trigger": "oca", "contents": "onclick_actions=\"\n\t$1\n\"" },

{ "trigger": "cl", "contents": "console.log($1);" },
{ "trigger": "cd", "contents": "console.divider();" }
{ "trigger": "cv", "contents": "console.var($1);" },
{ "trigger": "cm", "contents": "console.msg('$1');" },
{ "trigger": "cd", "contents": "console.divider();" },

{ "trigger": "pp", "contents": "+ ' ' + " },

{ "trigger": "new", "contents": "new($1);" },

// { "trigger": "++", "contents": "' + $1 + '" }
{ "trigger": "nh", "contents": "newhotspot(%1, %2);" },
{ "trigger": "nl", "contents": "newlayer(%1, %2);" }
]
}
9 changes: 9 additions & 0 deletions dist/snippets/hsiv.sublime-snippet
@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
<hotspot name="${1}" style="invisible_content|visible"
${2}
/>
]]></content >
<description>Create invisible hotspot tag</description>
<tabTrigger>hsiv</tabTrigger>
</snippet >
@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
<hotspot name="${1}" style="invisible_content|visible" keep="true"
${2}
/>
]]></content >
<description>Create invisible hotspot keep true tag</description>
<tabTrigger>hsivkt</tabTrigger>
</snippet >
@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
<layer name="${1}" style="invisible_content|visible" keep="true"
${2}
/>
]]></content >
<description>Create invisible layer keep true tag</description>
<tabTrigger>lsivkt</tabTrigger>
</snippet >
File renamed without changes.
9 changes: 9 additions & 0 deletions dist/snippets/lsiv.sublime-snippet
@@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
<layer name="${1}" style="invisible_content|visible"
${2}
/>
]]></content >
<description>Create invisible layer tag</description>
<tabTrigger>lsiv</tabTrigger>
</snippet >
7 changes: 7 additions & 0 deletions dist/snippets/quot-code.sublime-snippet
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA["
$1
"]]></content >
<description>Create quote code block</description>
<tabTrigger>""</tabTrigger>
</snippet >

0 comments on commit ed36e0d

Please sign in to comment.