| Linux webm007.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 Path : /home/eglisebaa/www/wp-content/plugins/code-snippets/js/ |
| Current File : /home/eglisebaa/www/wp-content/plugins/code-snippets/js/editor.ts |
import { defineMode, getMode, registerHelper } from 'codemirror'
import { Linter } from './utils/Linter'
import type { EditorConfiguration, ModeSpec } from 'codemirror'
interface ModeSpecOptions {
startOpen: boolean
}
const mode: ModeSpec<ModeSpecOptions> = {
name: 'application/x-httpd-php',
startOpen: true
}
defineMode('php-snippet', (config: EditorConfiguration) => getMode(config, mode))
registerHelper('lint', 'php', (text: string) => {
const linter = new Linter(text)
linter.lint()
return linter.annotations
})