Skip to content

Commit f50e065

Browse files
committed
Allow commenting lines
1 parent 7487148 commit f50e065

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

frontend/src/component/config/ConfigEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { StatusFallback } from "../common/StatusFallback";
88
import { Button } from "../common/Button";
99
import { EditorView } from "codemirror";
1010
import { IconDeviceFloppy } from "@tabler/icons-solidjs";
11-
import { Text } from "@codemirror/state";
1211

1312
export function ConfigEditor(props: { guildID: string; plugin: string; }) {
1413
const guild = () => useGuild(props.guildID);

frontend/src/component/config/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ import { gruvboxDark } from "@fsegurai/codemirror-theme-gruvbox-dark";
55
import { basicSetup } from "codemirror";
66
import { parser } from "lezer-toml";
77

8-
const parserWithMetadata = parser.configure({
9-
props: [
10-
indentNodeProp.add({ Array: continuedIndent({ except: /^\s*]/ }) }),
11-
]
8+
const toml = LRLanguage.define({
9+
parser: parser.configure({
10+
props: [
11+
indentNodeProp.add({ Array: continuedIndent({ except: /^\s*]/ }) }),
12+
]
13+
}),
14+
languageData: {
15+
commentTokens: { line: "#" }
16+
}
1217
});
1318

1419
export function baseExtensions(saveAction: Command) {
1520
return [
1621
basicSetup,
17-
LRLanguage.define({
18-
parser: parserWithMetadata,
19-
}),
22+
toml,
2023
keymap.of([{
2124
key: "Tab",
2225
run: insertTab,

0 commit comments

Comments
 (0)