@werckmeister/language-features 1.0.0-64 → 1.0.0-65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,8 @@ export declare class CommandArgument implements IAutoComplete {
12
12
  private isInstrumentConf;
13
13
  private getParameterSuggestion;
14
14
  private getInstrumentDefPcSuggestions;
15
- private getDeviceList;
15
+ private getDeviceIdList;
16
+ private getDeviceNameList;
16
17
  private getValueSuggestion;
17
18
  getSuggestions(line: string, document: ISourceDocument, documentContext: string): Promise<ICommandSuggestion[]>;
18
19
  }
package/index.js CHANGED
@@ -26,7 +26,7 @@ var n,t=arguments[3],r=require("buffer").Buffer;(function(){var r,e=200,u="Unsup
26
26
  },{"./WerckmeisterAutoHintDb":"Y3F9","lodash":"B1iE"}],"zyF4":[function(require,module,exports) {
27
27
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GMInstruments=void 0,exports.GMInstruments=["Acoustic Grand Piano","Bright Acoustic Piano","Electric Grand Piano","Honky-tonk Piano","Electric Piano 1","Electric Piano 2","Harpsichord","Clavi","Celesta","Glockenspiel","Music Box","Vibraphone","Marimba","Xylophone","Tubular Bells","Dulcimer","Drawbar Organ","Percussive Organ","Rock Organ","Church Organ","Reed Organ","Accordion","Harmonica","Tango Accordion","Acoustic Guitar Nylon","Acoustic Guitar Steel","Electric Guitar Jazz","Electric Guitar Clean","Electric Guitar Muted","Overdriven Guitar","Distortion Guitar","Guitar harmonics","Acoustic Bass","Electric Bass Finger","Electric Bass Pick","Fretless Bass","Slap Bass 1","Slap Bass 2","Synth Bass 1","Synth Bass 2","Violin","Viola","Cello","Contrabass","Tremolo Strings","Pizzicato Strings","Orchestral Harp","Timpani","String Ensemble 1","String Ensemble 2","SynthStrings 1","SynthStrings 2","Choir Aahs","Voice Oohs","Synth Voice","Orchestra Hit","Trumpet","Trombone","Tuba","Muted Trumpet","French Horn","Brass Section","SynthBrass 1","SynthBrass 2","Soprano Sax","Alto Sax","Tenor Sax","Baritone Sax","Oboe","English Horn","Bassoon","Clarinet","Piccolo","Flute","Recorder","Pan Flute","Blown Bottle","Shakuhachi","Whistle","Ocarina","Lead 1 Square","Lead 2 Sawtooth","Lead 3 Calliope","Lead 4 Chiff","Lead 5 Charang","Lead 6 Voice","Lead 7 Fifths","Lead 8 Bass+Lead","Pad 1 New Age","Pad 2 Warm","Pad 3 Polysynth","Pad 4 Choir","Pad 5 Bowed","Pad 6 Metallic","Pad 7 Halo","Pad 8 Sweep","FX 1 Rain","FX 2 Soundtrack","FX 3 Crystal","FX 4 Atmosphere","FX 5 Brightness","FX 6 Goblins","FX 7 Echoes","FX 8 Sci-Fi","Sitar","Banjo","Shamisen","Koto","Kalimba","Bag pipe","Fiddle","Shanai","Tinkle Bell","Agogo","Steel Drums","Woodblock","Taiko Drum","Melodic Tom","Synth Drum","Reverse Cymbal","Guitar Fret Noise","Breath Noise","Seashore","Bird Tweet","Telephone Ring","Helicopter","Applause","Gunshot"];
28
28
  },{}],"ykR4":[function(require,module,exports) {
29
- "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{s(r.next(e))}catch(t){o(t)}}function u(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,u)}s((r=r.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandArgument=void 0;var a=require("../../Common"),o=require("./GMInstruments"),i=require("../../WerckmeisterAutoHintDb"),u=[a.Keywords.mod,a.Keywords.voicingStrategy,a.Keywords.do,a.Keywords.doOnce],s=[a.Keywords.volume,a.Keywords.pan],c=[].concat(s,u),m=function(){function t(n){e(this,t),this.environmentInspector=n,this.autoHintDb=i.getAutoHintDb()}return n(t,[{key:"getModName",value:function(e){e=e||"";var t=c.join("|"),n=new RegExp("\\s*(".concat(a.Keywords.modOnce,"|").concat(t,')\\s*:.*_use="?([a-zA-Z0-9]+)"?')).exec(e);return n||(n=new RegExp("\\s*(".concat(a.Keywords.modOnce,"|").concat(t,")\\s*:\\s*([a-zA-Z0-9]+)")).exec(e)),!n||n.length<2?"":n[2]}},{key:"getInstrumentConfModName",value:function(e){e=e||"";var t=c.join("|"),n=(new RegExp(".*(".concat(t,").*")).exec(e)||[])[1];if(n&&s.includes(n))return n;t=c.map(function(e){return"".concat(e,".*")}).join("|");var r=(new RegExp(".*(".concat(t,")")).exec(e)||[])[1];if(r){var a=r.match(/\s*_use="?([a-zA-Z0-9]+)"?/);return a&&a.length>1?a[1]:(t=c.join("|"),!(a=new RegExp("\\s*(".concat(t,")\\s*([a-zA-Z0-9]+)")).exec(r))||a.length<2?"":a[2])}}},{key:"isMod",value:function(e){return e===a.Keywords.mod||e===a.Keywords.modOnce||e===a.Keywords.voicingStrategy}},{key:"isInstrumentConf",value:function(e){return e===a.Keywords.instrumentConf}},{key:"getParameterSuggestion",value:function(e,t){var n=e.getParameter();return t&&(n=n.filter(function(e){return e.getName().startsWith(t)})),n.sort(function(e,t){return e.getName().localeCompare(t.getName())}).map(function(t){return{displayText:t.getName(),text:"_".concat(t.getName()),deprecated:t.getDeprecatedText(),command:e,description:t.getDescription()}})}},{key:"getInstrumentDefPcSuggestions",value:function(e,t,n){var r=o.GMInstruments.map(function(n,r){return{displayText:"".concat(n," (").concat(r,")"),text:r.toString(),command:e,parameter:t}});return n&&(r=r.filter(function(e){return e.displayText.toLowerCase().indexOf(n.toLowerCase())>=0})),r}},{key:"getDeviceList",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function r(){var a,o;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.environmentInspector.getMidiOutputDevices();case 2:return a=r.sent,o=a.map(function(n){return{displayText:"".concat(n.name," (").concat(n.id,")"),text:n.id,command:e,parameter:t}}),n&&(o=o.filter(function(e){return e.displayText.toLowerCase().indexOf(n.toLowerCase())>=0})),r.abrupt("return",o);case 6:case"end":return r.stop()}},r,this)}))}},{key:"getValueSuggestion",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function r(){var o,i,u,s;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=e.getParameter().filter(function(e){return e.getName()===t})[0]){r.next=3;break}return r.abrupt("return",[]);case 3:if(e.getName()!==a.Keywords.instrumentDef||"pc"!=t){r.next=5;break}return r.abrupt("return",this.getInstrumentDefPcSuggestions(e,o,n));case 5:if(e.getName()!==a.Keywords.device||"usePort"!=t){r.next=9;break}return r.next=8,this.getDeviceList(e,o,n);case 8:return r.abrupt("return",r.sent);case 9:if("web"!==this.environmentInspector.environment||e.getName()!==a.Keywords.device||"isType"!=t){r.next=11;break}return r.abrupt("return",[{command:e,displayText:"webPlayer",text:"webPlayer"}]);case 11:if("web"!==this.environmentInspector.environment||e.getName()!==a.Keywords.device||"useFont"!=t){r.next=13;break}return r.abrupt("return",(this.environmentInspector.webplayerPresets||[]).map(function(t){return{command:e,displayText:t,text:t}}));case 13:if(i=o.getType()||"",(u=i.match(/\[(.*)\]/))&&u[1]){r.next=17;break}return r.abrupt("return",[]);case 17:return s=u[1].split(",").map(function(e){return e.trim()}),n&&(s=s.filter(function(e){return e.startsWith(n)})),r.abrupt("return",s.map(function(t){return{displayText:t,text:'"'.concat(t,'"'),command:e,parameter:o}}));case 20:case"end":return r.stop()}},r,this)}))}},{key:"getSuggestions",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function t(){var n,r,a,o,i,u,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return",[]);case 2:if(n=e.match(/.*?(\w+)\s*:.*?_(\w*)(="?(\w*))?$/)){t.next=5;break}return t.abrupt("return",[]);case 5:if(r=(n[1]||"").trim(),a=void 0!==n[3],o=(n[2]||"").trim(),this.isMod(r)&&(r=this.getModName(e)),this.isInstrumentConf(r)&&(r=this.getInstrumentConfModName(e)),i=this.autoHintDb[r]){t.next=13;break}return t.abrupt("return",[]);case 13:if(!a){t.next=19;break}return u=(n[2]||"").trim(),s=(n[4]||"").trim(),t.next=18,this.getValueSuggestion(i,u,s);case 18:return t.abrupt("return",t.sent);case 19:return t.abrupt("return",this.getParameterSuggestion(i,o));case 20:case"end":return t.stop()}},t,this)}))}}]),t}();exports.CommandArgument=m;
29
+ "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function o(e){try{s(r.next(e))}catch(t){i(t)}}function u(e){try{s(r.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,u)}s((r=r.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommandArgument=void 0;var a=require("../../Common"),i=require("./GMInstruments"),o=require("../../WerckmeisterAutoHintDb"),u=[a.Keywords.mod,a.Keywords.voicingStrategy,a.Keywords.do,a.Keywords.doOnce],s=[a.Keywords.volume,a.Keywords.pan],c=[].concat(s,u),m=function(){function t(n){e(this,t),this.environmentInspector=n,this.autoHintDb=o.getAutoHintDb()}return n(t,[{key:"getModName",value:function(e){e=e||"";var t=c.join("|"),n=new RegExp("\\s*(".concat(a.Keywords.modOnce,"|").concat(t,')\\s*:.*_use="?([a-zA-Z0-9]+)"?')).exec(e);return n||(n=new RegExp("\\s*(".concat(a.Keywords.modOnce,"|").concat(t,")\\s*:\\s*([a-zA-Z0-9]+)")).exec(e)),!n||n.length<2?"":n[2]}},{key:"getInstrumentConfModName",value:function(e){e=e||"";var t=c.join("|"),n=(new RegExp(".*(".concat(t,").*")).exec(e)||[])[1];if(n&&s.includes(n))return n;t=c.map(function(e){return"".concat(e,".*")}).join("|");var r=(new RegExp(".*(".concat(t,")")).exec(e)||[])[1];if(r){var a=r.match(/\s*_use="?([a-zA-Z0-9]+)"?/);return a&&a.length>1?a[1]:(t=c.join("|"),!(a=new RegExp("\\s*(".concat(t,")\\s*([a-zA-Z0-9]+)")).exec(r))||a.length<2?"":a[2])}}},{key:"isMod",value:function(e){return e===a.Keywords.mod||e===a.Keywords.modOnce||e===a.Keywords.voicingStrategy}},{key:"isInstrumentConf",value:function(e){return e===a.Keywords.instrumentConf}},{key:"getParameterSuggestion",value:function(e,t){var n=e.getParameter();return t&&(n=n.filter(function(e){return e.getName().startsWith(t)})),n.sort(function(e,t){return e.getName().localeCompare(t.getName())}).map(function(t){return{displayText:t.getName(),text:"_".concat(t.getName()),deprecated:t.getDeprecatedText(),command:e,description:t.getDescription()}})}},{key:"getInstrumentDefPcSuggestions",value:function(e,t,n){var r=i.GMInstruments.map(function(n,r){return{displayText:"".concat(n," (").concat(r,")"),text:r.toString(),command:e,parameter:t}});return n&&(r=r.filter(function(e){return e.displayText.toLowerCase().indexOf(n.toLowerCase())>=0})),r}},{key:"getDeviceIdList",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function r(){var a,i;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.environmentInspector.getMidiOutputDevices();case 2:return a=r.sent,i=a.map(function(n){return{displayText:"".concat(n.name," (").concat(n.id,")"),text:n.id,command:e,parameter:t}}),n&&(i=i.filter(function(e){return e.displayText.toLowerCase().indexOf(n.toLowerCase())>=0})),r.abrupt("return",i);case 6:case"end":return r.stop()}},r,this)}))}},{key:"getDeviceNameList",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function r(){var a,i;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.environmentInspector.getMidiOutputDevices();case 2:return a=r.sent,i=a.map(function(n){return{displayText:"".concat(n.name," (").concat(n.id,")"),text:n.name,command:e,parameter:t}}),n&&(i=i.filter(function(e){return e.displayText.toLowerCase().indexOf(n.toLowerCase())>=0})),r.abrupt("return",i);case 6:case"end":return r.stop()}},r,this)}))}},{key:"getValueSuggestion",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function r(){var i,o,u,s;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(i=e.getParameter().filter(function(e){return e.getName()===t})[0]){r.next=3;break}return r.abrupt("return",[]);case 3:if(e.getName()!==a.Keywords.instrumentDef||"pc"!=t){r.next=5;break}return r.abrupt("return",this.getInstrumentDefPcSuggestions(e,i,n));case 5:if(e.getName()!==a.Keywords.device||"usePort"!=t){r.next=9;break}return r.next=8,this.getDeviceIdList(e,i,n);case 8:return r.abrupt("return",r.sent);case 9:if(e.getName()!==a.Keywords.device||"useDevice"!=t){r.next=13;break}return r.next=12,this.getDeviceNameList(e,i,n);case 12:return r.abrupt("return",r.sent);case 13:if("web"!==this.environmentInspector.environment||e.getName()!==a.Keywords.device||"isType"!=t){r.next=15;break}return r.abrupt("return",[{command:e,displayText:"webPlayer",text:"webPlayer"}]);case 15:if("web"!==this.environmentInspector.environment||e.getName()!==a.Keywords.device||"useFont"!=t){r.next=17;break}return r.abrupt("return",(this.environmentInspector.webplayerPresets||[]).map(function(t){return{command:e,displayText:t,text:t}}));case 17:if(o=i.getType()||"",(u=o.match(/\[(.*)\]/))&&u[1]){r.next=21;break}return r.abrupt("return",[]);case 21:return s=u[1].split(",").map(function(e){return e.trim()}),n&&(s=s.filter(function(e){return e.startsWith(n)})),r.abrupt("return",s.map(function(t){return{displayText:t,text:'"'.concat(t,'"'),command:e,parameter:i}}));case 24:case"end":return r.stop()}},r,this)}))}},{key:"getSuggestions",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function t(){var n,r,a,i,o,u,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return",[]);case 2:if(n=e.match(/.*?(\w+)\s*:.*?_(\w*)(="?(\w*))?$/)){t.next=5;break}return t.abrupt("return",[]);case 5:if(r=(n[1]||"").trim(),a=void 0!==n[3],i=(n[2]||"").trim(),this.isMod(r)&&(r=this.getModName(e)),this.isInstrumentConf(r)&&(r=this.getInstrumentConfModName(e)),o=this.autoHintDb[r]){t.next=13;break}return t.abrupt("return",[]);case 13:if(!a){t.next=19;break}return u=(n[2]||"").trim(),s=(n[4]||"").trim(),t.next=18,this.getValueSuggestion(o,u,s);case 18:return t.abrupt("return",t.sent);case 19:return t.abrupt("return",this.getParameterSuggestion(o,i));case 20:case"end":return t.stop()}},t,this)}))}}]),t}();exports.CommandArgument=m;
30
30
  },{"../../Common":"I6jy","./GMInstruments":"zyF4","../../WerckmeisterAutoHintDb":"Y3F9"}],"nviV":[function(require,module,exports) {
31
31
  "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function u(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(u,a)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Command=void 0;var o=require("lodash"),i=require("../../WerckmeisterAutoHintDb"),u=function(){function t(){e(this,t),this.commandDb=i.getAutoHintDb()}return n(t,[{key:"getSuggestions",value:function(e,t,n){return r(this,void 0,void 0,regeneratorRuntime.mark(function t(){var r,i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.toLowerCase(),i=o(this.commandDb).filter(function(e,t){return t.toLowerCase().indexOf(r)>=0&&e.getDocumentContext().includes(n)}).value(),t.abrupt("return",i.map(function(e){return{displayText:e.getName(),text:e.getName(),description:e.getDescription(),url:e.getUrl()}}));case 3:case"end":return t.stop()}},t,this)}))}}]),t}();exports.Command=u;
32
32
  },{"lodash":"B1iE","../../WerckmeisterAutoHintDb":"Y3F9"}],"Tlxz":[function(require,module,exports) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@werckmeister/language-features",
3
- "version": "1.0.0-64",
3
+ "version": "1.0.0-65",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {