Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Autocomplete suggestion files in project
Autocomplete suggestion files in project [message #1831521] Fri, 21 August 2020 16:45 Go to next message
Piotr Wilczyński is currently offline Piotr WilczyńskiFriend
Messages: 3
Registered: August 2020
Junior Member
Hey,

I have question - at certain points in editor I want to suggest:
1. JSONPaths from other file
2. file names that are in user project

I was able to set up simple grammar and generator, language server that Theia is using.

Somehow files are ending up in src-gen in user project anyways :)

So now in .ide module in IdeContentProposalProvider I want to get list of files that are in user's workspace (or in src-gen in user's workspace)
Additionally I want user to provide sample JSON or XML from which I can get all JSONPaths or XMLPaths and add some proposal as well.

In generator I have IFileSystemAccess2 that allows me to access user files, but I cannot inject same object into IdeContentProposalProvider. Is there any way to do this?
Re: Autocomplete suggestion files in project [message #1831584 is a reply to message #1831521] Mon, 24 August 2020 09:45 Go to previous messageGo to next message
Piotr Wilczyński is currently offline Piotr WilczyńskiFriend
Messages: 3
Registered: August 2020
Junior Member
After some digging I am able to create IFilesSystemAccess2, but for that to work correctly I need actually filepath of currently edited file. Is there any way to obtain it from - my guess would be something from ContentAssistContext?
Re: Autocomplete suggestion files in project [message #1831585 is a reply to message #1831584] Mon, 24 August 2020 09:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i assume you have to hook into the workspace creation / updates and build up and index of arbitray files yourself.
see org.eclipse.xtext.ide.server.LanguageServerImpl.initialize(InitializeParams) respectively

org.eclipse.xtext.ide.server.WorkspaceManager.initialize(List<WorkspaceFolder>, Procedure2<? super URI, ? super Iterable<Issue>>, CancelIndicator)
org.eclipse.xtext.ide.server.WorkspaceManager.refreshWorkspaceConfig(CancelIndicator)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Autocomplete suggestion files in project [message #1831587 is a reply to message #1831585] Mon, 24 August 2020 10:01 Go to previous message
Piotr Wilczyński is currently offline Piotr WilczyńskiFriend
Messages: 3
Registered: August 2020
Junior Member
Oh, cool. That would be even better :) Thanks!
Previous Topic:Extend xbase with a more expressive range
Next Topic:Add an ID (hidden) in the metamodel associated with the xtext grammar
Goto Forum:
  


Current Time: Wed Apr 24 22:33:16 GMT 2024

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

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

Back to the top