[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/graphql-mode cf2622cb21 049/122: Update feedback from Davi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/graphql-mode cf2622cb21 049/122: Update feedback from David |
Date: |
Sat, 29 Jan 2022 08:03:32 -0500 (EST) |
branch: elpa/graphql-mode
commit cf2622cb21bdec3e5f41e23fce199228a3f8a591
Author: Tim Shiu <punshiu@fb.com>
Commit: Tim Shiu <punshiu@fb.com>
Update feedback from David
---
graphql-mode.el | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/graphql-mode.el b/graphql-mode.el
index a6b5df221d..21dfa8139b 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -22,7 +22,7 @@
;;; Commentary:
;; This package implements a major mode to edit GraphQL schemas and
-;; query. The basic functionality includes:
+;; query. The basic functionality includes:
;;
;; - Syntax highlight
;; - Automatic indentation
@@ -62,15 +62,14 @@
:type 'string
:group 'graphql)
-(defcustom graphql-variables nil
- "file name containing graphql variables."
+(defcustom graphql-variables-file nil
+ "File name containing graphql variables."
:tag "GraphQL"
:type 'file
:group 'graphql)
(defun graphql--query (query operation variables)
- "Send QUERY to the server at `graphql-url' and return the
-response from the server."
+ "Send QUERY to the server at `graphql-url' and return the response from the
server."
(let* ((url-request-method "POST")
(url (format "%s?query=%s" graphql-url (url-encode-url query))))
(if operation
@@ -80,7 +79,7 @@ response from the server."
(with-temp-buffer (graphql-post-request graphql-url url query operation
variables))))
(defun graphql-post-request (host_path url query operation variables)
- "graphql make post request to graphql endpoint url with body of query,
operationName, and variables"
+ "Graphql make post request to graphql endpoint url with body of query,
operationName, and variables."
(let* ((body (list (cons "query" query)
(cons "operationName" operation)
(cons "variables" variables)))
@@ -115,7 +114,7 @@ response from the server."
(forward-line 1)))
(defun graphql-current-query ()
- "find out the current query/mutation/subscription"
+ "Find out the current query/mutation/subscription."
(let ((start
(save-excursion
(graphql-beginning-of-query)
@@ -127,7 +126,7 @@ response from the server."
(buffer-substring-no-properties start end)))
(defun graphql-current-operation ()
- "get the name of the query operation"
+ "Get the name of the query operation."
(let* ((query
(save-excursion
(replace-regexp-in-string "^[ \t\n]*" "" (graphql-current-query))))
@@ -136,11 +135,11 @@ response from the server."
(first (nth 0 tokens)))
(if (or (string-equal first "{") (string-equal first ""))
- (read-string "GraphQL operation: ")
+ nil
(replace-regexp-in-string "[({].*" "" (nth 1 tokens)))))
(defun graphql-current-variables (filename)
- "get the content of graphql variables from a file"
+ "Get the content of graphql variables from a file."
(if (and filename
(not (string-equal filename ""))
(not (file-directory-p filename))
@@ -152,11 +151,12 @@ response from the server."
nil))
(defun graphql-send-query ()
+ "Send GraphQL query/mutation/subscription to server."
(interactive)
(let* ((url (or graphql-url (read-string "GraphQL URL: " )))
- (var (or graphql-variables (read-file-name "GraphQL Variables: "))))
+ (var (or graphql-variables-file (read-file-name "GraphQL Variables:
"))))
(let ((graphql-url url)
- (graphql-variables var))
+ (graphql-variables-file var))
(let* ((query (buffer-substring-no-properties (point-min) (point-max)))
(operation (graphql-current-operation))
@@ -173,15 +173,17 @@ response from the server."
;; in the current buffer (instead of the introduced local
;; binding).
(setq graphql-url url)
- (setq graphql-variables var)
+ (setq graphql-variables-file var)
nil))
(defvar graphql-mode-map
+ "Key binding for GraphQL mode."
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-c") 'graphql-send-query)
map))
(defvar graphql-mode-syntax-table
+ "Syntax table for GraphQL mode."
(let ((st (make-syntax-table)))
(modify-syntax-entry ?\# "<" st)
(modify-syntax-entry ?\n ">" st)
@@ -190,6 +192,7 @@ response from the server."
(defun graphql-indent-line ()
+ "Indent GraphQL schema language."
(let ((position (point))
(indent-pos))
(save-excursion
@@ -207,13 +210,16 @@ response from the server."
(defvar graphql-definition-regex
+ "Keyword Regular Expressions."
(concat "\\(" (regexp-opt '("type" "input" "interface" "fragment" "query"
"mutation" "subscription" "enum")) "\\)"
"[[:space:]]+\\(\\_<.+?\\_>\\)"))
(defvar graphql-builtin-types
+ "Buildin Types"
'("Int" "Float" "String" "Boolean" "ID"))
(defvar graphql-constants
+ "Constant Types."
'("true" "false" "null"))
@@ -248,6 +254,7 @@ response from the server."
(defvar graphql-font-lock-keywords
+ "Font Lock keywords."
`(
;; Type definition
("\\(type\\)[[:space:]]+\\(\\_<.+?\\_>\\)"
- [nongnu] elpa/graphql-mode ec3c72cd28 016/122: Support enum definitions, (continued)
- [nongnu] elpa/graphql-mode ec3c72cd28 016/122: Support enum definitions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode ad54fdb48a 022/122: Improve package description, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 66efefd508 027/122: Add customization group and variable to customize indentation level, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode ef2933eb92 020/122: Add autoload cookie to auto-mode-alist setting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 7d954d0045 035/122: Fix font lock to highlight whole symbols, not just words, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 3c25bf5cbd 040/122: Adapt more regexs to understand _ as part f symbols, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 36dc6e6c9d 042/122: Update with David feedback, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode dec32e6441 021/122: Fix package dependencies, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 3ddf204de7 031/122: Add mailmap to merge author lines, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode a37919f2ab 065/122: graphql--query: Remove unused lexical variable, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode cf2622cb21 049/122: Update feedback from David,
ELPA Syncer <=
- [nongnu] elpa/graphql-mode d3aa4d66e0 013/122: Extract constants and values into separate variables, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 1bff11f21c 056/122: fix the line-boundary issue to enhance {} sexp, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode ba5952590c 079/122: Merge pull request #22 from cbowdon/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 061d6d0b34 001/122: Initial commit, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode cbd07029fa 009/122: Better indentation of closing pairs, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 096df5b167 005/122: Basic line indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 3965a4c370 046/122: add request dependency, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 52137014df 073/122: Update packages, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode c3471642f5 072/122: Merge pull request #19 from cbowdon/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/graphql-mode 880701685d 038/122: Add some types/field to the test schema, ELPA Syncer, 2022/01/29