Fri, 01 Jan 2016 12:19:02 +0100
Updated copyright for 2016.
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
144
bfc6a3b38330
Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
119
diff
changeset
|
3 | # Copyright (c) 2008 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the autocompletion interface to rope. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
101
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
10 | from __future__ import unicode_literals |
5098ad8960ed
Fixed issues connecting/disconnecting editors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
100
diff
changeset
|
11 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | import os |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | import sys |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | sys.path.insert(0, os.path.dirname(__file__)) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | if sys.version_info[0] >= 3: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | path = os.path.join(os.path.dirname(__file__), 'rope_py3') |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | path = os.path.join(os.path.dirname(__file__), 'rope_py2') |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | str = unicode # __IGNORE_WARNING__ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | sys.path.insert(0, path) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | import rope.base.libutils |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | import rope.contrib.codeassist |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | from PyQt5.QtCore import QObject |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
28 | from QScintilla.Editor import Editor |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
29 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
30 | import Globals |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
31 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
32 | |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | class CodeAssist(QObject): |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | Class implementing the autocompletion interface to rope. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
37 | PictureIDs = { |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
38 | "class": "?{0}".format(Editor.ClassID), |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
39 | "instance": "?{0}".format(Editor.ClassID), |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
40 | "function": "?{0}".format(Editor.MethodID), |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
41 | "module": "?{0}".format(Editor.AttributeID), |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
42 | "None": "", |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
43 | } |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
44 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
45 | def __init__(self, plugin, parent=None): |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | Constructor |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | @param plugin reference to the plugin object |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @param parent parent (QObject) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | QObject.__init__(self, parent) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__plugin = plugin |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
55 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
56 | self.__project = rope.base.project.Project(Globals.getConfigDir()) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
57 | self.__project.validate(self.__project.root) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
59 | def getCompletions(self, editor): |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | Public method to calculate the possible completions. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
63 | @param editor reference to the editor object, that called this method |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
64 | QScintilla.Editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | @return list of proposals (QStringList) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | """ |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
67 | filename = editor.getFileName() |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | if filename: |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
69 | resource = rope.base.libutils.path_to_resource( |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
70 | self.__project, filename) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | resource = None |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
73 | line, index = editor.getCursorPosition() |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
74 | source = editor.text() |
103
2d77b3afc98f
Changed the way the offset into the text gets calculated because rope handles unicode characters as one character (i.e. string) and QScintilla as multiple (i.e. bytes).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
101
diff
changeset
|
75 | offset = len("".join(source.splitlines(True)[:line])) + index |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | maxfixes = self.__plugin.getPreferences("MaxFixes") |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | try: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | proposals = rope.contrib.codeassist.code_assist( |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
79 | self.__project, source, offset, resource, maxfixes=maxfixes) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | proposals = rope.contrib.codeassist.sorted_proposals(proposals) |
119
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
81 | names = [proposal.name + self.PictureIDs[proposal.type] |
a03f2be1997b
Added some eye-candy and made the method to get a list of completions publicly available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
118
diff
changeset
|
82 | for proposal in proposals] |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | return names |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | except Exception: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | return [] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
87 | def getCallTips(self, pos, editor): |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | """ |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | Public method to calculate calltips. |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
91 | @param pos position in the text for the calltip (integer) |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
92 | @param editor reference to the editor object, that called this method |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
93 | QScintilla.Editor) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | @return list of possible calltips (list of strings) |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | """ |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
96 | filename = editor.getFileName() |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | if filename: |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
98 | resource = rope.base.libutils.path_to_resource( |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
99 | self.__project, filename) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | resource = None |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
102 | source = editor.text() |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | maxfixes = self.__plugin.getPreferences("CalltipsMaxFixes") |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | try: |
105
45872a13d197
Refined the offset calculation for call tips.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
104
diff
changeset
|
105 | line, index = editor.lineIndexFromPosition(pos) |
45872a13d197
Refined the offset calculation for call tips.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
104
diff
changeset
|
106 | offset = len("".join(source.splitlines(True)[:line])) + index |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | cts = rope.contrib.codeassist.get_calltip( |
118
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
108 | self.__project, source, offset, resource, maxfixes=maxfixes, |
d242ba11a04c
Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
106
diff
changeset
|
109 | remove_self=True) |
100
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | if cts is not None: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | cts = [cts] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | else: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | cts = [] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | except Exception: |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | cts = [] |
2bfe9e3fad8d
Ported the code completion and calltips support of the eric4 variant of this plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | return cts |
104
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
117 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
118 | def reportChanged(self, filename, oldSource): |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
119 | """ |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
120 | Public slot to report some changed sources. |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
121 | |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
122 | @param filename file name of the changed source (string) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
123 | @param oldSource source code before the change (string) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
124 | """ |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
125 | try: |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
126 | rope.base.libutils.report_change( |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
127 | self.__project, filename, oldSource) |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
128 | except RuntimeError: |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
129 | # this could come from trying to do PyQt4/PyQt5 mixed stuff |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
130 | # simply ignore it |
f6049d39f83d
Made the code completion work in case no project is open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
103
diff
changeset
|
131 | pass |