def filter(self, context): for candidate in context['candidates']: if isabs(candidate['word']): candidate['abbr'] = relpath( self.vim, candidate.get('action__path', candidate['word'])) return context['candidates']
def filter(self, context: UserContext) -> Candidates: for candidate in context['candidates']: if isabs(candidate['word']): candidate['abbr'] = relpath( self.vim, candidate.get('action__path', candidate['word'])) return list(context['candidates'])
def filter(self, context): for candidate in context['candidates']: if isabs(candidate['word']): candidate['word'] = relpath( self.vim, candidate.get('action__path', candidate['word'])) return context['candidates']
def gather_candidates(self, context): candidates = self.vim.call('luaeval', 'require("denite-utils.lsp").references()') return [{ 'word': '{}:{}:{} {}'.format(relpath(self.vim, x['filename']), x['lnum'], x['col'], x['text']), 'action__path': x['filename'], 'action__line': x['lnum'], 'action__col': x['col'], } for x in candidates]
def scoreMatchesProxy(self, q, c, limit, key=None, ispath=True, buffer=0): relname = "" if ispath and buffer > 0 and q == "": fname = self.vim.buffers[buffer].name relname = relpath(self.vim, fname) if self.useNative: idxArr = self.nativeMethod(q, [key(d) for d in c], relname, limit, ispath) results = [] for i in idxArr: idx, score = i results.append((c[idx], score)) return results else: return fruzzy.scoreMatches(q, c, relname, limit, key, ispath)
def _parse(self, context): jump_list = [] for b in self.vim.buffers: self.debug(b.name) for row_data in self.vim.call('execute', 'jumps').split('\n'): elements = row_data.split(maxsplit=3) if not elements: continue # If file/text is whitespace and it was deleted by split method # element[4] is file/text if len(elements) == 3: elements.append('') if elements[0] == '>' and len(elements) > 1: # skip the '>' sign elements = elements[1:] # split last element and concate # , because we just split three times last_element = elements[-1] elements = elements[:-1] elements.extend(last_element.split(maxsplit=1)) file_text = elements[-1] # if '>' point nothing if elements[0] == '>' and len(elements) == 1: cur_pos = self.vim.call('getcurpos') lnum, col = cur_pos[1], cur_pos[2] path = self.vim.current.buffer.name word = row_data # if '>' point something, and first three filed is digit elif elements[0].isdigit() and elements[1].isdigit() and \ elements[2].isdigit(): lnum, col = int(elements[1]), int(elements[2]) + 1 file_text_is_path = False for b in self.vim.buffers: rel_path = relpath(self.vim, b.name) if rel_path == file_text.strip(): file_text_is_path = True path = b.name prefix = 'file: ' break if not file_text_is_path: path = self.vim.current.buffer.name prefix = 'text: ' if file_text != '-invalid-' else '' m = re.search('(^>*\s+\w+\s+\w+\s+\w+)', row_data) word = m.group(0) + ' ' + prefix + file_text else: continue jump_list.append({ 'word': word, 'action__path': self.vim.call('fnamemodify', path, ':p'), 'action__line': lnum, 'action__col': col, }) return jump_list
def _parse(self, context): jump_list = [] for b in self.vim.buffers: self.debug(b.name) for row_data in self.vim.call('execute', 'jumps').split('\n'): elements = row_data.split(maxsplit=3) if not elements: continue # If file/text is whitespace and it was deleted by split method # element[4] is file/text if len(elements) == 3: elements.append('') if elements[0] == '>' and len(elements) > 1: # skip the '>' sign elements = elements[1:] # split last element and concate # , because we just split three times last_element = elements[-1] elements = elements[:-1] elements.extend(last_element.split(maxsplit=1)) file_text = elements[-1] # if '>' point nothing if elements[0] == '>' and len(elements) == 1: cur_pos = self.vim.call('getcurpos') lnum, col = cur_pos[1], cur_pos[2] path = self.vim.current.buffer.name word = row_data # if '>' point something, and first three filed is digit elif elements[0].isdigit() and elements[1].isdigit() and \ elements[2].isdigit(): lnum, col = int(elements[1]), int(elements[2]) + 1 file_text_is_path = False for b in self.vim.buffers: rel_path = relpath(self.vim, b.name) if rel_path == file_text.strip(): file_text_is_path = True path = b.name prefix = 'file: ' break if not file_text_is_path: path = self.vim.current.buffer.name prefix = 'text: ' if file_text != '-invalid-' else '' m = re.search(r'(^>*\s+\w+\s+\w+\s+\w+)', row_data) word = m.group(0) + ' ' + prefix + file_text else: continue jump_list.append({ 'word': word, 'action__path': self.vim.call('fnamemodify', path, ':p'), 'action__line': lnum, 'action__col': col, }) return jump_list
def filter(self, context): for candidate in context['candidates']: if isabs(candidate['word']): candidate['word'] = relpath(self.vim, candidate['word']) return context['candidates']
def filter(self, context): for candidate in context['candidates']: if isabs(candidate['word']): candidate['abbr'] = relpath(self.vim, candidate['word']) return context['candidates']