Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to format code #35

Open
STofone opened this issue Mar 20, 2024 · 1 comment
Open

How to format code #35

STofone opened this issue Mar 20, 2024 · 1 comment

Comments

@STofone
Copy link

STofone commented Mar 20, 2024

I want to format selected code (or auto format after save or after setValue).
The solutions i found is to use indentLine. But when i print the reference of CodeMirror Component, there's no method indentLine.

<CodeMirror
  ref="codeMirror"
  v-model="code"
  :extensions="extensions"
  :tab="true"
  placeholder="Please enter the code."
  style="height: 100%"
  @change="save"
></CodeMirror>
......
console.log(codeMirror)

image

@logue
Copy link
Owner

logue commented Apr 3, 2024

It seems that this function does not exist in the CodeMirror standard, but it seems possible to do it by implementing the process described on the following site.

https://discuss.codemirror.net/t/adding-indentation/5622/7

In this program, I think you can do this by putting this function in @update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants