Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions plugin/rtags.vim
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,9 @@ function! rtags#getCurrentLocation()
return printf("%s:%s:%s", expand("%:p"), lnum, col)
endfunction

function! rtags#SymbolInfoHandler(output)
echo join(a:output, "\n")
endfunction

function! rtags#SymbolInfo()
call rtags#ExecuteThen({ '-U' : rtags#getCurrentLocation() }, [function('rtags#SymbolInfoHandler')])
let result = rtags#ExecuteRC({ '-U' : rtags#getCurrentLocation() })
echo join(result, "\n")
endfunction

function! rtags#cloneCurrentBuffer(type)
Expand Down Expand Up @@ -847,24 +844,26 @@ function! rtags#ProjectListHandler(output)
endfor
let choice = input('Choice: ')
if choice > 0 && choice <= len(projects)
call rtags#ProjectOpen(projects[choice-1])
let project = substitute(projects[choice-1], '\s\+<=$', '', '')
call rtags#ProjectOpen(project)
endif
endfunction

function! rtags#ProjectList()
call rtags#ExecuteThen({ '-w' : '' }, [function('rtags#ProjectListHandler')])
let result = rtags#ExecuteRC({ '-w' : '' })
call rtags#ExecuteHandlers(result, [function('rtags#ProjectListHandler')])
endfunction

function! rtags#ProjectOpen(pattern)
call rtags#ExecuteThen({ '-w' : a:pattern }, [])
call rtags#ExecuteRC({ '-w' : a:pattern })
endfunction

function! rtags#LoadCompilationDb(pattern)
call rtags#ExecuteThen({ '-J' : a:pattern }, [])
call rtags#ExecuteRC({ '-J' : a:pattern })
endfunction

function! rtags#ProjectClose(pattern)
call rtags#ExecuteThen({ '-u' : a:pattern }, [])
call rtags#ExecuteRC({ '-u' : a:pattern })
endfunction

function! rtags#PreprocessFileHandler(result)
Expand Down
17 changes: 9 additions & 8 deletions plugin/vimrtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

import logging
tempdir = tempfile.gettempdir()
logging.basicConfig(filename='%s/vim-rtags-python.log' % tempdir,level=logging.DEBUG)
file_handler = logging.FileHandler(f'{tempdir}/vim-rtags-python.log')
logger = logging.getLogger(__name__)
logger.addHandler(file_handler)
logger.setLevel('DEBUG')

def get_identifier_beginning():
line = vim.eval('s:line')
column = int(vim.eval('s:start'))

logging.debug(line)
logging.debug(column)
logger.debug(line)
logger.debug(column)

while column >= 0 and (line[column].isalnum() or line[column] == '_'):
column -= 1
Expand All @@ -41,7 +44,6 @@ def run_rc_command(arguments, content = None):
out = out.decode(encoding)
if not err is None:
err = err.decode(encoding)

elif sys.version_info.major == 3 and sys.version_info.minor < 5:
r = subprocess.Popen(
cmdline.split(),
Expand All @@ -65,7 +67,7 @@ def run_rc_command(arguments, content = None):
out, err = r.communicate(input=content)

if r.returncode != 0:
logging.debug(err)
logger.debug(err)
return None

return out
Expand All @@ -76,7 +78,7 @@ def get_rtags_variable(name):

def parse_completion_result(data):
result = json.loads(data)
logging.debug(result)
logger.debug(result)
completions = []

for c in result['completions']:
Expand Down Expand Up @@ -107,7 +109,6 @@ def send_completion_request():
prefix = vim.eval('s:prefix')

for buffer in vim.buffers:
logging.debug(buffer.name)
if buffer.name == filename:
lines = [x for x in buffer]
content = '\n'.join(lines[:line - 1] + [lines[line - 1] + prefix] + lines[line:])
Expand Down Expand Up @@ -142,7 +143,7 @@ def display_locations(errors, buffer):

def display_diagnostics_results(data, buffer):
data = json.loads(data)
logging.debug(data)
logger.debug(data)

check_style = data['checkStyle']
vim.command('sign unplace *')
Expand Down