Sublime-EvalPrinter icon indicating copy to clipboard operation
Sublime-EvalPrinter copied to clipboard

Doesn't recognize language when javascript is within a .html file.

Open nickwelsh1 opened this issue 8 years ago • 2 comments

Even when the default language is set to Javascript. EvalPrinter still returns - "Couldn't determine a supported language. Maybe you want to set the default_language setting."

nickwelsh1 avatar May 06 '16 01:05 nickwelsh1

You can modify the EvalPrinter.py as such

        if "Python" in syntax:
            output = EvalEvaluator.runPython(codeStr)
        elif "JavaScript" in syntax:
            output = EvalEvaluator.runJavaScript(codeStr)
        elif "HTML" in syntax:
            output = EvalEvaluator.runJavaScript(codeStr)
        elif "Bash" in syntax:
            output = EvalEvaluator.runBash(codeStr)
        elif "PHP" in syntax:
            output = EvalEvaluator.runPHP(codeStr)
        elif "CoffeeScript" in syntax:
            output = EvalEvaluator.runCoffee(codeStr)
        else:
            output = "Couldn't determine a supported language. Maybe you want to set the default_language setting."

Ideally though, the evalprinter should determine the type from the current scope.

basaran avatar Oct 08 '19 18:10 basaran

I made some changes to identify the scope instead of the syntax, you can pull from here:

https://github.com/basaran/Sublime-EvalPrinter

You can also run the eval on an empty line to evaluate the whole file.

basaran avatar Oct 09 '19 01:10 basaran