Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphql-language-service

graphql-language-service

API Docs Discord Channel

Note: Still mostly experimental, however it depends mostly on stable libraries. Migration Note: As of 3.0.0, the LSP command line interface has been moved to graphql-language-service-cli

Purpose

This package brings together all the dependencies for building out web or desktop IDE services for the GraphQL Language.

It is named as such to match the convention of other vscode languageservices.

It also provides a new LanguageService class as browser/web-worker runtime friendly alternative to the one that lives in graphql-language-service-interface, that utilizes the same underlying functions, meaning most fixes and improvements from here on out will continue to be reflected by both implementations.

Usage

Instantiates with these optional parameters:

type GraphQLLanguageConfig = {
  parser?: typeof parse;
  schemaLoader?: typeof defaultSchemaLoader;
  schemaBuilder?: typeof defaultSchemaBuilder;
  schemaConfig: SchemaConfig;
};

this is the minimum configuration required:

const languageService = new LanguageService({
  schemaConfig: { uri: 'https://my/schema' },
});

Index

References

Classes

Type aliases

Functions

References

AdditionalRuleKinds

Re-exports AdditionalRuleKinds

AllTypeInfo

Re-exports AllTypeInfo

CachedContent

Re-exports CachedContent

CharacterStream

Re-exports CharacterStream

CharacterStreamInterface

Re-exports CharacterStreamInterface

CompletionItem

Re-exports CompletionItem

CompletionItemBase

Re-exports CompletionItemBase

ContextToken

Re-exports ContextToken

ContextTokenForCodeMirror

Re-exports ContextTokenForCodeMirror

ContextTokenUnion

Re-exports ContextTokenUnion

DIAGNOSTIC_SEVERITY

Re-exports DIAGNOSTIC_SEVERITY

Definition

Re-exports Definition

DefinitionQueryResult

Re-exports DefinitionQueryResult

Diagnostic

Re-exports Diagnostic

FileChangeType

Re-exports FileChangeType

FileChangeTypeKeys

Re-exports FileChangeTypeKeys

FileChangeTypeKind

Re-exports FileChangeTypeKind

FileEvent

Re-exports FileEvent

FragmentInfo

Re-exports FragmentInfo

GraphQLCache

Re-exports GraphQLCache

GraphQLConfig

Re-exports GraphQLConfig

GraphQLExtensionDeclaration

Re-exports GraphQLExtensionDeclaration

GraphQLFileInfo

Re-exports GraphQLFileInfo

GraphQLFileMetadata

Re-exports GraphQLFileMetadata

GraphQLLanguageConfig

Re-exports GraphQLLanguageConfig

GraphQLLanguageService

Re-exports GraphQLLanguageService

GraphQLProjectConfig

Re-exports GraphQLProjectConfig

IPosition

Re-exports IPosition

IRange

Re-exports IRange

LANGUAGE

Re-exports LANGUAGE

LanguageService

Re-exports LanguageService

LexRules

Re-exports LexRules

Maybe

Re-exports Maybe

NamedTypeInfo

Re-exports NamedTypeInfo

ObjectTypeInfo

Re-exports ObjectTypeInfo

Outline

Re-exports Outline

OutlineTree

Re-exports OutlineTree

ParseRule

Re-exports ParseRule

ParseRules

Re-exports ParseRules

ParserOptions

Re-exports ParserOptions

Position

Re-exports Position

Range

Re-exports Range

RawSchema

Re-exports RawSchema

Rule

Re-exports Rule

RuleKind

Re-exports RuleKind

RuleKindEnum

Re-exports RuleKindEnum

RuleKinds

Re-exports RuleKinds

RuleOrString

Re-exports RuleOrString

SEVERITY

Re-exports SEVERITY

SchemaConfig

Re-exports SchemaConfig

SchemaLoader

Re-exports SchemaLoader

SchemaResponse

Re-exports SchemaResponse

Severity

Re-exports Severity

SeverityEnum

Re-exports SeverityEnum

State

Re-exports State

TextToken

Re-exports TextToken

Token

Re-exports Token

TokenKind

Re-exports TokenKind

TokenPattern

Re-exports TokenPattern

TokenizedText

Re-exports TokenizedText

Uri

Re-exports Uri

