surmon-china / vue-codemirror

@codemirror code editor component for @vuejs

Home Page:https://github.surmon.me/vue-codemirror

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Highlighting the lines in editor

rohitasare7 opened this issue · comments

Clear and concise description of the problem

I need to highlight few lines by green color, I checked codemirror documentation but I am not able to understand (apologies as I am new to vue js and codemirror) can anyone help me please? my requirement is to highlight specific lines with a green color. I am unable to join discord since the link is not active hence raised the feature request

Suggested solution

please share solution if possible.

Alternative

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

also I am not able to get any reference, I want to use markselection --> https://codemirror.net/5/demo/markselection.html but I am not able to get proper reference of my code editor, below is the code -->

`//codemirror
import { Codemirror } from 'vue-codemirror';
import { java } from '@codemirror/lang-java';
import { oneDark } from '@codemirror/theme-one-dark';
import { EditorView } from 'codemirror';

//CodeMirror Data
const extensions = [java(), oneDark, EditorView.lineWrapping];
const view = shallowRef();
const handleReady = (payload) => {
view.value = payload.view;
// const state = view.value.state;
}`

as per the documentation (from the link I have shared)

<script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, styleSelectedText: true }); editor.markText({line: 6, ch: 26}, {line: 6, ch: 42}, {className: "styled-background"}); </script>

here I am unable to get the editor reference.