Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit fc514f4

Browse files
authored
improvement: server dotenv and config reloading (#222)
- require `dotenv` in the server runtime (for loading graphql config values), and allow a `graphql-config.dotEnvPath` configuration to specify specific paths - reload server on workspace configuration changes - reload severside `graphql-config` and language service on config file changes. definitions cache/etc will be rebuilt - note: client not configured to reload on graphql config changes yet (i.e endpoints) - accept all `graphql-config.loadConfig()` options
2 parents 7d6fc83 + 46bdeb9 commit fc514f4

File tree

5 files changed

+36
-18
lines changed

5 files changed

+36
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
66

77
The git log should show a fairly clean view of each of these new versions, and the issues/PRs associated.
88

9+
# 0.3.8
10+
11+
- require `dotenv` in the server runtime (for loading graphql config values), and allow a `graphql-config.dotEnvPath` configuration to specify specific paths
12+
- reload server on workspace configuration changes
13+
- reload severside `graphql-config` and language service on config file changes. definitions cache/etc will be rebuilt
14+
- note: client not configured to reload on graphql config changes yet (i.e endpoints)
15+
- accept all `graphql-config.loadConfig()` options
16+
917
# 0.3.7
1018

1119
- update underlying `graphql-language-service-server` to allow .gql, .graphqls extensions

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ GraphQL extension VSCode built with the aim to tightly integrate the GraphQL Eco
44

55
![](https://camo.githubusercontent.com/97dc1080d5e6883c4eec3eaa6b7d0f29802e6b4b/687474703a2f2f672e7265636f726469742e636f2f497379504655484e5a342e676966)
66

7-
> 💡 **Note:** This extension no longer supports `.prisma` files. If you are using this extension with Prisma 1, please rename your datamodel from `datamodel.prisma` to `datamodel.graphql` and this extension will pick that up.
7+
> 💡 **Note:** This extension no longer supports `.prisma` files. If you are using this extension with GraphQL 1, please rename your datamodel from `datamodel.prisma` to `datamodel.graphql` and this extension will pick that up.
88
99
## Features
1010

11+
Lots of new improvements happening! We now have a [`CHANGELOG.md`](https://github.com/graphql/vscode-graphql/blob/master/CHANGELOG.md#change-log)
12+
1113
### General features
1214

1315
- Load the extension on detecting `graphql-config file` at root level or in a parent level directory
@@ -16,6 +18,7 @@ GraphQL extension VSCode built with the aim to tightly integrate the GraphQL Eco
1618
- execute query/mutation/subscription operation, embedded or in graphql files
1719
- pre-load schema and document defintitions
1820
- Support [`graphql-config`](https://graphql-config.com/) files with one project and multiple projects
21+
- the language service re-starts on changes to vscode settings and/or graphql config!
1922

2023
### `.graphql`, `.gql` file extension support
2124

@@ -39,7 +42,7 @@ GraphQL extension VSCode built with the aim to tightly integrate the GraphQL Eco
3942

4043
## Usage
4144

42-
Install the [VSCode GraphQL Extension](https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql).
45+
Install the [VSCode GraphQL Extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql).
4346

4447
(Watchman is no longer required, you can uninstall it now)
4548

@@ -218,14 +221,14 @@ const myQuery = `
218221

219222
## Known Issues
220223

221-
- template replacement inside a graphql string [will break graphql parsing](https://github.com/prisma-labs/vscode-graphql/issues/137). If you want to help improve partial parsing support, you can contribute to the parser efforts in [`graphql`](https://github.com/graphql/graphql-js) reference implementation. You can now re-use fragments across your project source, if you include the files in `documents`.
224+
- template replacement inside a graphql string [will break graphql parsing](https://github.com/graphql/vscode-graphql/issues/137). If you want to help improve partial parsing support, you can contribute to the parser efforts in [`graphql`](https://github.com/graphql/graphql-js) reference implementation. You can now re-use fragments across your project source, if you include the files in `documents`.
222225
- the output channel occasionally shows "definition not found" when you first start the language service, but once the definition cache is built for each project, definition lookup will work. so if a "peek definition" fails when you first start, just try clicking it again.
223226

224227
## Development
225228

226229
This plugin uses the [GraphQL language server](https://github.com/graphql/graphql-language-service-server)
227230

228-
1. Clone the repository - https://github.com/prisma-labs/vscode-graphql
231+
1. Clone the repository - https://github.com/graphql/vscode-graphql
229232
1. `npm install`
230233
1. Open it in VSCode
231234
1. Go to the debugging section and run the launch program "Extension"

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
"icon": "assets/images/logo.png",
1616
"repository": {
1717
"type": "git",
18-
"url": "https://github.com/prisma-labs/vscode-graphql"
18+
"url": "https://github.com/graphql/vscode-graphql"
1919
},
20-
"homepage": "https://github.com/prisma-labs/vscode-graphql/blob/master/README.md",
20+
"homepage": "https://github.com/graphql/vscode-graphql/blob/master/README.md",
2121
"galleryBanner": {
2222
"color": "#032539",
2323
"theme": "dark"
2424
},
25-
"publisher": "Prisma",
25+
"publisher": "GraphQL",
2626
"engines": {
2727
"vscode": "^1.32.0"
2828
},
@@ -119,8 +119,7 @@
119119
"type": [
120120
"string"
121121
],
122-
"description": "Base dir for graphql config loadConfig()",
123-
"default": null
122+
"description": "Base dir for graphql config loadConfig()"
124123
},
125124
"graphql-config.load.filePath": {
126125
"type": [
@@ -142,20 +141,27 @@
142141
],
143142
"description": "optional <configName>.config.js instead of default `graphql`",
144143
"default": null
144+
},
145+
"graphql-config.dotEnvPath": {
146+
"type": [
147+
"string"
148+
],
149+
"description": "optional .env load path, if not the default",
150+
"default": null
145151
}
146152
}
147153
},
148154
"commands": [
149155
{
150-
"command": "extension.isDebugging",
156+
"command": "vscode-graphql.isDebugging",
151157
"title": "VSCode GraphQL - Is Debugging?"
152158
},
153159
{
154-
"command": "extension.restart",
155-
"title": "VSCode GraphQL - Restart"
160+
"command": "vscode-graphql.restart",
161+
"title": "VSCode GraphQL - Manual Restart"
156162
},
157163
{
158-
"command": "extension.contentProvider",
164+
"command": "vscode-graphql.contentProvider",
159165
"title": "Execute GraphQL Operations"
160166
}
161167
]
@@ -196,7 +202,7 @@
196202
"dotenv": "^8.2.0",
197203
"graphql": "^15.3.0",
198204
"graphql-config": "^3.0.3",
199-
"graphql-language-service-server": "^2.5.2",
205+
"graphql-language-service-server": "^2.5.3",
200206
"graphql-tag": "^2.11.0",
201207
"node-fetch": "^2.6.0",
202208
"ovsx": "0.1.0-next.dacd2fd",

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export async function activate(context: ExtensionContext) {
7373
],
7474
synchronize: {
7575
fileEvents: workspace.createFileSystemWatcher(
76-
"**/*.{graphql,graphqls,gql,js,jsx,ts,tsx}",
76+
"**/{*.graphql,*.graphqls,*.gql,*.js,*.jsx,*.ts,*.tsx,graphql.config.*,.graphqlrc,.graphqlrc.*,package.json}",
7777
),
7878
},
7979
outputChannel: outputChannel,

0 commit comments

Comments
 (0)