src/eric7/QScintilla/Editor.py

branch
eric7
changeset 9925
a267ac36dd69
parent 9853
080e060a0383
child 9926
6222ddc7e1bd
--- a/src/eric7/QScintilla/Editor.py	Mon Mar 20 10:43:29 2023 +0100
+++ b/src/eric7/QScintilla/Editor.py	Mon Mar 20 16:08:35 2023 +0100
@@ -2288,6 +2288,20 @@
 
         return False
 
+    def isProjectFile(self):
+        """
+        Public method to check, if the file of the editor belongs to the current
+        project.
+
+        @return flag indicating a project file
+        @rtype bool
+        """
+        return (
+            bool(self.fileName)
+            and self.project.isOpen()
+            and self.project.isProjectFile(self.fileName)
+        )
+
     def highlightVisible(self):
         """
         Public method to make sure that the highlight is visible.
@@ -6120,8 +6134,25 @@
             if Preferences.getEditor("OnlineSyntaxCheck"):
                 self.__onlineSyntaxCheckTimer.stop()
 
+        if self.isPy3File():
+            additionalBuiltins = (
+                self.project.getData("CHECKERSPARMS", "SyntaxChecker", {}).get(
+                    "AdditionalBuiltins", []
+                )
+                if self.isProjectFile()
+                else Preferences.getFlakes("AdditionalBuiltins")
+            )
             self.syntaxCheckService.syntaxCheck(
-                fileType, self.fileName or "(Unnamed)", self.text()
+                fileType,
+                self.fileName or "(Unnamed)",
+                self.text(),
+                additionalBuiltins,
+            )
+        else:
+            self.syntaxCheckService.syntaxCheck(
+                fileType,
+                self.fileName or "(Unnamed)",
+                self.text(),
             )
 
     def __processSyntaxCheckError(self, fn, msg):

eric ide

mercurial