Files
Agent-n8n/n8n-n8n-1.109.2/packages/@n8n/codemirror-lang/src/expressions/index.ts

30 lines
647 B
TypeScript
Raw Normal View History

2025-09-08 04:48:28 +08:00
import { LRLanguage, LanguageSupport, foldNodeProp, foldInside } from '@codemirror/language';
import { styleTags, tags as t } from '@lezer/highlight';
import { parser } from './grammar';
export const parserWithMetaData = parser.configure({
props: [
foldNodeProp.add({
Application: foldInside,
}),
styleTags({
OpenMarker: t.brace,
CloseMarker: t.brace,
Plaintext: t.content,
Resolvable: t.string,
}),
],
});
export const n8nLanguage = LRLanguage.define({
parser: parserWithMetaData,
languageData: {
commentTokens: { line: ';' },
},
});
export function n8nExpression() {
return new LanguageSupport(n8nLanguage);
}