CodeMirror SPARQL Language Support
A CodeMirror extension that provides SPARQL syntax highlighting and language support.
Note
This parser is in a usable state but not 100% in line with the spec yet
Usage
import { basicSetup } from 'codemirror';
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { sparql } from 'codemirror-lang-sparql';
const doc = `
SELECT * WHERE { ?s ?p ?o }
`
new EditorView({
state: EditorState.create({
doc,
extensions: [
basicSetup,
sparql(),
],
}),
parent: document.querySelector('#editor'),
});