Skip to content

Commit

Permalink
use graphql-lang-service in codemirror-graphql (#2037)
Browse files Browse the repository at this point in the history
  • Loading branch information
acao authored Nov 23, 2021
1 parent d0c22c4 commit b79bf30
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-laws-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'codemirror-graphql': patch
---

Resolves #1944, replaces graphql-language-service-utils with graphql-language-service in codemirror-graphql
3 changes: 1 addition & 2 deletions packages/codemirror-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
},
"dependencies": {
"@codemirror/stream-parser": "^0.19.2",
"graphql-language-service-interface": "^2.9.0",
"graphql-language-service-parser": "^1.10.0"
"graphql-language-service": "^3.2.1"
},
"devDependencies": {
"codemirror": "^5.58.2",
Expand Down
5 changes: 2 additions & 3 deletions packages/codemirror-graphql/src/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import CodeMirror, { Hints, Hint } from 'codemirror';
import 'codemirror/addon/hint/show-hint';

import { FragmentDefinitionNode, GraphQLSchema, GraphQLType } from 'graphql';
import { getAutocompleteSuggestions } from 'graphql-language-service-interface';
import { Maybe } from 'graphql-language-service-types';
import { Position } from 'graphql-language-service-utils';
import type { Maybe } from 'graphql-language-service';
import { getAutocompleteSuggestions, Position } from 'graphql-language-service';

export interface GraphQLHintOptions {
schema?: GraphQLSchema;
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
SchemaReference,
} from './utils/SchemaReference';
import './utils/info-addon';
import { Maybe } from 'graphql-language-service-types';
import type { Maybe } from 'graphql-language-service';

export interface GraphQLInfoOptions {
schema?: GraphQLSchema;
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/jump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from './utils/SchemaReference';
import './utils/jump-addon';
import { GraphQLSchema } from 'graphql';
import { State } from 'graphql-language-service-parser';
import type { State } from 'graphql-language-service';

export interface GraphQLJumpOptions {
schema?: GraphQLSchema;
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import CodeMirror from 'codemirror';
import { FragmentDefinitionNode, GraphQLSchema, ValidationRule } from 'graphql';
import { getDiagnostics } from 'graphql-language-service-interface';
import { getDiagnostics } from 'graphql-language-service';

const SEVERITY = ['error', 'warning', 'information', 'hint'];
const TYPE: Record<string, string> = {
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/results/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
p,
State,
Token,
} from 'graphql-language-service-parser';
} from 'graphql-language-service';

/**
* This mode defines JSON, but provides a data-laden parser state to enable
Expand Down
3 changes: 1 addition & 2 deletions packages/codemirror-graphql/src/utils/forEachState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

import { State } from 'graphql-language-service-parser';
import { Maybe } from 'graphql-language-service-types';
import type { State, Maybe } from 'graphql-language-service';

// Utility for iterating through a CodeMirror parse state stack bottom-up.
export default function forEachState(stack: State, fn: (state: State) => void) {
Expand Down
4 changes: 2 additions & 2 deletions packages/codemirror-graphql/src/utils/getTypeInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
GraphQLEnumValue,
GraphQLInputFieldMap,
} from 'graphql';
import { State } from 'graphql-language-service-parser';
import { Maybe } from 'graphql-language-service-types';
import type { State, Maybe } from 'graphql-language-service';

import {
SchemaMetaFieldDef,
TypeMetaFieldDef,
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/utils/runParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
onlineParser,
ParserOptions,
State,
} from 'graphql-language-service-parser';
} from 'graphql-language-service';

export default function runParser(
sourceText: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import CodeMirror from 'codemirror';
import 'codemirror/addon/lint/lint';
import { parse } from 'graphql';
import { Maybe } from 'graphql-language-service-types';
import { Maybe } from 'graphql-language-service';
import collectVariables from '../../utils/collectVariables';
import { TestSchema } from '../../__tests__/testSchema';
import '../lint';
Expand Down
3 changes: 1 addition & 2 deletions packages/codemirror-graphql/src/variables/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import {
GraphQLInputType,
GraphQLInputFieldMap,
} from 'graphql';
import { State } from 'graphql-language-service-parser';
import { Maybe } from 'graphql-language-service-types';
import type { State, Maybe } from 'graphql-language-service';
import { IHints } from 'src/hint';

import forEachState from '../utils/forEachState';
Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/src/variables/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
p,
State,
Token,
} from 'graphql-language-service-parser';
} from 'graphql-language-service';

/**
* This mode defines JSON, but provides a data-laden parser state to enable
Expand Down
5 changes: 1 addition & 4 deletions packages/codemirror-graphql/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
],
"references": [
{
"path": "../graphql-language-service-interface"
},
{
"path": "../graphql-language-service-parser"
"path": "../graphql-language-service"
}
]
}
5 changes: 1 addition & 4 deletions packages/codemirror-graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

"references": [
{
"path": "../graphql-language-service-parser"
},
{
"path": "../graphql-language-service-interface"
"path": "../graphql-language-service"
}
]
}

2 comments on commit b79bf30

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.