Skip to content

Commit 23a3800

Browse files
authored
fix: restore variable documentation (#331)
The previous version of `@nginx/reference-lib` did not have NGINX variables (like `$binary_remote_addr`), update and include those in the autocomplete array. The old web scraper included these variables, but often had inaccurate descriptions. See also: nginx/nginx-directive-reference#203
1 parent f5f2b58 commit 23a3800

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monaco-editor-nginx",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Nginx language for Monaco Editor.",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",
@@ -14,14 +14,14 @@
1414
"license": "MIT",
1515
"peerDependencies": {
1616
"@babel/runtime": ">=7.10.0",
17-
"@nginx/reference-lib": ">=1.0.14",
17+
"@nginx/reference-lib": ">=1.1.0",
1818
"monaco-editor": ">=0.22.3",
1919
"react": ">=16.9.0",
2020
"react-dom": ">=16.9.0"
2121
},
2222
"dependencies": {
2323
"@babel/runtime": "^7.18.6",
24-
"@nginx/reference-lib": "^1.0.14"
24+
"@nginx/reference-lib": "^1.1.0"
2525
},
2626
"devDependencies": {
2727
"monaco-editor": "^0.44.0"

core/src/directives.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { getDirectives, Format } from '@nginx/reference-lib';
2-
import { Directive } from '@nginx/reference-lib/dist/index.d';
1+
import { getDirectives, Format, getVariables, Directive } from '@nginx/reference-lib';
32

43
export type Autocomplete = {
54
/** name of the NGINX module */
@@ -12,10 +11,10 @@ export type Autocomplete = {
1211
* nginx config */
1312
v?: string;
1413
/** markdown CSV for valid contexts */
15-
c: string;
14+
c?: string;
1615
/** markdown-formatted syntax specifications, including directive name.
1716
* Multiple syntaxes are seperated by newlines */
18-
s: string;
17+
s?: string;
1918
};
2019

2120
function toAutocomplete(d: Directive): Autocomplete {
@@ -34,4 +33,10 @@ function toAutocomplete(d: Directive): Autocomplete {
3433
return ret;
3534
}
3635

37-
export const directives = getDirectives(Format.Markdown).map(toAutocomplete);
36+
const variables = getVariables(Format.Markdown).map((v) => ({
37+
m: v.module,
38+
n: v.name,
39+
d: v.description,
40+
}));
41+
42+
export const directives = getDirectives(Format.Markdown).map(toAutocomplete).concat(variables);

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "2.0.1",
2+
"version": "2.0.2",
33
"packages": ["website", "core"]
44
}

website/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "website",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"private": true,
55
"scripts": {
66
"start": "kkt start",
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"dependencies": {
1111
"@wcj/dark-mode": "^1.0.13",
12-
"monaco-editor-nginx": "2.0.1",
12+
"monaco-editor-nginx": "2.0.2",
1313
"react": "~18.2.0",
1414
"react-dom": "~18.2.0"
1515
},

0 commit comments

Comments
 (0)