AdamNiederer / AdamNiederer/vue-mode
Better imenu to show functions and data
- 主要語言
- Emacs Lisp
- 星號
- 341
- 分支
- 59
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
The payload names imenu-generic-expression and vue-mode-hook as the relevant entry points; start with those and the linked Emacs Imenu documentation, then inspect how vue-mode currently supplies HTML entries. Done means the imenu presents JavaScript functions and data, with suitable submenus for computed properties or methods, without the existing unwanted entries.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- emacs-lisp, javascript
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100