116 editor.editorSaved.connect( |
114 editor.editorSaved.connect( |
117 self.__apisManager.getAPIs(ApisNameProject).editorSaved) |
115 self.__apisManager.getAPIs(ApisNameProject).editorSaved) |
118 self.__editors.append(editor) |
116 self.__editors.append(editor) |
119 |
117 |
120 # preload the api to give the manager a chance to prepare the database |
118 # preload the api to give the manager a chance to prepare the database |
121 try: |
119 language = editor.getApiLanguage() |
122 language = editor.getApiLanguage() |
|
123 except AttributeError: |
|
124 # backward compatibility < 16.12 |
|
125 language = editor.apiLanguage |
|
126 if language: |
120 if language: |
127 projectType = self.__getProjectType(editor) |
121 projectType = self.__getProjectType(editor) |
128 self.__apisManager.getAPIs(language, projectType=projectType) |
122 self.__apisManager.getAPIs(language, projectType=projectType) |
129 |
123 |
130 def __editorClosed(self, editor): |
124 def __editorClosed(self, editor): |
156 @type Editor |
150 @type Editor |
157 @return project type |
151 @return project type |
158 @rtype str |
152 @rtype str |
159 """ |
153 """ |
160 filename = editor.getFileName() |
154 filename = editor.getFileName() |
161 if ( |
155 projectType = ( |
162 self.__project.isOpen() and |
156 self.__project.getProjectType() |
163 filename and |
157 if (self.__project.isOpen() and |
164 self.__project.isProjectFile(filename) |
158 filename and |
165 ): |
159 self.__project.isProjectFile(filename)) else |
166 projectType = self.__project.getProjectType() |
160 "" |
167 else: |
161 ) |
168 projectType = "" |
|
169 |
162 |
170 return projectType |
163 return projectType |
171 |
164 |
172 ################################# |
165 ################################# |
173 ## auto-completion methods below |
166 ## auto-completion methods below |
215 @param editor reference to the editor object, that called this method |
208 @param editor reference to the editor object, that called this method |
216 (QScintilla.Editor) |
209 (QScintilla.Editor) |
217 @param context flag indicating to autocomplete a context (boolean) |
210 @param context flag indicating to autocomplete a context (boolean) |
218 @return list of possible completions (list of strings) |
211 @return list of possible completions (list of strings) |
219 """ |
212 """ |
220 try: |
213 language = editor.getApiLanguage() |
221 language = editor.getApiLanguage() |
|
222 except AttributeError: |
|
223 # backward compatibility < 16.12 |
|
224 language = editor.apiLanguage |
|
225 |
|
226 completeFromDocumentOnly = False |
214 completeFromDocumentOnly = False |
227 if language in ["", "Guessed"] or language.startswith("Pygments|"): |
215 if language in ["", "Guessed"] or language.startswith("Pygments|"): |
228 if ( |
216 if ( |
229 self.__plugin.getPreferences("AutoCompletionSource") & |
217 self.__plugin.getPreferences("AutoCompletionSource") & |
230 AcsDocument |
218 AcsDocument |
716 @param pos position in the text for the calltip (integer) |
702 @param pos position in the text for the calltip (integer) |
717 @param commas minimum number of commas contained in the calltip |
703 @param commas minimum number of commas contained in the calltip |
718 (integer) |
704 (integer) |
719 @return list of possible calltips (list of strings) |
705 @return list of possible calltips (list of strings) |
720 """ |
706 """ |
721 try: |
707 language = editor.getApiLanguage() |
722 language = editor.getApiLanguage() |
|
723 except AttributeError: |
|
724 # backward compatibility < 16.12 |
|
725 language = editor.apiLanguage |
|
726 |
|
727 completeFromDocumentOnly = False |
708 completeFromDocumentOnly = False |
728 if language in ["", "Guessed"] or language.startswith("Pygments|"): |
709 if language in ["", "Guessed"] or language.startswith("Pygments|"): |
729 if ( |
710 if ( |
730 self.__plugin.getPreferences("AutoCompletionSource") & |
711 self.__plugin.getPreferences("AutoCompletionSource") & |
731 AcsDocument |
712 AcsDocument |