Skip to content

Commit

Permalink
feat: make the syntax error more obvious (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
HashCookie authored Sep 20, 2024
1 parent c144361 commit 2d173df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 2d173df

Please sign in to comment.