Skip to content

Commit

Permalink
tweak to try to fix ci bash expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed May 27, 2024
1 parent a9e3a18 commit e5ab31e
Show file tree
Hide file tree
Showing 11 changed files with 1,037 additions and 44 deletions.
2 changes: 1 addition & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = (dir, env = 'jsdom') => {
'node_modules',
'__tests__',
'resources',
'test',

'examples',
'.d.ts',
'types.ts',
Expand Down
13 changes: 7 additions & 6 deletions packages/graphql-language-service-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ further customization:
```ts
import { loadConfig } from 'graphql-config'; // 3.0.0 or later!
const config = await loadConfig({
...options here
})
// with required params
const config = await loadConfig();
await startServer({
method: 'node',
Expand All @@ -135,7 +134,7 @@ await startServer({
// configDir: '',
loadConfigOptions: {
// any of the options for graphql-config@3 `loadConfig()`
schema: await config.getSchema()
schema: await config.getSchema(),
// rootDir is same as `configDir` before, the path where the graphql config file would be found by cosmic-config
rootDir: 'config/',
// or - the relative or absolute path to your file
Expand Down Expand Up @@ -171,7 +170,8 @@ module.exports = {
// instead of jumping directly to the SDL file, you can override definition peek/jump results to point to different files or locations
// (for example, source files for your schema in any language!)
// based on Relay vscode's pathToLocateCommand
locateCommand: (projectName, typePath, info) => {
// see LocateCommand type!
locateCommand(projectName, typePath, info) {
// pass more info, such as GraphQLType with the ast node. info.project is also available if you need it
const { path, range } = ourLookupUtility(
projectName,
Expand All @@ -180,7 +180,8 @@ module.exports = {
);
return { uri: path, range }; // range.start.line/range.end.character/etc, base 1
// you can also return relay LSP style
return '/path/to/file.py:20:23';
// return '/path/to/file.py:20:23'; // (range: 20:1 )
// return '/path/to/file.py'; // (range: 1:1 1:1)
},
},
},
Expand Down
35 changes: 2 additions & 33 deletions packages/graphql-language-service-server/src/MessageProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,7 @@ import type { UnnormalizedTypeDefPointer } from '@graphql-tools/load';
import { getGraphQLCache, GraphQLCache } from './GraphQLCache';
import { parseDocument } from './parseDocument';

import {
printSchema,
visit,
parse,
FragmentDefinitionNode,
GraphQLType,
ASTNode,
} from 'graphql';
import { printSchema, visit, parse, FragmentDefinitionNode } from 'graphql';
import { tmpdir } from 'node:os';
import {
ConfigEmptyError,
Expand All @@ -73,7 +66,7 @@ import {
LoaderNoResultError,
ProjectNotFoundError,
} from 'graphql-config';
import type { LoadConfigOptions } from './types';
import type { LoadConfigOptions, LocateCommand } from './types';
import {
DEFAULT_SUPPORTED_EXTENSIONS,
SupportedExtensionsEnum,
Expand All @@ -91,30 +84,6 @@ type CachedDocumentType = {
contents: CachedContent[];
};

type AdditionalLocateInfo = {
node?: ASTNode | null;
type?: GraphQLType | null;
project: GraphQLProjectConfig;
};

type RelayLSPLocateCommand = (
// either Type, Type.field or Type.field(argument)
projectName: string,
typeName: string,
info: AdditionalLocateInfo,
) => `${string}:${string}:${string}` | `${string}:${string}` | string;

type GraphQLLocateCommand = (
projectName: string,
typeName: string,
info: AdditionalLocateInfo,
) => {
range: RangeType;
uri: string;
};

type LocateCommand = RelayLSPLocateCommand | GraphQLLocateCommand;

function toPosition(position: VscodePosition): IPosition {
return new Position(position.line, position.character);
}
Expand Down
Loading

0 comments on commit e5ab31e

Please sign in to comment.