Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Keyword Highlighting In A Standalone Application?
Keyword Highlighting In A Standalone Application? [message #1751238] Fri, 06 January 2017 04:34 Go to next message
Sam Patterson is currently offline Sam PattersonFriend
Messages: 18
Registered: June 2016
Junior Member
Is it possible to make use of Xtext's keyword highlighting in a standalone program? I'm creating a custom text editor for a DSL and it would be really handy to be able to use the keyword highlighter instead of implementing one manually.

Re: Keyword Highlighting In A Standalone Application? [message #1751241 is a reply to message #1751238] Fri, 06 January 2017 08:00 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi Sam,

yes, with the upcoming Xtext 2.11 (Jan 24th) we support the Language Server Protocol. With that you can use your DSL runtime as a language server and get coloring information from it. For you particulary the Document Highlight request is interesting: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#textDocument_documentHighlight

A beta for 2.11 is already available on the milestone repository.

Your job would be to implement the client side of the LSP and embed a language server (which is mainly starting org.eclipse.xtext.ide.server.ServerLauncher and connecting it to your app).

HTH,
~Karsten
Re: Keyword Highlighting In A Standalone Application? [message #1751242 is a reply to message #1751241] Fri, 06 January 2017 08:18 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

The LSP doesn't support syntax highlighting (the mentioned request is about 'mark occurences').
However, we have built an extension to the LSP for semantic coloring, which you could use. For just coloring keywords this seems to be a bit overkill, though.
Do you plan to support more editing features in your standalone app? What technology is it written in?

Cheers,
Sven
Re: Keyword Highlighting In A Standalone Application? [message #1751304 is a reply to message #1751242] Sat, 07 January 2017 12:32 Go to previous messageGo to next message
Sam Patterson is currently offline Sam PattersonFriend
Messages: 18
Registered: June 2016
Junior Member
Hmm, it does seem slightly overkill. I will most likely just implement the feature manually.
Re: Keyword Highlighting In A Standalone Application? [message #1751343 is a reply to message #1751304] Mon, 09 January 2017 08:07 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

In that case you could write a generator fragment that will produce the hightlighting configuration from the grammar definition.
Previous Topic:function call operator?
Next Topic:Xtext Symbol
Goto Forum:
  


Current Time: Fri Apr 26 04:30:39 GMT 2024

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

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

Back to the top