AdamNiederer / AdamNiederer/vue-mode

Better imenu to show functions and data

Offen
#58 5 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Emacs Lisp
Sterne
341
Forks
59
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi,
Currently the imenu shows some html tags. I'd like it to show javascript functions, and possibly different sub-menus for computed properties or methods.

I tried something but it is unclear to me how to add regular imenu entries.

I have a regexp, checked with the regexp-builder:

(setq imenu-generic-expression
'(("methods" "^\\s-*\\([a-zA-Z0-9_]+\\): function" 1)))

I don't know how to override the existing entries and use just that. I tried:

(add-hook 'vue-mode-hook
(lambda ()
(set (make-local-variable imenu-generic-expression)
'(("methods" "^\\s-*\\([a-zA-Z0-9_]+\\): function" 1))
)))

as discussed on emacswiki and [SE](https://emacs.stackexchange.com/questions/10105/imenu-generic-regexp-for-css-less) and as seen in a couple of other packages, with no luck.

An example file:

```
data: function() {
return {
page: 1,
};
},

props: {
title: String,
url: String,
},

computed: {
entries() {
log("hello");
},

methods: {
previousPage: function () {
// ...
},

```
there would be functions and data to catch, hence a few imenu regexps to write.

Any ideas ?

imenu doc: https://www.gnu.org/software/emacs/manual/html_node/elisp/Imenu.html

**edit**: I tried what you can see in the following commit.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.