Trước tiên, bạn cần khởi tạo CEDET và ede
(global-ede-mode 1)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode 1)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode 1)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode 1)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode 1)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode t)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-completions-mode t)
(add-to-list 'semantic-default-submodes 'global-srecode-minor-mode t)
(add-to-list 'semantic-default-submodes 'global-semantic-decoration-mode t)
(semantic-mode) ;; Active le mode semantic
(require 'stickyfunc-enhance) ;; multilines concatene dans la header line
(require 'cedet-cscope)
(require 'ecb)
(ede-cpp-root-project "projName"
:name "projName Project"
:file "~/workspaces/projName/proj.txt" ;; an arbitrary file
:include-path '("/src/main/src"
"/src/main/include"
"/src/test/src"
"/src/test/include"
... )
:system-include-path '("/usr/include/ ~/workspaces/install/proj3/lib/ /usr/include/boost/")
:spp-table '(("isUnix" . "") ("BOOST_TEST_DYN_LINK" . "")))
;; cedet semantic
(semanticdb-enable-gnu-global-databases 'c-mode t)
(semanticdb-enable-gnu-global-databases 'c++-mode t)
;; You can add this to improve the parse of macro-heavy code:
(require 'semantic/bovine/c)
(add-to-list 'semantic-lex-c-preprocessor-symbol-file "/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stddef.h")
sau đó bạn có thể sử dụng tiêu đề của công ty ( https://github.com/randomphrase/company-c-headers )
(require 'company-c-headers)
(add-to-list 'company-backends 'company-c-headers)
(add-to-list 'company-c-headers-path-system "/usr/include/c++/4.4.7/ /home/me/DEPEDENCIES/LIBXX/lib/ /home/me/DEPEDENCIES/LIBYY/lib /usr/include/boost/"))
Type
với các trườngint foo
vàchar bar
, ngữ nghĩa và công ty sẽ hoạt động tốt.