Use ccls as C/C++ LSP

This commit is contained in:
Wojciech Kozlowski 2019-03-17 18:11:53 +01:00
parent 09fd19d08c
commit a45a7db579
3 changed files with 8 additions and 80 deletions

View File

@ -114,7 +114,6 @@
em-emacs em-emacs
em-files em-files
em-helm em-helm
em-helm-gtags
em-modeline em-modeline
em-org em-org
em-parentheses em-parentheses

View File

@ -1,65 +0,0 @@
;;; em-helm-gtags.el --- Module file for GTAGS with Helm configuration.
;;
;; Copyright (C) 2017 Wojciech Kozlowski
;;
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
;; Created: 2 Sep 2017
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; This module sets up configuration for using gtags with helm.
;;
;; To add gtags for system include paths:
;;
;; export GTAGSLIBPATH=$HOME/.gtags/
;;
;; mkdir ~/.gtags
;; cd ~/.gtags
;;
;; ln -s /usr/include usr-include
;; ln -s /usr/local/include/ usr-local-include
;;
;; gtags -c
;;
;;; License: GPLv3
;;; Required packages:
;;; Code:
(defvar emodule/em-helm-gtags-packages
'(helm-gtags)
)
;;; Configuration:
(defun emodule/em-helm-gtags-init ()
"Initialise the `em-helm-gtags' module."
(use-package helm-gtags
:hook
((dired-mode eshell-mode c-mode c++-mode asm-mode-hook) . helm-gtags-mode)
:bind
(:map helm-gtags-mode-map
("C-c g a" . helm-gtags-tags-in-this-function)
("C-c g h" . helm-gtags-show-stack)
("C-j" . helm-gtags-select)
("M-." . helm-gtags-dwim)
("M-," . helm-gtags-pop-stack)
("C-c <" . helm-gtags-previous-history)
("C-c >" . helm-gtags-next-history))
:init
(setq helm-gtags-ignore-case t
helm-gtags-auto-update t
helm-gtags-use-input-at-cursor t
helm-gtags-pulse-at-cursor t
helm-gtags-prefix-key "\C-cg"
helm-gtags-suggested-key-mapping t))
)
(provide 'em-helm-gtags)
;;; em-helm-gtags.el ends here

View File

@ -21,6 +21,7 @@
(defvar emodule/em-programming-packages (defvar emodule/em-programming-packages
'(cargo '(cargo
ccls
company company
company-c-headers company-c-headers
company-lsp company-lsp
@ -67,9 +68,10 @@
(use-package lsp-ui (use-package lsp-ui
:commands lsp-ui-mode :commands lsp-ui-mode
:bind (("C-M-i" . lsp-ui-imenu)) :bind (("C-M-i" . lsp-ui-imenu))
:config :init
(setq lsp-ui-doc-enable nil) (setq lsp-ui-doc-enable nil)
(setq lsp-prefer-flymake nil)
:config
(define-key lsp-ui-mode-map (define-key lsp-ui-mode-map
[remap xref-find-definitions] #'lsp-ui-peek-find-definitions) [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map (define-key lsp-ui-mode-map
@ -316,23 +318,15 @@
(define-key yas-minor-mode-map (kbd "<C-return>") 'yas-expand)) (define-key yas-minor-mode-map (kbd "<C-return>") 'yas-expand))
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Configure CEDET. ;; Configure C/C++.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
(use-package cc-mode (use-package cc-mode
:defer t) :defer t)
;; To add include paths for semantic to parse, add them to (use-package ccls
;; `semantic-add-system-include'. This includes any local system includes, :hook ((c-mode c++-mode objc-mode) .
;; such as those in `/usr/local/include'. (lambda () (require 'ccls) (lsp))))
(use-package semantic
:config
(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(semantic-mode 1)
(use-package stickyfunc-enhance)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode))
;; For this to work, need to specify project roots in the variable ;; For this to work, need to specify project roots in the variable
;; `ede-cpp-root-project', e.g. ;; `ede-cpp-root-project', e.g.