Plugins/PluginSyntaxChecker.py

changeset 3438
29717a5e8b97
parent 3345
071afe8be2a1
child 3446
5a670e55adbb
--- a/Plugins/PluginSyntaxChecker.py	Tue Mar 25 19:36:31 2014 +0100
+++ b/Plugins/PluginSyntaxChecker.py	Wed Mar 26 20:03:25 2014 +0100
@@ -150,7 +150,7 @@
         if menuName == "Checks" and self.__projectAct is not None:
             self.__projectAct.setEnabled(
                 e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python"])
+                ["Python3", "Python2", "Python", "JavaScript"])
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
@@ -162,7 +162,7 @@
         """
         if menuName == "Checks" and \
            e5App().getObject("Project").getProjectLanguage() in \
-                ["Python3", "Python2", "Python"]:
+                ["Python3", "Python2", "Python", "JavaScript"]:
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:
                 self.__projectBrowserAct = E5Action(
@@ -189,7 +189,8 @@
                  for file in project.pdata["SOURCES"]
                  if file.endswith(
                      tuple(Preferences.getPython("Python3Extensions")) +
-                     tuple(Preferences.getPython("PythonExtensions")))]
+                     tuple(Preferences.getPython("PythonExtensions")) +
+                     (".js", ))]
         
         from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \
             SyntaxCheckerDialog
@@ -252,7 +253,10 @@
             if not self.__editorAct in menu.actions():
                 menu.addAction(self.__editorAct)
             self.__editorAct.setEnabled(
-                editor.isPy3File() or editor.isPy2File())
+                editor.isPy3File() or 
+                editor.isPy2File() or 
+                editor.isJavascriptFile()
+            )
     
     def __editorSyntaxCheck(self):
         """
@@ -261,9 +265,13 @@
         """
         editor = e5App().getObject("ViewManager").activeWindow()
         if editor is not None:
-                from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \
-                    SyntaxCheckerDialog
-                self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog()
-                self.__editorSyntaxCheckerDialog.show()
-                self.__editorSyntaxCheckerDialog.start(
-                    editor.getFileName() or "Unnamed.py", editor.text())
+            from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \
+                SyntaxCheckerDialog
+            self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog()
+            self.__editorSyntaxCheckerDialog.show()
+            if editor.isJavascriptFile():
+                unnamed = "Unnamed.js"
+            else:
+                unnamed = "Unnamed.py"
+            self.__editorSyntaxCheckerDialog.start(
+                editor.getFileName() or unnamed, editor.text())

eric ide

mercurial