RefactoringRope/CodeAssistClient.py

changeset 291
da88cb84ae30
parent 251
4dcc73076100
child 293
dd1c7ed6d880
equal deleted inserted replaced
290:6b3530ce34d0 291:da88cb84ae30
28 28
29 class CodeAssistClient(JsonClient): 29 class CodeAssistClient(JsonClient):
30 """ 30 """
31 Class implementing the code assist client interface to rope. 31 Class implementing the code assist client interface to rope.
32 """ 32 """
33 PictureIDs = {
34 "class": "?{0}".format(1), # Editor.ClassID
35 "_class": "?{0}".format(2), # Editor.ClassProtectedID
36 "__class": "?{0}".format(3), # Editor.ClassPrivateID
37 "instance": "?{0}".format(1), # Editor.ClassID
38 "_instance": "?{0}".format(2), # Editor.ClassProtectedID
39 "__instance": "?{0}".format(3), # Editor.ClassPrivateID
40 "function": "?{0}".format(4), # Editor.MethodID
41 "_function": "?{0}".format(5), # Editor.MethodProtectedID
42 "__function": "?{0}".format(6), # Editor.MethodPrivateID
43 "module": "?{0}".format(7), # Editor.AttributeID
44 "_module": "?{0}".format(8), # Editor.AttributeProtectedID
45 "__module": "?{0}".format(9), # Editor.AttributePrivateID
46 "None": "",
47 }
48 # The various ID values are a copy of the ones found in the Editor
49 # class in order to make this module/script independent from an
50 # installed eric
51
52 def __init__(self, host, port, idString, projectPath): 33 def __init__(self, host, port, idString, projectPath):
53 """ 34 """
54 Constructor 35 Constructor
55 36
56 @param host ip address the background service is listening 37 @param host ip address the background service is listening
179 proposalType = proposal.type 160 proposalType = proposal.type
180 if proposal.name.startswith("__"): 161 if proposal.name.startswith("__"):
181 proposalType = "__" + proposalType 162 proposalType = "__" + proposalType
182 elif proposal.name.startswith("_"): 163 elif proposal.name.startswith("_"):
183 proposalType = "_" + proposalType 164 proposalType = "_" + proposalType
184 completions.append( 165 completions.append({
185 proposal.name + self.PictureIDs[proposalType]) 166 "Name": proposal.name,
167 "CompletionType": proposalType,
168 })
186 except Exception as err: 169 except Exception as err:
187 errorDict = self.__handleRopeError(err) 170 errorDict = self.__handleRopeError(err)
188 171
189 result = { 172 result = {
190 "Completions": completions, 173 "Completions": completions,

eric ide

mercurial