Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperlayout does nothing: SyntaxError #33

Open
Donaldini opened this issue Feb 1, 2018 · 4 comments
Open

Hyperlayout does nothing: SyntaxError #33

Donaldini opened this issue Feb 1, 2018 · 4 comments

Comments

@Donaldini
Copy link

I'm getting errors in my console when I try out an example.

2018-02-01 13_51_16-developer tools - file____c__users_donaldv_appdata_local_hyper_app-1 4 8_resourc

The black rectangle is Hyper, but it doesn't like to be screenshotted for some reason :)
All I did was run: hyperlayout

@AlvaroL
Copy link

AlvaroL commented Feb 3, 2018

Hi,
I am getting the same on a Windows 8.1 machine:
Hyper version: 1.4.8
hyperlayout: 0.2.1
node: 8.9.4

Apparently the problem is that the string to be parsed as JSON to the middlewares is not valid, this is the output of the string:
"{"config":{"entry":"tab","layout":[["echo 'hola'","echo 'adios'"]]},"cwd":"C:\Users\Alvaro_2"}�[0K�[?25l"
so after the correct json object is adding extra stuff. But that object has more elements that also have more extra characters:

image

I did the same as Donaldini, just create the .hyperlayout file and run hyperlayout on hyper

@peternycander
Copy link

The issue can be fixed by editing index.js:162
From const config = JSON.parse(testedData[1]) to const config = JSON.parse(testedData[1].substring(0, testedData[1].lastIndexOf('}') + 1));

@NeonWizard
Copy link

The issue can be fixed by editing index.js:162
From const config = JSON.parse(testedData[1]) to const config = JSON.parse(testedData[1].substring(0, testedData[1].lastIndexOf('}') + 1));

Tried this, ended up crashing my terminal. Not entirely sure why.

parthopdas added a commit to parthopdas/hyperlayout that referenced this issue Mar 2, 2019
Applying fix from @peternycander for issue timolins#33 as pe timolins#33 (comment)

I have tested with latest hyper 2.1.1 on Windows 10.

@timolins the pluging is not usable without this fix on Window 10. Please release.
@assisgui
Copy link

assisgui commented Apr 24, 2019

Hello guys,

I have tried to use this code to fix this error, but I had some problems.
I think this code is best when you use multiple layouts:

let dataJson = testedData['input']
            .replace('<0x1b>[0Kl<0x1b>[?25l', '')
            .replace('<0x1b>[0Kn', '')
            .replace(/(\r\n|\n|\r)/gm, '')
            .split('[hyperlayout config]:')[1]
            .split('<0x1b>[0K')[0]
            .replace('<0x1b>[0Kl<0x1b>[?25l', '');

const config = JSON.parse(dataJson);

<0x1b> is a symbol � that appear in console. I just copy and paste to replace in code.
You may have to add more symbols in .replace because different symbols appear depending on my configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants