Skip to content

Commit c355eea

Browse files
committed
feat: improve eglot and c++-ts-mode
1 parent d8a9dba commit c355eea

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

README.org

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,15 @@ ref:https://github.com/manateelazycat/toggle-one-window
15351535
)
15361536
(require 'lsp-bridge)
15371537
(lsp-bridge-mode)))
1538+
1539+
(use-package eglot
1540+
:config
1541+
(add-to-list 'eglot-ignored-server-capabilities :inlayHintProvider)
1542+
(add-to-list 'eglot-server-programs
1543+
'((c++-ts-mode c-ts-mode) "clangd"
1544+
"--clang-tidy"
1545+
"--header-insertion=never"
1546+
"--completion-style=detailed")))
15381547
#+end_src
15391548

15401549
** highlight-parentheses 高亮外层括号
@@ -1846,9 +1855,21 @@ ref:https://github.com/manateelazycat/toggle-one-window
18461855
#+begin_src elisp
18471856
(use-package c-ts-mode
18481857
:hook ((c-ts-mode c++-ts-mode) . my-enable-code-service)
1858+
:preface
1859+
(defun my-c++-ts-indent-style()
1860+
(let* ((default-style (copy-alist (alist-get 'k&r (c-ts-mode--indent-styles 'cpp))))
1861+
(custom-style '(;; Do not indent preprocessor statements.
1862+
((node-is "preproc") column-0 0)
1863+
;; Do not indent namespace children.
1864+
((n-p-gp nil nil "namespace_definition") grand-parent 0)))
1865+
;; Prepend custom rules by appending the default style to the custom style list.
1866+
(combined-style (append custom-style default-style)))
1867+
combined-style))
18491868
:custom
18501869
(c-ts-mode-indent-offset 4)
1851-
(c-basic-offset 4))
1870+
(c-basic-offset 4)
1871+
(c-ts-mode-indent-style #'my-c++-ts-indent-style)
1872+
)
18521873
#+end_src
18531874

18541875
*** 导入 VS 环境变量

snippets/c++-ts-mode/unuse

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- mode: snippet -*-
2+
# name: unuse
3+
# key: unuse
4+
# --
5+
[[maybe_unused]]

0 commit comments

Comments
 (0)