Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to add a documentation in code-completion?
How to add a documentation in code-completion? [message #1852779] Fri, 03 June 2022 13:26 Go to next message
Tom Martens is currently offline Tom MartensFriend
Messages: 5
Registered: May 2022
Junior Member
Hi,

I created the example (mydsl) and created a VSCode extension for it - so far it works fine. Now i want to implement a custom documentation when invoking the code completion in VSCode. I guess there is a default implementation because in VSCode I can see that the name is an ID (see image attached).

However, I want instead of "ID" that there is a custom "documentation" for this object.
What I tried is using the IEObjectDocumentationProvider like this
public class TestObjectDocumentationProvider implements IEObjectDocumentationProvider {

	@Override
	public String getDocumentation(EObject o) {
		return "test documentation for object";
	}

}

but I only get the text by hovering on the object and not like in the image I attached.

Is this possible and can someone point me to the correct interface?

Thanks!
Re: How to add a documentation in code-completion? [message #1852780 is a reply to message #1852779] Fri, 03 June 2022 13:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14285
Registered: July 2009
Senior Member
see https://github.com/itemis/xtext-languageserver-example/blob/master/org.xtext.example.mydsl.ide/src/org/xtext/example/mydsl/ide/EclipseLikeHoverService.xtend

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to add a documentation in code-completion? [message #1852782 is a reply to message #1852780] Fri, 03 June 2022 13:57 Go to previous messageGo to next message
Tom Martens is currently offline Tom MartensFriend
Messages: 5
Registered: May 2022
Junior Member
Hm, I implemented your suggestion but I still just get "ID" in the window (see image above). If I hover the object it says "Greeting name".
Is there something I am missing?
Re: How to add a documentation in code-completion? [message #1852783 is a reply to message #1852782] Fri, 03 June 2022 14:02 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14285
Registered: July 2009
Senior Member
i see this is not about hiver but about content assist.
i propose to check
org.eclipse.xtext.ide.editor.contentassist.IdeCrossrefProposalProvider.createProposal(IEObjectDescription, CrossReference, ContentAssistContext)
or org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider.createProposals(AbstractElement, ContentAssistContext, IIdeContentProposalAcceptor)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 03 June 2022 14:02]

Report message to a moderator

Previous Topic:'Generate WTEXT artifact' does not end...
Next Topic:Building an xtext language using gradle, in the main thread
Goto Forum:
  


Current Time: Thu Jun 30 22:25:28 GMT 2022

Powered by FUDForum. Page generated in 0.02159 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top