254 apiCompletionsList = [] |
256 apiCompletionsList = [] |
255 docCompletionsList = [] |
257 docCompletionsList = [] |
256 projectCompletionList = [] |
258 projectCompletionList = [] |
257 sep = "" |
259 sep = "" |
258 if context: |
260 if context: |
259 wc = editor.wordCharacters() |
261 wc = re.sub("\w", "", editor.wordCharacters()) |
260 text = editor.text(line) |
262 text = editor.text(line) |
261 |
263 |
262 beg = text[:col] |
264 beg = text[:col] |
263 for wsep in editor.getLexer().autoCompletionWordSeparators(): |
265 for wsep in editor.getLexer().autoCompletionWordSeparators(): |
264 if beg.endswith(wsep): |
266 if beg.endswith(wsep): |
265 sep = wsep |
267 sep = wsep |
266 break |
268 break |
267 |
269 |
268 depth = 0 |
270 depth = 0 |
269 while col > 0 and text[col - 1] not in wc: |
271 while col > 0 and \ |
|
272 (not text[col - 1].isalnum() or \ |
|
273 (wc and text[col - 1] not in wc)): |
270 ch = text[col - 1] |
274 ch = text[col - 1] |
271 if ch == ')': |
275 if ch == ')': |
272 depth = 1 |
276 depth = 1 |
273 |
277 |
274 # ignore everything back to the start of the |
278 # ignore everything back to the start of the |
375 currentPos = editor.currentPosition() |
379 currentPos = editor.currentPosition() |
376 completionsList = [] |
380 completionsList = [] |
377 if context: |
381 if context: |
378 word += sep |
382 word += sep |
379 |
383 |
380 res = editor.findFirstTarget(word, False, editor.autoCompletionCaseSensitivity(), |
384 if editor.isUtf8(): |
|
385 sword = word.encode("utf-8") |
|
386 else: |
|
387 sword = word |
|
388 res = editor.findFirstTarget(sword, False, |
|
389 editor.autoCompletionCaseSensitivity(), |
381 False, begline = 0, begindex = 0, ws_ = True) |
390 False, begline = 0, begindex = 0, ws_ = True) |
382 while res: |
391 while res: |
383 start, length = editor.getFoundTarget() |
392 start, length = editor.getFoundTarget() |
384 pos = start + length |
393 pos = start + length |
385 if pos != currentPos: |
394 if pos != currentPos: |
386 if context: |
395 if context: |
387 completion = "" |
396 completion = "" |
388 else: |
397 else: |
389 completion = word |
398 completion = word |
390 ch = editor.charAt(pos) |
399 line, index = editor.lineIndexFromPosition(pos) |
391 while editor.isWordCharacter(ch): |
400 curWord = editor.getWord(line, index, useWordChars = False) |
392 completion += ch |
401 completion += curWord[len(completion):] |
393 pos += 1 |
|
394 ch = editor.charAt(pos) |
|
395 if completion and completion not in completionsList: |
402 if completion and completion not in completionsList: |
396 completionsList.append( |
403 completionsList.append( |
397 "{0}?{1}".format(completion, self.__fromDocumentID)) |
404 "{0}?{1}".format(completion, self.__fromDocumentID)) |
398 |
405 |
399 res = editor.findNextTarget() |
406 res = editor.findNextTarget() |
433 language = editor.getLanguage() |
440 language = editor.getLanguage() |
434 if language == "": |
441 if language == "": |
435 return |
442 return |
436 |
443 |
437 line, col = editor.lineIndexFromPosition(pos) |
444 line, col = editor.lineIndexFromPosition(pos) |
438 wc = editor.wordCharacters() |
445 wc = re.sub("\w", "", editor.wordCharacters()) |
439 text = editor.text(line) |
446 text = editor.text(line) |
440 while col > 0 and text[col - 1] not in wc: |
447 while col > 0 and \ |
|
448 (not text[col - 1].isalnum() or \ |
|
449 (wc and text[col - 1] not in wc)): |
441 col -= 1 |
450 col -= 1 |
442 word = editor.getWordLeft(line, col) |
451 word = editor.getWordLeft(line, col) |
443 |
452 |
444 apiCalltips = [] |
453 apiCalltips = [] |
445 projectCalltips = [] |
454 projectCalltips = [] |