gmasterscm / ama

Ask me anything!
https://blog.sindresorhus.com/answering-anything-678ce5623798
5 stars 1 forks source link

How to configure Semantic JS external parser? #31

Open jesuissur opened 6 years ago

jesuissur commented 6 years ago

Hi guys

We've tried to configure the Javascript parser (available from http://www.semanticmerge.com/parsers/semanticmerge-js-parser.zip) and got an error message (There was an error starting the parser: module.js:472)

This is our externalparsers.conf content .js=node.exe "%LOCALAPPDATA%\gmaster\config\ExternalPasrers\javascript\jsparser\run.js"

Thanks Phil

SergioLuis commented 6 years ago

Hi, thank you for reaching out!

Let me test your setup myself, and I'll come back to you as soon as possible with a solution :)

SergioLuis commented 6 years ago

Ouch, it seems that you have hit a bug in the way gmaster handles external parsers that rely on another program to run (such as the JVM or, in this case, node.exe).

I'll try to get it fixed ASAP. Meanwhile, here is a workaround that should help you:

Create a launch.bat file at %LOCALAPPDATA%\gmaster\config\ExternalParsers\javascript with the following content (make sure the paths are OK!):

@echo off

%LOCALAPPDATA%\gmaster\config\ExternalParsers\javascript\thirdparty\node\x64\node.exe %LOCALAPPDATA%\gmaster\config\ExternalParsers\javascript\jsparser\run.js %*

Then, modify your externalparsers.conf file as follows:

.js=C:\Users\<username>\AppData\Local\gmaster\config\ExternalParsers\javascript\launch.bat

Please note that you'll have to replace <username> for your username. gmaster does not expand environment variables such as %LOCALAPPDATA% here.

Please let me know if this worked for you. I'm sorry for the inconvenience.

jesuissur commented 6 years ago

Thanks Sergio

The workaround seems to work, but I get the following error (from the parser I guess) image

SergioLuis commented 6 years ago

I hit that error while testing the workaround. Check that all of the paths are OK and really exists, (ExternalPasrers / ExternalParsers). Try to manually execute the bat file from CMD or PowerShell the following way:

PS C:\Users\sergi\AppData\Local\gmaster\config\externalparsers\javascript> launch.bat shell file.txt

If it ends inmediately instead of waiting for more input, the contents of the bat file are wrong (the @echo off at the beginning of the file is really important!)

If the error persists, please send me your log file (located at %LOCALAPPDATA%\gmaster\logs\gmaster.log.txt) to sluisp [at] codicesoftware [dot] com and I'll gladly help you debug this issue.