mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 08:11:24 +02:00
Autocomplete, and more CM stuff!
This commit is contained in:
@@ -1,43 +1,16 @@
|
||||
import { parser } from './url';
|
||||
// import { foldNodeProp, foldInside, indentNodeProp } from '@codemirror/language';
|
||||
import { styleTags, tags as t } from '@lezer/highlight';
|
||||
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
||||
import { completeFromList } from '@codemirror/autocomplete';
|
||||
|
||||
const parserWithMetadata = parser.configure({
|
||||
props: [
|
||||
styleTags({
|
||||
Protocol: t.comment,
|
||||
Port: t.attributeName,
|
||||
Host: t.variableName,
|
||||
PathSegment: t.bool,
|
||||
Slash: t.bool,
|
||||
Question: t.attributeName,
|
||||
QueryName: t.attributeName,
|
||||
QueryValue: t.attributeName,
|
||||
Amp: t.comment,
|
||||
Equal: t.comment,
|
||||
}),
|
||||
// indentNodeProp.add({
|
||||
// Application: (context) => context.column(context.node.from) + context.unit,
|
||||
// }),
|
||||
// foldNodeProp.add({
|
||||
// Application: foldInside,
|
||||
// }),
|
||||
],
|
||||
});
|
||||
import { LanguageSupport, LRLanguage } from '@codemirror/language';
|
||||
import { parser } from './url';
|
||||
|
||||
const urlLanguage = LRLanguage.define({
|
||||
parser: parserWithMetadata,
|
||||
languageData: {
|
||||
// commentTokens: {line: ";"}
|
||||
},
|
||||
parser,
|
||||
languageData: {},
|
||||
});
|
||||
|
||||
const exampleCompletion = urlLanguage.data.of({
|
||||
autocomplete: completeFromList([
|
||||
{ label: 'http://', type: 'keyword' },
|
||||
{ label: 'https://', type: 'keyword' },
|
||||
{ label: 'http://', type: 'constant' },
|
||||
{ label: 'https://', type: 'constant' },
|
||||
]),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user