- Lua 78.5%
- Vim Script 21.5%
| autoload/mocha | ||
| lua/mocha/source | ||
| plugin | ||
| LICENSE | ||
| README.md | ||
mocha-clangx
clang command-line completion source for mocha, classic Vim
9.1 (+lua, Lua 5.1, +job).
Ports the behavior of the clangx source: runs clang -fsyntax-only -Xclang -code-completion-at over the whole buffer, parses COMPLETION: lines,
strips placeholder tokens, and emits {word, menu, info} candidates. 10s
timeout, include flags cached per buffer and rebuilt per insert session.
Contract
- name
clangx, mark[clangx], rank 500 - filetypes
c,cpp,objc,objcpp - complete position: start of trailing
[a-zA-Z0-9_]*
Variables (via mocha#complete#custom#var)
clang_binary('clang')default_c_options(''),default_cpp_options('')clang_file_path(['.clang', '.clang_complete'], searched from cwd upward; absolute entries used as-is, args shlex-split +~/$VARexpanded, run dir set to the file's dir)
Include -I flags come from the mocha include source path resolution
(b:neoinclude_paths > g:neoinclude#paths > buffer &path + cpp defaults),
falling back to clang_file_path, then the default options var.
Job glue
mocha#clangx#complete({id, argv, cwd, stdin_lines}) starts a raw-mode
job_start, pipes the buffer on stdin, drains the channel on exit and calls
require('mocha.source.clangx')._on_result(id, json_lines).
License
MIT — see LICENSE.