index.js (hoppscotch-2.2.1) | : | index.js (hoppscotch-3.0.0) | ||
---|---|---|---|---|
import { parser } from "./syntax.grammar" | import { parser } from "./syntax.grammar" | |||
import { | import { | |||
LRLanguage, | LRLanguage, | |||
LanguageSupport, | LanguageSupport, | |||
indentNodeProp, | indentNodeProp, | |||
foldNodeProp, | foldNodeProp, | |||
foldInside, | foldInside, | |||
delimitedIndent, | delimitedIndent, | |||
} from "@codemirror/language" | } from "@codemirror/language" | |||
import { styleTags, tags as t } from "@codemirror/highlight" | import { styleTags, tags as t } from "@lezer/highlight" | |||
export const GQLLanguage = LRLanguage.define({ | export const GQLLanguage = LRLanguage.define({ | |||
parser: parser.configure({ | parser: parser.configure({ | |||
props: [ | props: [ | |||
indentNodeProp.add({ | indentNodeProp.add({ | |||
"SelectionSet FieldsDefinition ObjectValue SchemaDefinition RootTypeDef" : | "SelectionSet FieldsDefinition ObjectValue SchemaDefinition RootTypeDef" : | |||
delimitedIndent({ closing: "}", align: true }), | delimitedIndent({ closing: "}", align: true }), | |||
}), | }), | |||
foldNodeProp.add({ | foldNodeProp.add({ | |||
Application: foldInside, | Application: foldInside, | |||
"SelectionSet FieldsDefinition ObjectValue RootOperationTypeDefinition R ootTypeDef": | "SelectionSet FieldsDefinition ObjectValue RootOperationTypeDefinition R ootTypeDef": | |||
(node) => { | (node) => { | |||
return { | return { | |||
from: node.from, | from: node.from, | |||
to: node.to, | to: node.to, | |||
} | } | |||
}, | }, | |||
}), | }), | |||
styleTags({ | styleTags({ | |||
Name: t.definition(t.variableName), | Comment: t.lineComment, | |||
"OperationDefinition/Name": t.definition(t.function(t.variableName)), | Name: t.propertyName, | |||
OperationType: t.keyword, | ||||
BooleanValue: t.bool, | ||||
StringValue: t.string, | StringValue: t.string, | |||
IntValue: t.number, | IntValue: t.integer, | |||
FloatValue: t.number, | FloatValue: t.float, | |||
NullValue: t.null, | NullValue: t.null, | |||
ObjectValue: t.brace, | BooleanValue: t.bool, | |||
Comment: t.lineComment, | Comma: t.separator, | |||
"OperationDefinition/Name": t.definition(t.function(t.variableName)), | ||||
"OperationType TypeKeyword SchemaKeyword FragmentKeyword OnKeyword Direc | ||||
tiveKeyword RepeatableKeyword SchemaKeyword ExtendKeyword ScalarKeyword Interfac | ||||
eKeyword UnionKeyword EnumKeyword InputKeyword ImplementsKeyword": t.keyword, | ||||
"ExecutableDirectiveLocation TypeSystemDirectiveLocation": t.atom, | ||||
"DirectiveName!": t.annotation, | ||||
"\"{\" \"}\"": t.brace, | ||||
"\"(\" \")\"": t.paren, | ||||
"\"[\" \"]\"": t.squareBracket, | ||||
"Type! NamedType": t.typeName, | ||||
}), | }), | |||
], | ], | |||
}), | }), | |||
languageData: { | languageData: { | |||
commentTokens: { line: "#" }, | commentTokens: { line: "#" }, | |||
closeBrackets: { brackets: ["(", "[", "{", '"', '"""'] }, | closeBrackets: { brackets: ["(", "[", "{", '"', '"""'] }, | |||
}, | }, | |||
}) | }) | |||
export function GQL() { | export function GQL() { | |||
End of changes. 4 change blocks. | ||||
9 lines changed or deleted | 17 lines changed or added |