Home > @neo4j-cypher/editor-support
Cypher language support package using an antlr4 grammar
This package provides cypher query parsing using an antlr4 grammar.
It is mostly unchanged from the original implementation.
It provides capabilities for cypher query syntax highlighting and and autocompletion suggestions.
Class | Description |
---|---|
CypherEditorSupport | Instances of this class are used to encapsulate the parsed cypher tree for the antlr4 grammar |
CypherLexer | The CypherLexer class generated by antlr4 |
Instances of this class are used to encapsulate the parsed cypher tree for the antlr4 grammar
Signature:
export class CypherEditorSupport
Constructor | Description |
---|---|
(constructor)(input) | Constructs a new instance of the CypherEditorSupport class |
Constructs a new instance of the CypherEditorSupport
class
Signature:
constructor(input: string);
Parameters:
Parameter | Type |
---|---|
input | string |
Method |
---|
getCompletion(line, column, doFilter) |
setSchema(schema) |
update(input) |
Signature:
getCompletion(
line: number,
column: number,
doFilter?: boolean
): {
from: EditorSupportPosition;
to: EditorSupportPosition;
items: EditorSupportCompletionItem[];
};
Parameters:
Parameter | Type | Description |
---|---|---|
line | number | |
column | number | |
doFilter | boolean | (Optional) |
Returns:
{ from: EditorSupportPosition; to: EditorSupportPosition; items: EditorSupportCompletionItem[]; }
Signature:
setSchema(schema: EditorSupportSchema): void;
Parameters:
Parameter | Type |
---|---|
schema | EditorSupportSchema |
Returns:
void
Signature:
update(input: string): void;
Parameters:
Parameter | Type |
---|---|
input | string |
Returns:
void
The CypherLexer class generated by antlr4
Signature:
export class CypherLexer extends Lexer
Extends: Lexer
Constructor | Description |
---|---|
(constructor)(input) | Constructs a new instance of the CypherLexer class |
Constructs a new instance of the CypherLexer
class
Signature:
constructor(input: string);
Parameters:
Parameter | Type |
---|---|
input | string |
Property | Type |
---|---|
channelNames | string[] |
grammarFileName | string |
literalNames | string[] |
modeNames | string[] |
ruleNames | string[] |
symbolicNames | string[] |
Signature:
channelNames: string[];
Signature:
grammarFileName: string;
Signature:
literalNames: string[];
Signature:
modeNames: string[];
Signature:
ruleNames: string[];
Signature:
symbolicNames: string[];
Function | Description |
---|---|
createCypherLexer(input) | Helper function to instanciate a CypherLexer |
parse(input) | Helper function to parse a cypher query |
Helper function to instanciate a CypherLexer
Signature:
declare function createCypherLexer(input: string): CypherLexer;
Parameter | Type |
---|---|
input | string |
Returns:
Helper function to parse a cypher query
Signature:
declare function parse(input: string): {
referencesListener: {
queriesAndCommands: QueryOrCommand[];
};
};
Parameter | Type |
---|---|
input | string |
Returns:
{ referencesListener: { queriesAndCommands: QueryOrCommand[]; }; }
Interface | Description |
---|---|
ConsoleCommand | A console command, these are typically prefixed with : like :help |
EditorSupportCompletionItem | EditorSupportCompletionItem |
EditorSupportPosition | The editor support library has its own representation of editor positions |
EditorSupportSchema | The editor support schema contains information about a graph database that enables advanced autocompletion & syntax highlighting. |
FunctionSchema | A function provided by the graph database |
ProcedureSchema | A procedure provided by the graph database |
QueryOrCommand |
A console command, these are typically prefixed with :
like :help
Signature:
export interface ConsoleCommand
Property | Type | Description |
---|---|---|
commands? | ConsoleCommand[] | (Optional) |
description? | string | (Optional) |
name | string |
Signature:
commands?: ConsoleCommand[];
Signature:
description?: string;
Signature:
name: string;
EditorSupportCompletionItem
Signature:
export interface EditorSupportCompletionItem
Property | Type |
---|---|
content | string |
postfix | null |
type | CompletionType |
view | string |
Signature:
content: string;
Signature:
postfix: null;
Signature:
type: CompletionType;
Signature:
view: string;
The editor support library has its own representation of editor positions
Signature:
export interface EditorSupportPosition
Property | Type | Description |
---|---|---|
column | number | |
line | number | The 1 based line number The 0 based column number |
Signature:
column: number;
The 1 based line number The 0 based column number
Signature:
line: number;
The editor support schema contains information about a graph database that enables advanced autocompletion & syntax highlighting.
Signature:
export interface EditorSupportSchema
Property | Type | Description |
---|---|---|
consoleCommands? | ConsoleCommand[] | (Optional) The list of console commands |
functions? | FunctionSchema[] | (Optional) The list of functions provided the graph database |
labels? | string[] | (Optional) The list of labels in the graph database |
parameters? | string[] | (Optional) The list of parameters |
procedures? | ProcedureSchema[] | (Optional) The list of procedures provided the graph database |
propertyKeys? | string[] | (Optional) The list of property keys in the graph database |
relationshipTypes? | string[] | (Optional) The list of relationship types in the graph database |
The list of console commands
Signature:
consoleCommands?: ConsoleCommand[];
The list of functions provided the graph database
Signature:
functions?: FunctionSchema[];
The list of labels in the graph database
Signature:
labels?: string[];
The list of parameters
Signature:
parameters?: string[];
The list of procedures provided the graph database
Signature:
procedures?: ProcedureSchema[];
The list of property keys in the graph database
Signature:
propertyKeys?: string[];
The list of relationship types in the graph database
Signature:
relationshipTypes?: string[];
A function provided by the graph database
Signature:
export interface FunctionSchema
Property | Type |
---|---|
name | string |
signature | string |
Signature:
name: string;
Signature:
signature: string;
A procedure provided by the graph database
Signature:
export interface ProcedureSchema
Property | Type |
---|---|
name | string |
returnItems | FunctionSchema[] |
signature | string |
Signature:
name: string;
Signature:
returnItems: FunctionSchema[];
Signature:
signature: string;
Signature:
declare interface QueryOrCommand
Property | Type |
---|---|
cypherConsoleCommandName | () => { getText: () => string } |
getText | () => string |
start | EditorSupportPosition |
stop | EditorSupportPosition |
Signature:
cypherConsoleCommandName: () => { getText: () => string };
Signature:
getText: () => string;
Signature:
start: EditorSupportPosition;
Signature:
stop: EditorSupportPosition;
Type Alias | Description |
---|---|
CompletionType | All autocomplete options have a CompletionType |
All autocomplete options have a CompletionType
Signature:
export type CompletionType =
| "keyword"
| "label"
| "variable"
| "parameter"
| "propertyKey"
| "relationshipType"
| "function"
| "procedure"
| "consoleCommand"
| "consoleCommandSubcommand"
| "procedureOutput"
| "noop";