Skip to content

Commit 9d3206d

Browse files
docs: Auto-generate vimdocs + vimtags (#597)
Co-authored-by: YaroSpace <5670940+YaroSpace@users.noreply.github.com>
1 parent 34beb95 commit 9d3206d

File tree

7 files changed

+77
-15
lines changed

7 files changed

+77
-15
lines changed

doc/kulala.basic-usage.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ METADATA
116116

117117
DIRECTIVES
118118

119-
- `# @graphql` allows you to run a GraphQL query.
120119
- `# @accept chunked` allows you to accept Transfer-Encoding: chunked responses and streamed responses.
121120
- `# @curl-global-...` and `# @curl-...` allows you to set global and per-request flags for curl requests.
122121
- `# @grpc-global-...` and `# @grpc-...` allows you to set global and per-request flags for gRPC requests.

doc/kulala.configuration-options.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,13 @@ Example:
634634
<
635635

636636

637+
GENERATE_BUG_REPORT
638+
639+
Generate a bug report on error.
640+
641+
Default: `false`
642+
643+
637644
SCRIPTS *kulala.configuration-options-configuration-options-scripts*
638645

639646

@@ -1152,7 +1159,12 @@ Function called when Kulala LSP attaches to the buffer
11521159
enable = true,
11531160
keymaps = false, -- disabled by default, as Kulala relies on default Neovim LSP keymaps
11541161
formatter = {
1155-
json_sort = true, -- sort JSON keys in request body
1162+
sort = { -- enable/disable alphabetical sorting in request body
1163+
metadata = true,
1164+
variables = true,
1165+
commands = true,
1166+
json = true,
1167+
},
11561168
},
11571169
on_attach = function(client, bufnr)
11581170
-- custom on_attach function

doc/kulala.custom-curl-flags.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Local flags take precedence over global flags.
3131
If you need to apply curl flags to OAuth requests, you have to use `#
3232
@curl-global-..` flags.
3333

34+
In order for global flags to take effect, the request where they are defined
35+
must be run at least once.
36+
3437

3538
SOME COMMON CURL FLAGS YOU MIGHT WANT TO USE:
3639

doc/kulala.graphql.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ Table of Contents *kulala.graphql-table-of-contents*
1111
==============================================================================
1212
1. GraphQL *kulala.graphql-graphql*
1313

14-
You can use the `GRAPHQL` method (preferred), `@graphql` directive or
15-
`X-REQUEST-TYPE: GraphQL` header to send GraphQL requests.
14+
Use `GRAPHQL` method to indicate a GRAPHQL request.
15+
16+
`@graphql` directive or `X-REQUEST-TYPE: GraphQL` header may also work, but are
17+
deprecated and will not activate all the features of the GraphQL request.
1618

1719
Create a file with the `.http` extension and write your GraphQL requests in it.
1820

@@ -24,7 +26,6 @@ title="gql-with-variables.http"
2426
>http
2527
GRAPHQL https://swapi-graphql.netlify.app/.netlify/functions/index HTTP/1.1
2628
Accept: application/json
27-
X-REQUEST-TYPE: GraphQL
2829

2930
query Person($id: ID) {
3031
person(personID: $id) {
@@ -41,10 +42,8 @@ WITHOUT VARIABLES *kulala.graphql-graphql-without-variables*
4142
title="gql-without-variables.http"
4243

4344
>http
44-
# @graphql
45-
POST https://swapi-graphql.netlify.app/.netlify/functions/index HTTP/1.1
45+
GRAPHQL https://swapi-graphql.netlify.app/.netlify/functions/index HTTP/1.1
4646
Accept: application/json
47-
X-REQUEST-TYPE: GraphQL
4847

4948
query Query {
5049
allFilms {

doc/kulala.grpc.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ example:
8585
<
8686

8787
Flags set in variables override flags set in metatadata, which in turn override
88-
global flags.
88+
global flags. In order for global flags to take effect, the request where they
89+
are defined must be run at least once.
8990

9091
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
9192

doc/kulala.public-methods.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,11 @@ You can download the schema of a GraphQL server with:
147147

148148
You need to have your cursor on a line with a GraphQL request.
149149

150-
The file will be downloaded to the the directory where the current file is
151-
located.
150+
The file will be downloaded to the directory where the current file is located.
152151

153-
The filename will be `[http-file-name-without-extension].graphql-schema.json`.
152+
The filename will be `[request name].graphql-schema.json`.
154153

155-
This file can be used in conjunction with the kulala-cmp-graphql
156-
https://github.com/mistweaverco/kulala-cmp-graphql.nvim plugin to provide
157-
autocompletion and type checking.
154+
This is required for the autocompletion and type checking to work.
158155

159156

160157
GET_SELECTED_ENV
@@ -176,6 +173,12 @@ https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.
176173
If you omit the `env_key`, it’ll try to load up a telescope prompt to select
177174
an environment or fallback to using `vim.ui.select`.
178175

176+
177+
GENERATE_BUG_REPORT
178+
179+
`require('kulala').generate_bug_report()` Generates a bug report and opens a
180+
GitHub issue with it.
181+
179182
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
180183

181184
vim:tw=78:ts=8:noet:ft=help:norl:

doc/kulala.recipes.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,51 @@ UPLOADING A FILE
5151
------WebKitFormBoundary{{$timestamp}}--
5252
<
5353

54+
55+
AUTHENTICATING WITH BROWSER-BASED AUTH
56+
57+
>http
58+
59+
### Acquire_XSRF_TOKEN
60+
61+
GET localhost:8000/login
62+
63+
> {%
64+
-- lua
65+
client.global.token = response.cookies["XSRF-TOKEN"].value
66+
client.global.decoded_token = vim.uri_decode(client.global.token)
67+
client.global.session = response.cookies["laravel_session"].value
68+
%}
69+
70+
### Authentication
71+
72+
POST localhost:8000/login
73+
Content-Type: application/json
74+
X-Xsrf-Token: {{decoded_token}}
75+
Cookie: XSRF-TOKEN={{token}}
76+
Cookie: laravel_session={{session}}
77+
Referer: http://localhost:8000/login
78+
79+
{
80+
"email": "mail@mail.com",
81+
"password": "passpass"
82+
}
83+
84+
> {%
85+
-- lua
86+
-- save the new set authenticated session
87+
client.global.session = response.cookies["laravel_session"].value
88+
%}
89+
90+
### Dashboard
91+
92+
run #Acquire_XSRF_TOKEN
93+
run #Authentication
94+
95+
GET http://localhost:8000/dashboard
96+
Cookie: laravel_session={{session}}
97+
<
98+
5499
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
55100

56101
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)