QScintilla/Editor.py

branch
maintenance
changeset 6004
548a9ba8c970
parent 5949
22657f04f332
parent 5987
6e33e83b215d
child 6050
25a4ddb25ca4
--- a/QScintilla/Editor.py	Sun Nov 19 13:06:01 2017 +0100
+++ b/QScintilla/Editor.py	Sat Dec 02 12:40:22 2017 +0100
@@ -1414,6 +1414,10 @@
         @keyparam propagate flag indicating to propagate the change (boolean)
         @keyparam pyname name of the pygments lexer to use (string)
         """
+        # clear all warning and syntax error markers
+        self.clearSyntaxError()
+        self.clearWarnings()
+        
         self.menuActs["MonospacedFont"].setChecked(False)
         
         self.__lexerReset = False
@@ -1426,7 +1430,7 @@
         if initTextDisplay:
             self.__setTextDisplay()
         
-        # set the autocompletion and calltips function
+        # set the auto-completion and call-tips function
         self.__setAutoCompletion()
         self.__setCallTips()
         
@@ -1599,13 +1603,16 @@
         if pyname:
             self.apiLanguage = "Pygments|{0}".format(pyname)
         else:
-            # Change API language for lexer where QScintilla reports
-            # an abbreviated name.
-            self.apiLanguage = self.lexer_.language()
-            if self.apiLanguage == "POV":
-                self.apiLanguage = "Povray"
-            elif self.apiLanguage == "PO":
-                self.apiLanguage = "Gettext"
+            if language == "Protocol":
+                self.apiLanguage = language
+            else:
+                # Change API language for lexer where QScintilla reports
+                # an abbreviated name.
+                self.apiLanguage = self.lexer_.language()
+                if self.apiLanguage == "POV":
+                    self.apiLanguage = "Povray"
+                elif self.apiLanguage == "PO":
+                    self.apiLanguage = "Gettext"
         self.setLexer(self.lexer_)
         self.__setMarginsDisplay()
         if self.lexer_.lexer() == "container" or self.lexer_.lexer() is None:
@@ -4571,7 +4578,6 @@
     ## auto-completion hook interfaces
     #################################################################
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def addCompletionListHook(self, key, func, async=False):
         """
         Public method to set an auto-completion list provider.
@@ -4610,7 +4616,6 @@
         else:
             self.__completionListHookFunctions[key] = func
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def removeCompletionListHook(self, key):
         """
         Public method to remove a previously registered completion list
@@ -4631,7 +4636,6 @@
                 self.setAutoCompletionThreshold(
                     Preferences.getEditor("AutoCompletionThreshold"))
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def getCompletionListHook(self, key):
         """
         Public method to get the registered completion list provider.
@@ -4714,7 +4718,6 @@
             if Preferences.getEditor("AutoCompletionScintillaOnFail"):
                 self.__acWatchdog.start()
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def completionsListReady(self, completions, acText):
         """
         Public method to show the completions determined by a completions
@@ -4727,7 +4730,7 @@
         """
         # process the list only, if not already obsolete ...
         if acText != self.__acText:
-           return
+            return
         
         self.__acCompletions.update(set(completions))
         
@@ -4738,8 +4741,8 @@
             self.__acWatchdog.stop()
             
             # Autocomplete with QScintilla if no results present
-            if (Preferences.getEditor("AutoCompletionScintillaOnFail")
-                    and not self.__acCompletions):
+            if Preferences.getEditor("AutoCompletionScintillaOnFail") and \
+               not self.__acCompletions:
                 self.autoCompleteQScintilla()
                 return
         
@@ -4834,7 +4837,6 @@
     ## call-tip hook interfaces
     #################################################################
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def addCallTipHook(self, key, func):
         """
         Public method to set a calltip provider.
@@ -4860,7 +4862,6 @@
         
         self.__ctHookFunctions[key] = func
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def removeCallTipHook(self, key):
         """
         Public method to remove a previously registered calltip provider.
@@ -4871,7 +4872,6 @@
         if key in self.__ctHookFunctions:
             del self.__ctHookFunctions[key]
     
-    # TODO: document this hook in chapter 6.2 of plug-in document
     def getCallTipHook(self, key):
         """
         Public method to get the registered calltip provider.

eric ide

mercurial