Permalink
Browse files

Finish gotoDeclaration.

  • Loading branch information...
1 parent ca69d7a commit 75671d82eed0651f3396b3604f2b9980e6143bce @Rip-Rip committed Mar 5, 2013
Showing with 7 additions and 4 deletions.
  1. +1 −1 plugin/clang_complete.vim
  2. +6 −3 plugin/libclang.py
@@ -139,7 +139,7 @@ function! s:ClangCompleteInit()
inoremap <expr> <buffer> > <SID>CompleteArrow()
inoremap <expr> <buffer> : <SID>CompleteColon()
inoremap <expr> <buffer> <CR> <SID>HandlePossibleSelectionEnter()
- nnoremap <buffer> <silent> <C-]> :call <SID>GotoDeclaration()<CR>
+ nnoremap <buffer> <silent> <C-]> :call <SID>GotoDeclaration()<CR><Esc>
nnoremap <buffer> <silent> <C-T> <C-O>
if g:clang_snippets == 1
View
@@ -158,7 +158,8 @@ def getCurrentTranslationUnit(args, currentFile, fileName, timer,
timer.registerEvent("Reparsing")
return tu
- flags = TranslationUnit.PARSE_PRECOMPILED_PREAMBLE
+ flags = TranslationUnit.PARSE_PRECOMPILED_PREAMBLE | \
+ TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD
tu = index.parse(fileName, args, [currentFile], flags)
timer.registerEvent("First parse")
@@ -501,21 +502,23 @@ def getAbbr(strings):
def jumpToLocation(filename, line, column):
if filename != vim.current.buffer.name:
vim.command("edit! %s" % filename)
+ else:
+ vim.command("normal m'")
vim.current.window.cursor = (line, column - 1)
def gotoDeclaration():
global debug
debug = int(vim.eval("g:clang_debug")) == 1
params = getCompileParams(vim.current.buffer.name)
- timer = CodeCompleteTimer(debug, vim.current.buffer.name, -1, -1, params)
+ line, col = vim.current.window.cursor
+ timer = CodeCompleteTimer(debug, vim.current.buffer.name, line, col, params)
with workingDir(params['cwd']):
with libclangLock:
tu = getCurrentTranslationUnit(params['args'], getCurrentFile(),
vim.current.buffer.name, timer,
update = True)
f = File.from_name(tu, vim.current.buffer.name)
- line, col = vim.current.window.cursor
loc = SourceLocation.from_position(tu, f, line, col + 1)
cursor = Cursor.from_location(tu, loc)
if cursor.referenced is not None and loc != cursor.referenced.location:

0 comments on commit 75671d8

Please sign in to comment.