Library in VS Code extension [message #1859786] |
Tue, 27 June 2023 05:58  |
Eclipse User |
|
|
|
Good morning,
I'm creating this topic because I couldn't find an answer for the problem I'm having.
I am currently developing a VS Code extension for my DSL developed with Xtext.
In the current architecture of my DSL, I have a plugin "org.eclipse.mydsl.lib" which is a library containing common implementations of objects in my language.
Currently, using my DSL from an Eclipse runtime, this plugin is automatically added to the MANIFEST.MF of every new project.
However, with VS Code, I no longer have access to the MANIFEST.MF. Thus, every new project using my DSL does not have access to this plug-in and the common object implementation described by this library.
Is there a way to get a reference to this library/plugin via the language server?
Let me know if it's not clear enough.
Thank you,
Cyril
|
|
|
|
Re: Library in VS Code extension [message #1859811 is a reply to message #1859799] |
Wed, 28 June 2023 10:39   |
Eclipse User |
|
|
|
Hi,
I followed what you suggested here about the ProjectManager: https://github.com/eclipse/xtext/issues/2566
public class CustomProjectManager extends ProjectManager {
IProjectConfig projectConfig;
@Override
public void initialize(ProjectDescription description, IProjectConfig projectConfig,
Procedure2<? super URI, ? super Iterable<Issue>> acceptor,
IExternalContentProvider openedDocumentsContentProvider,
Provider<Map<String, ResourceDescriptionsData>> indexProvider, CancelIndicator cancelIndicator) {
super.initialize(description, projectConfig, acceptor, openedDocumentsContentProvider, indexProvider, cancelIndicator);
this.projectConfig = projectConfig;
}
@Override
public Result doInitialBuild(CancelIndicator cancelIndicator) {
List<URI> allUris = new ArrayList<>();
for (ISourceFolder srcFolder : super.getProjectConfig().getSourceFolders()) {
allUris.addAll(srcFolder.getAllResources(fileSystemScanner));
}
var url = getClass().getResource("/org/eclipse/mydsl/lib/catalogue.mydsl");
allUris.add(URI.createURI(url.toString()));
return super.doBuild(allUris, Collections.emptyList(), Collections.emptyList(), cancelIndicator);
}
}
I also created a CustomServerModule and a CustomServerLauncher, but it doesn't work.
I tested the access to the resource was valid and I verified that the creation of the URI is done (in a junit test).
Any idea what I might have forgotten?
Thank you.
[Updated on: Wed, 28 June 2023 10:45] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03538 seconds