Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make the syntax error more obvious #158

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/components/ModelEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { basicSetup } from 'codemirror';
import { indentUnit } from '@codemirror/language';
import { EditorView } from '@codemirror/view';
import { CasbinConfSupport } from '@/app/components/editor/casbin-mode/casbin-conf';
import { linter } from '@codemirror/lint';
import { linter, lintGutter } from '@codemirror/lint';
import { casbinLinter } from '@/app/utils/casbinLinter';
import { newModel } from 'casbin';
import { setError } from '@/app/utils/errorManager';
Expand Down Expand Up @@ -92,6 +92,7 @@ export const ModelEditor = () => {
indentUnit.of(' '),
EditorView.lineWrapping,
linter(casbinLinter),
lintGutter(),
EditorView.updateListener.of((update) => {
if (update.docChanged) {
editorRef.current = update.view;
Expand Down
3 changes: 2 additions & 1 deletion app/components/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { extractPageContent } from '../../utils/contentExtractor';
import { buttonPlugin } from './ButtonPlugin';
import { useLang } from '@/app/context/LangContext';
import LanguageMenu from '@/app/components/LanguageMenu';
import { linter } from '@codemirror/lint';
import { linter, lintGutter } from '@codemirror/lint';
import { casbinLinter } from '@/app/utils/casbinLinter';

export const EditorScreen = () => {
Expand Down Expand Up @@ -241,6 +241,7 @@ export const EditorScreen = () => {
EditorView.lineWrapping,
buttonPlugin(openDrawerWithMessage, extractContent, 'model'),
linter(casbinLinter),
lintGutter(),
]}
className={'function flex-grow h-[300px]'}
value={modelText}
Expand Down
Loading