[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/graphql-mode 1210279ff4 063/122: Add keywords only complet
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/graphql-mode 1210279ff4 063/122: Add keywords only completion |
Date: |
Sat, 29 Jan 2022 08:03:33 -0500 (EST) |
branch: elpa/graphql-mode
commit 1210279ff4a5e0c6f074f2f6b4c534c69356a4ee
Author: Tim Shiu <punshiu@fb.com>
Commit: David Vázquez Púa <davazp@gmail.com>
Add keywords only completion
---
graphql-mode.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/graphql-mode.el b/graphql-mode.el
index 9d57d0918c..5b7d65a635 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -240,6 +240,19 @@ VARIABLES list of variables for query operation"
(when (< position indent-pos)
(goto-char indent-pos))))
+(defvar graphql-keywords
+ '("type" "input" "interface" "fragment" "query" "enum" "mutation"
"subscription"
+ "Int" "Float" "String" "Boolean" "ID"
+ "true" "false" "null"))
+
+(defun graphql-completion-at-point ()
+ "Return the list of candidates for completion.
+This is the function to be used for the hook `completion-at-point-functions'."
+ (let* ((bds (bounds-of-thing-at-point 'symbol))
+ (start (car bds))
+ (end (cdr bds)))
+ (list start end graphql-keywords . nil)))
+
(defvar graphql-definition-regex
(concat "\\(" (regexp-opt '("type" "input" "interface" "fragment" "query"
"mutation" "subscription" "enum")) "\\)"
@@ -332,8 +345,8 @@ VARIABLES list of variables for query operation"
nil
nil
nil))
- (setq imenu-generic-expression
- `((nil ,graphql-definition-regex 2))))
+ (setq imenu-generic-expression `((nil ,graphql-definition-regex 2)))
+ (add-hook 'completion-at-point-functions 'graphql-completion-at-point nil
'local))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.graphql\\'" . graphql-mode))
- [nongnu] branch elpa/graphql-mode created (now 9740e4027b), ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 14bbd1917e 032/122: Update copyright notice, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 12ab2d0eb5 060/122: Merge pull request #13 from timoweave/next, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode de4b2e8117 039/122: Remember graphql-url value only if the query is successful, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode ead2f85e12 047/122: add error handling, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 22cb9d4594 071/122: Support customizing the headers sent with the request, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 1210279ff4 063/122: Add keywords only completion,
ELPA Syncer <=
- [nongnu] elpa/graphql-mode 4bb868832f 078/122: Avoid double-encoding variables in JSON, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode a665c9514a 054/122: fix docstring, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 4c87cdab57 018/122: Fix: make the graphql-url buffer-local before the mode is enabled, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 319dfd97d7 011/122: Define graphql-send-query, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode eed3c6ca1c 036/122: Create sample GraphQL server, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 404aa31258 104/122: Save json to graphql-edit-headers, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 16c3d63521 002/122: First commit, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 5bd8b6273e 003/122: fontify more graphql constructions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode bf0412def0 006/122: Better fontification of type [implements X]?, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 1f3bd34b18 064/122: Merge pull request #14 from davazp/next, ELPA Syncer, 2022/01/29