[fix] highlighting
This commit is contained in:
parent
f8b00b2bac
commit
d5c5673c96
5 changed files with 276 additions and 29 deletions
|
|
@ -1,11 +1,15 @@
|
|||
import { EditorState } from '@codemirror/state';
|
||||
|
||||
import { lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, EditorView } from '@codemirror/view';
|
||||
import { EditorState, StateEffect } from '@codemirror/state';
|
||||
|
||||
import { lineNumbers, highlightActiveLineGutter, highlightSpecialChars,
|
||||
drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine,
|
||||
keymap, dropCursor,EditorView } from '@codemirror/view';
|
||||
|
||||
import { openSearchPanel, highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
||||
import { openLintPanel, lintGutter, lintKeymap, linter, setDiagnostics, } from "@codemirror/lint"
|
||||
import { indentWithTab, history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||
import { foldGutter, indentOnInput, indentUnit, bracketMatching, foldKeymap, StreamLanguage } from '@codemirror/language';
|
||||
import { foldGutter, indentOnInput, indentUnit, bracketMatching, foldKeymap,
|
||||
syntaxHighlighting, defaultHighlightStyle , StreamLanguage } from '@codemirror/language';
|
||||
|
||||
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||
|
||||
|
|
@ -21,7 +25,7 @@ function simpleWebSocketTransport(uri) {
|
|||
let handlers = [];
|
||||
return new Promise(function (resolve, reject) {
|
||||
let sock = new WebSocket(uri);
|
||||
|
||||
|
||||
sock.onmessage = e => { for (let h of handlers) h(e.data.toString()); };
|
||||
sock.onerror = e => reject(e);
|
||||
sock.onopen = () => resolve({
|
||||
|
|
@ -42,10 +46,10 @@ const baseExts = [
|
|||
foldGutter(),
|
||||
lintGutter(),
|
||||
drawSelection(),
|
||||
indentUnit.of(" "),
|
||||
dropCursor(),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
EditorView.lineWrapping,
|
||||
indentOnInput(),
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
||||
bracketMatching(),
|
||||
closeBrackets(),
|
||||
autocompletion(),
|
||||
|
|
@ -54,13 +58,12 @@ const baseExts = [
|
|||
highlightActiveLine(),
|
||||
highlightSelectionMatches(),
|
||||
keymap.of([
|
||||
indentWithTab,
|
||||
...closeBracketsKeymap,
|
||||
...defaultKeymap,
|
||||
...searchKeymap,
|
||||
...historyKeymap,
|
||||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...searchKeymap,
|
||||
...lintKeymap
|
||||
]),
|
||||
StreamLanguage.define(xQuery)
|
||||
|
|
@ -102,4 +105,4 @@ function listCommands(view) {
|
|||
return commands;
|
||||
};
|
||||
|
||||
export { EditorView,EditorState, openSearchPanel, openLintPanel, languageServerSupport, baseExts, simpleWebSocketTransport, linter, LSPPlugin, setDiagnostics, LSPClient, debouncedChangeListener, listCommands };
|
||||
export { EditorView, EditorState, StateEffect, openSearchPanel, openLintPanel, languageServerSupport, baseExts, simpleWebSocketTransport, linter, LSPPlugin, setDiagnostics, LSPClient, debouncedChangeListener, listCommands };
|
||||
Loading…
Add table
Add a link
Reference in a new issue