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 remove the gutter and lineNumber? #206

Open
1 task done
francisashley opened this issue Jul 20, 2023 · 3 comments
Open
1 task done

How to remove the gutter and lineNumber? #206

francisashley opened this issue Jul 20, 2023 · 3 comments

Comments

@francisashley
Copy link

Clear and concise description of the problem

I see in src/config.ts that vue-codemirror uses import { basicSetup } from 'codemirror' to set the default config which according to the docs is convieniant way of quickly getting a basic editor working. The docs also mention this config must be replaced when looking to customise codemirror:

"This is an extension value that just pulls together a number of extensions that you might want in a basic editor. It is meant as a convenient helper to quickly set up CodeMirror without installing and importing a lot of separate packages.
This extension does not allow customization. The idea is that, once you decide you want to configure your editor more precisely, you take this package's source (which is just a bunch of imports and an array literal), copy it into your own code, and adjust it as desired."

When inspecting src/config.ts and src/component.ts (onMounted) it looks we can only extend the config but not override it.. so unless I'm mistaken, we're limited in how much we can control vue-codemirror and cannot remove the gutter and lineNumber ..?

Suggested solution

Add support for replace the default codemirror extensions

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.
@zl7261
Copy link

zl7261 commented Sep 20, 2023

+1

1 similar comment
@Ramil-Musin
Copy link

+1

@cyrilluce
Copy link

cyrilluce commented Jan 24, 2024

I'm encoutered same issue, this is my hacky solution:

import { install } from 'vue-codemirror';

// override vue-codemirror extensions
app.use(install, { extensions: [] });

Then, you can combine yourself's extensions, e.g.

<template>
    <Codemirror
        :extensions="[basicSetup]"
    ></Codemirror>
</template>

<script setup lang="ts">
import { basicSetup } from './setup';
</script>

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

4 participants