Skip to content

Vue syntax highlighting isn't working #3723

@artenderrr

Description

@artenderrr

Description

As the title states, Vue syntax highlighting is broken. I first encountered this problem when there was no ~/.config/micro/syntax, so the editor was using the default syntax file.

What I've tried

  1. Installed vue.yaml (the one from the repository's micro/runtime/syntax) into ~/.config/micro/syntax.
    • Result: Opening any .vue file raises Error parsing syntax file vue: interface conversion: interface {} is nil, not []interface {} twice. After the file finally opens, no syntax highlighting is applied.
  2. Created my own vue.yaml (see Additional Information).
    • Result: The - include rule does not work as expected: for example, import { ref } from "vue" is not highlighted, even though other lines in the same <script> block are. In plain .js files, there is no such behavior. A similar issue appears in the <template> block, while the <style> block is highlighted correctly. A screenshot is provided in Additional Information.

Environment

  • OS: macOS Sequoia 15.0
  • Terminal emulator: Alacritty
  • Micro version: 2.0.14
  • Shell: zsh

Additional information

  1. Syntax highlighting with no custom vue.yaml.
Image
  1. Contents of my custom vue.yaml.
filetype: vue

detect:
    filename: "\\.vue$"

rules:
    - default:
        start: "<script.*?>"
        end: "</script>"
        rules:
            - include: "javascript"

    - default:
        start: "<template>"
        end: "</template>"
        rules:
            - include: "html"

    - default:
        start: "<style.*?>"
        end: "</style>"
        rules:
            - include: "css"

  1. Syntax highlighting with the custom vue.yaml.
Image 4. Vue code snippet used above — may be useful for quick reproduction.
<script setup>
import { ref } from "vue";

const count = ref(0);
</script>

<template>
	<p>{{ count }}</p>
	<button @click="count++">Increment</button>
</template>

<style>
html, body {
	width: 100%;
	height: 100%;
}

body {
	font-family: system-ui;
	font-size: 2rem;
}

#app {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}
</style>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions