Breadcrumb feature (can eglot support headerline like lsp-mode does?) #988
-
I really like eglot but it has not the headerline support which i always used in lsp-mode to get the node structure or location. it is very useful when I edit yaml file. the node entry is so deep and i always forgot where i am. and, how can i config yaml server location? my yaml server location is not in the path, so i want to config it by myself. how can i do? thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 7 replies
-
Alright, I more or less see what you mean. In lsp-mode you use the headerline to give you some kind of nesting path of the current point. But I need you or someone else to guide me in the way of the LSP feature that provides this. Then we can organize the design of this feature. When you have found this, make a new feature request discussion with the collected information, and some screenshots of how you think the feature should look like.
Use Since
Put this somewhere in your init file ( |
Beta Was this translation helpful? Give feedback.
-
i can not attach image here. would you please give me another email address so I can send you the image that shows what lsp-mode does. BTW, i change the setting to (setf (car (alist-get 'yaml-mode eglot-server-programs)) "my/special/path/to/yaml/server") it seems works for me. |
Beta Was this translation helpful? Give feedback.
-
Yes you are right, it's breadcrumb shows in headerline.
***@***.***
From: João Távora
Date: 2022-07-05 14:59
To: joaotavora/eglot
CC: haoisli9; Author
Subject: Re: [joaotavora/eglot] can eglot support headerline like lsp-mode does? (Discussion #988)
would you add some lsp-server installation function
No. Eglot is middleware to talk to servers. It tries to do one thing and do it well. It's supposed to be small. Also installing other software on the users machine has practical, ethical and legal considerations. You or someone else can build some other tool on top of Eglot.
BTW, i change the setting
That's very odd, but who knows
i can not attach image here. would you please give me another email address so I can send you the image that shows what lsp-mode does.
No. You can attach images where. Just drag and drop. But it's not very important. I think you are requesting a "breadcrumb" path in the header-line, right?
The most important thing is not the image, is to find the part of the LSP spec (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) where they talk about how to ask the server for the information about the breadcrumb.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello hello! My apologies if I'm breaching etiquitte by resurrecting this old thread, but I was looking for the same feature (breadcrumb support in a header-like UI element) and landed here. For completeness, here's what a breadcrumb might look like for a Haskell file - first, while hovering over a data/sum type: ...and while hovering the cursor while inside Per @joaotavora's request, the relevant portion of th LSP spec appears to be Thanks! |
Beta Was this translation helpful? Give feedback.
-
Yes you are right, it is breadcrumb.
Can eglot support breadcrumb feature? or does eglot have the plan ?
***@***.***
From: João Távora
Date: 2022-07-05 14:59
To: joaotavora/eglot
CC: haoisli9; Author
Subject: Re: [joaotavora/eglot] can eglot support headerline like lsp-mode does? (Discussion #988)
would you add some lsp-server installation function
No. Eglot is middleware to talk to servers. It tries to do one thing and do it well. It's supposed to be small. Also installing other software on the users machine has practical, ethical and legal considerations. You or someone else can build some other tool on top of Eglot.
BTW, i change the setting
That's very odd, but who knows
i can not attach image here. would you please give me another email address so I can send you the image that shows what lsp-mode does.
No. You can attach images where. Just drag and drop. But it's not very important. I think you are requesting a "breadcrumb" path in the header-line, right?
The most important thing is not the image, is to find the part of the LSP spec (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) where they talk about how to ask the server for the information about the breadcrumb.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
update : don't use this hacky implementation, see at the bottom for more robust implementation. I'm also on the opinion that this should be add-on and not core eglot function. I've put together something temporary that gets the job done for me. It piggybacks on Here is screenshot and current version of the code
|
Beta Was this translation helpful? Give feedback.
-
imenu-breadcrumb minor mode is a very good name. Suggest you submit this
suggestion
to the existing https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58431 I
created.
Also suggest that discussion continue there. And that François-René's
solution
is attached there.
|
Beta Was this translation helpful? Give feedback.
-
Seems excellent!
But how can I do to let it work without elgot? I had enabled which-func-mode. but seems it does not work? Does it depend on elgot? or maybe I should add something?
Thanks.
***@***.***
From: gdanov
Date: 2022-12-02 18:34
To: joaotavora/eglot
CC: haoisli9; Author
Subject: Re: [joaotavora/eglot] Breadcrumb feature (can eglot support headerline like lsp-mode does?) (Discussion #988)
I'm also on the opinion that this should be add-on and not core eglot function.
I've put together something temporary that gets the job done for me. It piggybacks on which-function-mode which on it's side uses imenu's eglot integration. The solution is probably more of a generic imenu-driven breadcrumb, not eglot specific.
Here is screenshot and current version of the code
(setq
which-func-imenu-joiner-function
(lambda (x)
(let* ((otype (car x))
(loc-sym (car (split-string (car (last x)) " ")))
(path (mapcan
(lambda (pel)
(split-string pel "::"))
(seq-map
(lambda (pel)
(car (split-string pel " ")))
(butlast (cdr x)))))
(result (seq-filter
(lambda (pel)
(and
(<= (length (split-string pel "::")) 1)
;;(<= (length (split-string pel "\\.")) 1)
(seq-reduce (lambda (o v)
(and o (not (string= pel v)))) (list "callback") t)))
path)))
(when (seq-reduce (lambda (o v) (or o (string= v otype))) (list "Method" "Constructor" "Function") nil)
(setq result (append result (list loc-sym))))
;;(message "<< %s %s" x (list (list loc-sym ":" otype) (list (seq-map #'list path))))
;;(message ">>> %s" result)
(setq header-line-format (mapconcat #'identity result " » "))
;; return
"")))
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Are there plans to integrate that into stock emacs/eglot? As it stands right now, copy/paste the code from @gdanov into init.el is what we get, right? |
Beta Was this translation helpful? Give feedback.
Alright, I more or less see what you mean. In lsp-mode you use the headerline to give you some kind of nesting path of the current point. But I need you or someone else to guide me in the way of the LSP feature that provides this. Then we can organize the design of this feature. When you have found this, make a new feature request discussion with the collected information, and some screenshots of how you think the feature should look like.