latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.55k stars 53 forks source link

Display inlay hints for labels/sections/theorems #753

Open vigoux opened 2 years ago

vigoux commented 2 years ago

Hey,

I wonder if it could be possible to send the full name of the named parts of a document (theorem, section, ...) as somethings like an inlayHint or something like that ?

It should be pretty easy as this is already done as the hover.

clason commented 2 years ago

Where would you want this?

vigoux commented 2 years ago

I'd say that \label is far sufficient as a starting point. For \*ref and \cite I think that the hover is enough, and does not get too much in the way.

For the record, there is also to inlineValue that seems to match what could be done with this.

pfoerster commented 2 years ago

I'd say that \label is far sufficient as a starting point.

I could see the use if you want to quickly scan through the document and see the label numbers as inlay hints. I have created a draft PR (#756), that implements this request for \label.

For the record, there is also to inlineValue that seems to match what could be done with this.

I think inlayValue is more meant as an aid when using a debugger. See InlineValueContext.

pfoerster commented 2 years ago

For *ref and \cite I think that the hover is enough, and does not get too much in the way.

I agree 👍. I think we can close this issue for now.

vigoux commented 1 year ago

Coming back to this, I think that adding inlay hints (maybe configurable) for \*ref and \cite is a good thing. Do you think we can reopen this issue ?

pfoerster commented 1 year ago

@vigoux I have added inlay hints for label references with the latest commit on master. Regarding \cite: I have a PR (#944) although I am not sure if the inlay hints are a bit too long for citations.

ismasou commented 9 months ago

Hi,

I don't know if I should open a separate issue for this. I was wondering if we can have a setting to limit the amount of text in the inlay hint. My captions are usually huge, I would like to have only the figure number and maybe just few words from the caption but not the entire thing.

Thank you.