regeneratorRuntime error with new au-cli - babeljs

I'm trying to convert an existing project to use the aurelia cli and I've encountered an old problem. I'm getting a regeneratorRuntime is not defined error. I fixed this a while back in a previous version but either my memory is hazy or that knowledge doesn't apply to this version. Can anyone point me to a source or give me some advice on how to fix this with this version?
Thanks,
Ross

The solution that worked for me was to add the babel-polyfill to the vendor-bundle section of aurelia-project/aurelia.json, like this:
"name": "vendor-bundle.js",
"prepend": [
"node_modules/babel-polyfill/dist/polyfill.js",
"node_modules/bluebird/js/browser/bluebird.core.js",
"scripts/require.js"
]

I was able to get it. Once you get how the aurelia.json file works, it's not to difficult. Add this to aurelia.json:
{
"name": "regenerator-runtime",
"path": "../node_modules/regenerator-runtime",
"main": "runtime-module"
}
Then add this to main.js:
```
import regeneratorRuntime from 'regenerator-runtime';
window.regeneratorRuntime = regeneratorRuntime;
```
Thanks for everyone's suggestions.

A hackish solution for now (thanks to Roland Quast #rquast from https://gitter.im/aurelia):
You need to install and require babel-polyfill in your main.js file explicitly:
require('node_modules/babel-polyfill/dist/polyfill.js')

Related

vscode language-configuration: indentationRules and onEnterRules priority/order

Can somebody help me explain the order/priority of indentationRules and onEnterRules in language-configuration for vscode?
What is happening: in the extension for the Godot game engine, the code blocks after the lines that match the regexp for increaseIndentPattern received additional indentation after the code block is moved down or pasted. See issue: https://github.com/godotengine/godot-vscode-plugin/issues/337
When I added a simple rule in onEnterRules it solved the issue. The problem is that the order/priority of these rules is not defined anywhere in the documentation and I can't understand why it solved the issue.
The rule that I added:
"onEnterRules": [
{
"beforeText": "^\\s*$",
"action": {
"indent": "none"
}
}
]
PR: https://github.com/godotengine/godot-vscode-plugin/pull/344
I need to understand what is going on here and why it worked. Thank you!

Why can't I see any help in osgi console?

When I type help in the osgi console of my application : nothing happens :(. SS gives me the bundle list, lb also, scr:list, the service list etc. But help : nothing !
Here is my conf (launch.bndrun) :
-runfw: org.eclipse.osgi;version='[3.16.100.v20201030-1916,3.16.200.v20210226-1447]'
-runee: JavaSE-1.8
-runprovidedcapabilities: ${native_capability}
-resolve.effective: auto
-runbundles: \
org.eclipse.paho.client.mqttv3;version='[1.2.5,1.2.6)',\
org.avm.device.api;version=snapshot,\
org.avm.device.afficheur;version=snapshot,\
org.avm.device.common;version=snapshot,\
org.avm.device.driver.afficheur;version=snapshot,\
org.avm.device.driver.girouette;version=snapshot,\
org.avm.device.girouette;version=snapshot,\
org.apache.servicemix.bundles.junit;version='[4.13.0,4.13.1)',\
org.avm.device.driver.gps;version=snapshot,\
org.avm.device.gps;version=snapshot,\
org.avm.device.comptage;version=snapshot,\
org.avm.device.driver.comptage;version=snapshot,\
org.avm.device.audio;version=snapshot,\
org.avm.device.driver.audio;version=snapshot,\
org.avm.device.driver.io;version=snapshot,\
org.avm.device.io;version=snapshot,\
org.avm.device.driver.modem;version=snapshot,\
org.avm.device.modem;version=snapshot,\
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\
org.apache.felix.gogo.runtime;version='[1.1.4,1.1.5)',\
org.apache.felix.gogo.shell;version='[1.1.4,1.1.5)',\
org.apache.commons.commons-fileupload;version='[1.4.0,1.4.1)',\
org.apache.commons.commons-io;version='[2.8.0,2.8.1)',\
org.apache.felix.webconsole;version='[4.6.0,4.6.1)',\
org.apache.felix.http.jetty;version='[4.1.6,4.1.7)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.scr;version='[2.1.24,2.1.25)',\
org.eclipse.equinox.cm;version='[1.5.0,1.5.1)',\
org.eclipse.equinox.console;version='[1.4.300,1.4.301)',\
org.eclipse.osgi.services;version='[3.10.0,3.10.1)',\
org.eclipse.osgi.util;version='[3.6.0,3.6.1)',\
org.eclipse.equinox.device;version='[1.1.100,1.1.101)'
-runrequires: \
bnd.identity;id='org.apache.servicemix.bundles.junit',\
bnd.identity;id='org.eclipse.osgi',\
bnd.identity;id='org.apache.felix.gogo.shell',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
bnd.identity;id='org.apache.felix.gogo.runtime',\
bnd.identity;id='org.eclipse.equinox.console',\
bnd.identity;id='org.eclipse.equinox.cm',\
bnd.identity;id='org.eclipse.paho.client.mqttv3',\
bnd.identity;id='org.apache.felix.scr',\
bnd.identity;id='org.apache.felix.webconsole',\
bnd.identity;id='org.apache.felix.http.jetty',\
bnd.identity;version='latest';id='org.avm.device.api',\
bnd.identity;version='latest';id='org.avm.device.common',\
bnd.identity;version='latest';id='org.avm.device.driver.afficheur',\
bnd.identity;version='latest';id='org.avm.device.driver.girouette',\
bnd.identity;version='latest';id='org.avm.device.driver.gps',\
bnd.identity;version='latest';id='org.avm.device.driver.comptage',\
bnd.identity;version='latest';id='org.avm.device.driver.audio',\
bnd.identity;version='latest';id='org.avm.device.driver.io',\
bnd.identity;version='latest';id='org.avm.device.driver.modem',\
bnd.identity;version='latest';id='org.avm.device.afficheur',\
bnd.identity;version='latest';id='org.avm.device.girouette',\
bnd.identity;version='latest';id='org.avm.device.gps',\
bnd.identity;version='latest';id='org.avm.device.comptage',\
bnd.identity;version='latest';id='org.avm.device.audio',\
bnd.identity;version='latest';id='org.avm.device.io',\
bnd.identity;version='latest';id='org.avm.device.modem',\
bnd.identity;id='org.apache.felix.http.servlet-api',\
bnd.identity;id='org.apache.commons.commons-fileupload',\
bnd.identity;id='org.eclipse.equinox.device'
-runproperties: \
osgi.console,\
logback.configurationFile=${fileuri;${.}/logback.xml}
I try to change -runfw with felix and but then I can't find a suitable bundle implementing org.osgi.service.device ; but help works in this case.
So to summerize either my application doesn't work or I can't have help.
It might be something obvious that I missed, but I don't see it (2 days, I'm on it !!).
Thanks for any advice.
If you have a problem like this, the approach is always to remove, remove, remove. You keep removing bundles until the problems is solved. The last step you did usually puts some light on why the help did not work. And if you end up with only the Gogo bundles, it is easy to diagnose for people like me.
I would start to remove first :
org.eclipse.equinox.console;version='[1.4.300,1.4.301)',\
You now seem to have 2 shells. Should still have help though. So it is not a full explanation.
I've written a replacement for org.apache.felix.gogo.command that includes a help. Maven coordinates:
biz.aQute:biz.aQute.gogo.commands.provider:1.7.0
It also includes many more commands. Source code is on github

How does babel option ""auxiliaryCommentBefore" or "auxiliaryCommentAfter" work?

I installed Babel("babel-cli": "^6.26.0") and and made a .babelrc like
{
"auxiliaryCommentBefore": "testBefore",
"auxiliaryCommentAfter": "testAfter"
}
and also made a simple test.js like
var a = 5;
and finally run babel test.js.
It secceded but no comment above is attached..
My expectation is something like below.
testBefore
var a = 5;
testAfter
Is there anything required missing??
The honest answer to your question is "they don't" :D
The specific behavior of those two options are extremely under-defined and I would love to rip them out of Babel entirely, and I would except that I don't want to needlessly break existing users when they upgrade.
If you need to annotate some input code in a particular way, you should write your own Babel plugin to inject whatever you need instead.

Where are the docs on how to add symbol support for a language to Visual Studio Code?

I would like to add symbol support for PowerShell to VS Code but I'm not finding any docs on the code.visualstudio.com/docs site.
Also, is it possible to do this for a language like PowerShell that, for the moment, will only work on Windows? Is there a way to light up symbol support on Windows only?
BTW I've added a bunch of PowerShell snippets that I'm in the process of trying to get integrated into VS Code. Any help on how to get these snippets into the product would be appreciated as well? I did submit an issue on the snippets, suggesting that the team put these into VS Code.
There is currently no documentation for the plugin API. It's too early for this as the API is still changing with every minor release. The VSCode team is focused on providing a stable plugin API. There will be a documentation about it when it's done.
Nevertheless it is already possible to add a new language plugin or extending an exisiting one. Take a look on this short description on how to add declaration support for a new language: Create Custom Language in Visual Studio Code
You could add symbol support in a similar way. What you need is something like an abstract syntax tree builder for powershell scripts and an application or a javascript module that is able to process a JSON request in order to provide the correct symbols. An example request for outline support is this:
{
"seq":442,
"type":"request",
"command":"navbar",
"arguments":
{
"file":"c:/Users/C/Documents/projects/MyProject/MyFile.xxx"
}
}
A response could look like that:
{
"seq":442,
"type":"response",
"command":"navbar",
"request_seq":442,
"success":true,
"body":[
{
"text":"TObjA",
"kind":"class",
"kindModifiers":"",
"spans":[
{
"start":{
"line":10,
"offset":3
},
"end":{
"line":16,
"offset":4
}
}
],
"childItems":[
]
},
{
"text":"DoSomething",
"kind":"method",
"kindModifiers":"",
"spans":[
{
"start":{
"line":20,
"offset":1
},
"end":{
"line":27,
"offset":4
}
}
],
"childItems":[
]
},
]
}
I'm not sure what do you mean with "symbol support". Is it something like "jump to symbol inside the current file" using CTRL+Shift+O? Then you are looking for outlineSupport.
Is it something like "find a symbol in any file" using CTRL+P, #? Then you are looking for navigateTypesSupport.
Copy the needed .js file from the vs.langauage.csharp.o folder to the vs.langauage.powershell folder and register the support in powershellMain.js as it is done in omnisharpMain.js.
If you want to register the new support only on Windows then you can do it like this:
var isWin = /^win/.test(process.platform);
if(isWin)
monaco.Modes.NavigateTypesSupport.register('powershell', new navigateTypesSupport_1.default(ModelService, server));
I hope this helps for the moment. Don't forget to save your changed plugins in a different folder. VSCode often deletes changes in the plugin folders on update.

neo4jphp: Cannot instantiate abstract class Everyman\Neo4j\Transport

maybe a simple question but for me as starter with Neo4j a hurdle. I installed the neo4jphp with composer in the same directory as my application. Vendor-Subfolder has been created and the everyman/neo4j folder below is available. For a first test I used this code snippet from the examples:
spl_autoload_register(function ($className) {
$libPath = 'vendor\\';
$classFile = $className.'.php';
$classPath = $libPath.$classFile;
if (file_exists($classPath)) {
require($classPath);
}
});
require('vendor/autoload.php');
use everyman\Neo4j\Client,
everyman\Neo4j\Transport;
$client = new Client(new Transport('localhost', 7474));
print_r($client->getServerInfo());
I always stumple upon the error
Fatal error: Cannot instantiate abstract class Everyman\Neo4j\Transport
Googling brought me to a comment from Josh Adell stating
You can't instantiate Everyman\Neo4j\Transport, since it is an abstract class. You must instantiate Everyman\Neo4j\Transport\Curl or Everyman\Neo4j\Transport\Stream depending on your needs
So I thought I just need to alter the use-statements to
use everyman\Neo4j\Client,
everyman\Neo4j\Transport\Curl;
but this doesnt work, debugging shows, that the autoloader only get "Transport.php" instead of "everyman\Neo4j\Transport\Curl.php". For "Client.php" its still working ("vendor\everyman\Neo4j\Client.php") so I am guessing that the use-statement is wrong or the code is not able to handle an additional subfolder-structure.
Using
require('phar://neo4jphp.phar');
works fine but I read that this is deprecated and should be replaced by composer / autoload.
Anyone has a hint what to change or had the same problem?
Thanks for your time,
Balael
Curl is the default transport. You only need to instantiate your own Transport object if you want to use Stream instead of Curl. If you really want to instantiate your own Curl Transport, the easiest change to your existing code is to modify the use statement to be:
use everyman\Neo4j\Client,
everyman\Neo4j\Transport\Curl as Transport;
Also, you don't need to register your own autoload function if you are using the Composer package. vendor/autoload.php does that for you.
Thanks Josh, I was trying but it seems I still stuck somewhere. I am fine with using the default CURL - so I shrinked the code down to
require('vendor/autoload.php');
use everyman\Neo4j\Client;
$client = new Everyman\Neo4j\Client('localhost', 7474);
print_r($client->getServerInfo());`
The folder structure is main (here are the files and the composer.json with the content
{
"require": {
"everyman/Neo4j": "dev-master"
}
}
and in the subfolder "vendor" we have the "autoload.php" and the subfolder everyman with the related content. When I run the file I come out with
Fatal error: Class 'Everyman\Neo4j\Client' not found
which does not happen when I have the autoloadfunction. I guess I made a mistake somewehere - can you give me a hint?
Thanks a lot, B
Hmmm... I was just trying around and it seems the Transport CLASS is not needed in the use-statement and the class instantiation. This seems to work:
require('vendor/autoload.php');
use everyman\Neo4j\Client;
$client = new Client();
print_r($client->getServerInfo());
also valid for having a dedicated server/port:
$client = new Everyman\Neo4j\Client('localhost', 7474);
If you have more input I would be happy to learn more - thanks, all input & thoughts are very appreciated.
Balael