_AdditionalRuleKinds

Re-exports _AdditionalRuleKinds

_RuleKinds

Re-exports _RuleKinds

butNot

Re-exports butNot

canUseDirective

Re-exports canUseDirective

defaultSchemaBuilder

Re-exports defaultSchemaBuilder

defaultSchemaLoader

Re-exports defaultSchemaLoader

forEachState

Re-exports forEachState

getASTNodeAtPosition

Re-exports getASTNodeAtPosition

getAutocompleteSuggestions

Re-exports getAutocompleteSuggestions

getDefinitionQueryResultForDefinitionNode

Re-exports getDefinitionQueryResultForDefinitionNode

getDefinitionQueryResultForFragmentSpread

Re-exports getDefinitionQueryResultForFragmentSpread

getDefinitionQueryResultForNamedType

Re-exports getDefinitionQueryResultForNamedType

getDefinitionState

Re-exports getDefinitionState

getDiagnostics

Re-exports getDiagnostics

getFieldDef

Re-exports getFieldDef

getFragmentDefinitions

Re-exports getFragmentDefinitions

getFragmentDependencies

Re-exports getFragmentDependencies

getFragmentDependenciesForAST

Re-exports getFragmentDependenciesForAST

getHoverInformation

Re-exports getHoverInformation

getOutline

Re-exports getOutline

getRange

Re-exports getRange

getTokenAtPosition

Re-exports getTokenAtPosition

getTypeInfo

Re-exports getTypeInfo

getVariableCompletions

Re-exports getVariableCompletions

hintList

Re-exports hintList

isIgnored

Re-exports isIgnored

list

Re-exports list

locToRange

Re-exports locToRange

objectValues

Re-exports objectValues

offsetToPosition

Re-exports offsetToPosition

onlineParser

Re-exports onlineParser

opt

Re-exports opt

p

Re-exports p

pointToOffset

Re-exports pointToOffset

runOnlineParser

Re-exports runOnlineParser

t

Re-exports t

validateQuery

Re-exports validateQuery

validateWithCustomRules

Re-exports validateWithCustomRules

Type aliases

GraphQLLanguageConfig

GraphQLLanguageConfig: { exteralFragmentDefinitions?: FragmentDefinitionNode[] | string; parseOptions?: ParseOptions; parser?: typeof parse; schemaBuilder?: typeof defaultSchemaBuilder; schemaConfig: SchemaConfig; schemaLoader?: typeof defaultSchemaLoader; schemaString?: string }

Type declaration

  • Optional exteralFragmentDefinitions?: FragmentDefinitionNode[] | string
  • Optional parseOptions?: ParseOptions
  • Optional parser?: typeof parse
  • Optional schemaBuilder?: typeof defaultSchemaBuilder
  • schemaConfig: SchemaConfig
  • Optional schemaLoader?: typeof defaultSchemaLoader
  • Optional schemaString?: string

RawSchema

RawSchema: string | IntrospectionQuery

SchemaConfig

SchemaConfig: { buildSchemaOptions?: BuildSchemaOptions; introspectionOptions?: IntrospectionOptions; requestOpts?: RequestInit; uri?: string }

Type declaration

  • Optional buildSchemaOptions?: BuildSchemaOptions
  • Optional introspectionOptions?: IntrospectionOptions
  • Optional requestOpts?: RequestInit
  • Optional uri?: string

SchemaLoader

SchemaLoader: (config: SchemaConfig) => Promise<SchemaResponse | null>

Type declaration

SchemaResponse

SchemaResponse: IntrospectionQuery | DocumentNode

Functions

bright

  • bright(str: string): string
  • Parameters

    • str: string

    Returns string

defaultSchemaBuilder

  • defaultSchemaBuilder(response: SchemaResponse, buildSchemaOptions?: BuildSchemaOptions): GraphQLSchema
  • Parameters

    • response: SchemaResponse

      response from retrieving schema

    • Optional buildSchemaOptions: BuildSchemaOptions

      options for building schema

    Returns GraphQLSchema

Const defaultSchemaLoader

  • Parameters

    Returns Promise<SchemaResponse | null>

yellow

  • yellow(str: string): string
  • Parameters

    • str: string

    Returns string

Generated using TypeDoc