Skip to content

Commit

Permalink
monaco example fixes, fix missing worker bug (#3093)
Browse files Browse the repository at this point in the history
* monaco example fixes, fix missing worker bug
  • Loading branch information
acao authored Mar 19, 2023
1 parent 832867c commit 6ed73bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-items-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'monaco-graphql': patch
---

Bugfix for 'worker not found' type errors on \_doValidate()'
1 change: 1 addition & 0 deletions examples/monaco-graphql-nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.next
6 changes: 3 additions & 3 deletions examples/monaco-graphql-nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/monaco-graphql-webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const resultConfig = {
// critical! make sure that webpack can consume the exported modules and types
new ForkTsCheckerWebpackPlugin({
async: isDev,
tsconfig: rootPath('tsconfig.json'),
typescript: { configFile: rootPath('tsconfig.json') },
}),

new MonacoWebpackPlugin({
Expand Down
6 changes: 6 additions & 0 deletions packages/monaco-graphql/src/languageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export class DiagnosticsAdapter {
) {
const worker = await this._worker(resource);

// to handle an edge case bug that happens when
// typing before the schema is present
if (!worker) {
return;
}

const diagnostics = await worker.doValidation(resource.toString());
editor.setModelMarkers(
editor.getModel(resource) as editor.ITextModel,
Expand Down

0 comments on commit 6ed73bf

Please sign in to comment.