ifitzpatrick/graphql-doc.el@6ba7961fc9 -> ifitzpatrick/graphql-doc.el@d37140267e timoweave/company-graphql@757dfa45ad -> thaenalpha/company-graphql@aed9f5109e The source for company-graphql is temporarily changed because the package was no longer available on MELPA. Close: #6436 Ref: timoweave/company-graphql#1 Ref: timoweave/company-graphql#4 Co-authored-by: Nopanun Laochunhanun <thaenalpha@users.noreply.github.com> |
||
---|---|---|
.. | ||
autoload.el | ||
config.el | ||
packages.el | ||
README.org |
lang/graphql
Description
This module adds GraphQL support to Doom Emacs.
- Code completion
-
LSP support (
+lsp
)- Diagnostics (GraphQL syntax linting/validations) (spec-compliant)
- Autocomplete suggestions (spec-compliant)
- Hyperlink to fragment definitions and named types (type, input, enum) definitions (spec-compliant)
- Outline view support for queries and SDL
- Symbols support across the workspace
- Local schema viewer
- Org-babel exporter (requires
:lang org
)
Maintainers
- @elken (Author)
Module Flags
+lsp
Enable LSP support through graphql-language-service-cli (also requires:tools lsp
)
Plugins
- graphql-mode
- graphql-doc
- company-graphql (when
+lsp
is disabled)
Hacks
Added a convenience function +graphql-doc-open-config
to open schema docs from a
.graphqlconfig
file.
Prerequisites
There are no prerequisites for using this module. LSP server should be downloaded upon opening a graphql buffer.
Features
Sending queries
When visiting a graphql buffer, you have access to the ability to send the
current query with C-c C-c
which will prompt you for an optional variables file,
then execute the query and return a buffer of the results.
It's also possible to send queries using org-babel using a block such as the
ones below (executing correctly will require :lang org
)
{
"continentCode": "AF"
}
query GetContinents($continentCode: String!) {
continent(code: $continentCode) {
name
code
}
}
{ "data": { "continent": { "name": "Africa", "code": "AF" } } }
Viewing docs
With this module, there are 3 ways to view schemas:
+graphql-doc-open-config
which uses a local.graphqlconfig
file to seed endpoints to querygraphql-doc
which prompts you to select an endpoint based on ones added manually bygraphql-doc-add-api
graphql-doc-open-url
which prompts to to manually enter an endpoint url
When using the doc viewer, there are a few bindings for navigating around.
Key | Command | Description |
---|---|---|
C-j |
forward-button |
Follow a forward button |
C-k |
backward-button |
Follow a backward button |
<backspace> |
graphql-doc-go-back |
Go back to a previous page |
mouse-1 |
- | Follow the next label under point |
RET |
- | Follow the next label under point |
Configuration
Most of the "magic" in the module relies on a properly configured
.graphqlconfig
file, so follow the examples linked to create an appropriate
setup.
LSP configuration is handled through GraphQL Config to handle custom directives/documents/validation etc.
These files will also be useful to other editors, so it would be worth trying to get them into version control.