Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphql-language-service-interface

graphql-language-service-interface

NPM jsDelivr hits (npm) npm downloads Snyk Vulnerabilities for npm package License Discord Channel

API Docs

LSP Language Service written in Typescript used by GraphQL Language Service Server and Codemirror GraphQL.

This provides the Official Language Server Protocol compliant GraphQL language service to be used by an IDE plugin, a browser application or desktop application.

Index

References

DIAGNOSTIC_SEVERITY

Re-exports DIAGNOSTIC_SEVERITY

DefinitionQueryResult

Re-exports DefinitionQueryResult

GraphQLLanguageService

Re-exports GraphQLLanguageService

LANGUAGE

Re-exports LANGUAGE

SEVERITY

Re-exports SEVERITY

Severity

Re-exports Severity

SeverityEnum

Re-exports SeverityEnum

canUseDirective

Re-exports canUseDirective

forEachState

Re-exports forEachState

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

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

objectValues

Re-exports objectValues

runOnlineParser

Re-exports runOnlineParser

validateQuery

Re-exports validateQuery

Type aliases

DefinitionQueryResult

DefinitionQueryResult: { definitions: Definition[]; queryRange: Range[] }

Type declaration

OutlineableKinds

OutlineableKinds: keyof typeof OUTLINEABLE_KINDS

Severity

Severity: typeof SEVERITY

SeverityEnum

SeverityEnum: keyof Severity

Variables

Const LANGUAGE

LANGUAGE: "GraphQL" = "GraphQL"

Functions

canUseDirective

  • canUseDirective(state: State["prevState"], directive: GraphQLDirective): boolean
  • Parameters

    • state: State["prevState"]
    • directive: GraphQLDirective

    Returns boolean

forEachState

  • Parameters

    Returns void

getAutocompleteSuggestions

  • getAutocompleteSuggestions(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: CodeMirror.Token, fragmentDefs?: FragmentDefinitionNode[] | string): Array<CompletionItem>
  • Given GraphQLSchema, queryText, and context of the current position within the source text, provide a list of typeahead entries.

    Parameters

    • schema: GraphQLSchema
    • queryText: string
    • cursor: IPosition
    • Optional contextToken: CodeMirror.Token
    • Optional fragmentDefs: FragmentDefinitionNode[] | string

    Returns Array<CompletionItem>

getDefinitionQueryResultForDefinitionNode

  • getDefinitionQueryResultForDefinitionNode(path: Uri, text: string, definition: FragmentDefinitionNode | OperationDefinitionNode): DefinitionQueryResult
  • Parameters

    • path: Uri
    • text: string
    • definition: FragmentDefinitionNode | OperationDefinitionNode

    Returns DefinitionQueryResult

getDefinitionQueryResultForFragmentSpread

  • Parameters

    • text: string
    • fragment: FragmentSpreadNode
    • dependencies: Array<FragmentInfo>

    Returns Promise<DefinitionQueryResult>

getDefinitionQueryResultForNamedType

  • Parameters

    • text: string
    • node: NamedTypeNode
    • dependencies: Array<ObjectTypeInfo>

    Returns Promise<DefinitionQueryResult>

getDefinitionState

  • getDefinitionState(tokenState: State): State | null | undefined
  • Parameters

    Returns State | null | undefined

getDiagnostics

  • getDiagnostics(query: string, schema?: GraphQLSchema | null | undefined, customRules?: Array<ValidationRule>, isRelayCompatMode?: boolean, externalFragments?: FragmentDefinitionNode[] | string): Array<Diagnostic>
  • Parameters

    • query: string
    • Default value schema: GraphQLSchema | null | undefined = null
    • Optional customRules: Array<ValidationRule>
    • Optional isRelayCompatMode: boolean
    • Optional externalFragments: FragmentDefinitionNode[] | string

    Returns Array<Diagnostic>

getFieldDef

  • getFieldDef(schema: GraphQLSchema, type: GraphQLType, fieldName: string): GraphQLField<any, any> | null | undefined
  • Parameters

    • schema: GraphQLSchema
    • type: GraphQLType
    • fieldName: string

    Returns GraphQLField<any, any> | null | undefined

getFragmentDefinitions

  • getFragmentDefinitions(queryText: string): Array<FragmentDefinitionNode>
  • Parameters

    • queryText: string

    Returns Array<FragmentDefinitionNode>

getHoverInformation

  • getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken): Hover["contents"]
  • Parameters

    • schema: GraphQLSchema
    • queryText: string
    • cursor: IPosition
    • Optional contextToken: ContextToken

    Returns Hover["contents"]

getOutline

  • getOutline(documentText: string): Outline | null
  • Parameters

    • documentText: string

    Returns Outline | null

getRange

  • getRange(location: SourceLocation, queryText: string): IRange
  • Parameters

    • location: SourceLocation
    • queryText: string

    Returns IRange

getTokenAtPosition

  • getTokenAtPosition(queryText: string, cursor: IPosition): ContextToken
  • Parameters

    • queryText: string
    • cursor: IPosition

    Returns ContextToken

getTypeInfo

  • Parameters

    • schema: GraphQLSchema
    • tokenState: State

    Returns AllTypeInfo

getVariableCompletions

  • getVariableCompletions(queryText: string, schema: GraphQLSchema, forcePrefix?: boolean): CompletionItem[]
  • Parameters

    • queryText: string
    • schema: GraphQLSchema
    • Default value forcePrefix: boolean = false

    Returns CompletionItem[]

hintList

  • Type parameters

    Parameters

    Returns Array<T>

objectValues

  • objectValues<T>(object: Record<string, T>): Array<T>
  • Type parameters

    • T

    Parameters

    • object: Record<string, T>

    Returns Array<T>

runOnlineParser

  • runOnlineParser(queryText: string, callback: callbackFnType): ContextToken
  • Parameters

    • queryText: string
    • callback: callbackFnType

    Returns ContextToken

validateQuery

  • validateQuery(ast: DocumentNode, schema?: GraphQLSchema | null | undefined, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<Diagnostic>
  • Parameters

    • ast: DocumentNode
    • Default value schema: GraphQLSchema | null | undefined = null
    • Optional customRules: Array<ValidationRule> | null
    • Optional isRelayCompatMode: boolean

    Returns Array<Diagnostic>

Object literals

Const DIAGNOSTIC_SEVERITY

DIAGNOSTIC_SEVERITY: object

[SEVERITY.Error]

[SEVERITY.Error]: DiagnosticSeverity = 1 as DiagnosticSeverity

[SEVERITY.Hint]

[SEVERITY.Hint]: DiagnosticSeverity = 4 as DiagnosticSeverity

[SEVERITY.Information]

[SEVERITY.Information]: DiagnosticSeverity = 3 as DiagnosticSeverity

[SEVERITY.Warning]

[SEVERITY.Warning]: DiagnosticSeverity = 2 as DiagnosticSeverity

Const SEVERITY

SEVERITY: object

Error

Error: "Error" = 'Error' as 'Error'

Hint

Hint: "Hint" = 'Hint' as 'Hint'

Information

Information: "Information" = 'Information' as 'Information'

Warning

Warning: "Warning" = 'Warning' as 'Warning'

Generated using TypeDoc