[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 85c5353 11/24: Add cquery support for C/C++ proje
From: |
Jo�o T�vora |
Subject: |
[elpa] externals/eglot 85c5353 11/24: Add cquery support for C/C++ projects |
Date: |
Sat, 26 May 2018 14:31:15 -0400 (EDT) |
branch: externals/eglot
commit 85c5353d2fc042e41da26840906e5529274e0d95
Author: Josh Elsasser <address@hidden>
Commit: Josh Elsasser <address@hidden>
Add cquery support for C/C++ projects
Implements minimal support for the core cquery language
server. None of its extensions are implemented yet.
* eglot.el (eglot-server-programs): Add cquery to list
of guessed programs for c-mode and c++-mode.
(eglot-initialization-options eglot-cquery): Specialize init
options to pass cquery a cache directory and disable a flood
of $cquery/progress messages.
(eglot-handle-notification $cquery/publishSemanticHighlighting):
(eglot-handle-notification $cquery/setInactiveRegions):
(eglot-handle-notification $cquery/progress): New no-op functions
to avoid filling logs with "unknown message" warnings.
(eglot-cquery): New eglot-lsp-server subclass.
* README.md: Mention cquery in the README.
---
README.md | 4 ++++
eglot.el | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/README.md b/README.md
index b87666c..3b95438 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,8 @@ for the language of your choice. Otherwise, it prompts you to
enter one:
* Python's [pyls][pyls]
* Bash's [bash-language-server][bash-language-server]
* PHP's [php-language-server][php-language-server]
+* [cquery][cquery] for C/C++
+
I'll add to this list as I test more servers. In the meantime you can
customize `eglot-server-programs`:
@@ -196,5 +198,7 @@ Under the hood:
[bash-language-server]: https://github.com/mads-hartmann/bash-language-server
[php-language-server]: https://github.com/felixfbecker/php-language-server
[company-mode]: https://github.com/company-mode/company-mode
+[cquery]: https://github.com/cquery-project/cquery
+
diff --git a/eglot.el b/eglot.el
index 3d36344..189ad1e 100644
--- a/eglot.el
+++ b/eglot.el
@@ -72,6 +72,8 @@
(python-mode . ("pyls"))
(js-mode . ("javascript-typescript-stdio"))
(sh-mode . ("bash-language-server" "start"))
+ (c++-mode . (eglot-cquery "cquery"))
+ (c-mode . (eglot-cquery "cquery"))
(php-mode . ("php" "vendor/felixfbecker/\
language-server/bin/php-language-server.php")))
"How the command `eglot' guesses the server to start.
@@ -1613,6 +1615,34 @@ Proceed? "
(funcall (or eglot--current-flymake-report-fn #'ignore)
eglot--unreported-diagnostics)))))
+
+;;; cquery-specific
+;;;
+(defclass eglot-cquery (eglot-lsp-server) ()
+ :documentation "cquery's C/C++ langserver.")
+
+(cl-defmethod eglot-initialization-options ((server eglot-cquery))
+ "Passes through required cquery initialization options"
+ (let* ((root (car (project-roots (eglot--project server))))
+ (cache (expand-file-name ".cquery_cached_index/" root)))
+ (vector :cacheDirectory (file-name-as-directory cache)
+ :progressReportFrequencyMs -1)))
+
+(cl-defmethod eglot-handle-notification
+ ((server eglot-cquery) (_method (eql :$cquery/progress))
+ &rest counts &key activeThreads &allow-other-keys)
+ "No-op for noisy $cquery/progress extension")
+
+(cl-defmethod eglot-handle-notification
+ ((server eglot-cquery) (_method (eql :$cquery/setInactiveRegions))
+ &key uri inactiveRegions &allow-other-keys)
+ "No-op for unsupported $cquery/setInactiveRegions extension")
+
+(cl-defmethod eglot-handle-notification
+ ((server eglot-cquery) (_method (eql :$cquery/publishSemanticHighlighting))
+ &key uri symbols &allow-other-keys)
+ "No-op for unsupported $cquery/publishSemanticHighlighting extension")
+
(provide 'eglot)
;;; eglot.el ends here
- [elpa] externals/eglot updated (24877ae -> 897cbc3), Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot d673cf7 07/24: Increase test timeout in hopes of convincing Travis CI, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 89baadf 05/24: Fix indentation broken by the defclass monster commit, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 1ef8228 01/24: Introduce eglot-handle-request and eglot-handle-notification as API, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 3a1ff72 04/24: Introduce new API methods for experimental clients to use, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 9c87771 12/24: Introduce eglot--debug for unimportant messages, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 8d4c2c3 13/24: Demote unvisited diagnostics logging to debug level, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 85c5353 11/24: Add cquery support for C/C++ projects,
Jo�o T�vora <=
- [elpa] externals/eglot d40a458 14/24: Log debug messages through eglot--debug, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 17a3257 03/24: Do Rust's RLS hack properly with new class-based API, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 3aa2958 06/24: Add a complex RLS test, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 07078da 08/24: Rework eglot-tests.el for better debuggability, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 0462130 15/24: New RLS tests, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot e1d7ff3 09/24: Disable file-watching tests on Travis, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot c8e7ab0 16/24: Don't rely on Flymake's idle timer for textDocument/didChange, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 99ca690 17/24: Simpify eglot--server-receive, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 1b5ed29 21/24: Really ensure eglot--shutdown deletes a process completely, Jo�o T�vora, 2018/05/26
- [elpa] externals/eglot 897cbc3 24/24: * eglot.el (Version): Bump to 0.5, Jo�o T�vora, 2018/05/26