diff --git a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/EdgeBuilder.java b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/EdgeBuilder.java index ab45535..158cbe3 100644 --- a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/EdgeBuilder.java +++ b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/EdgeBuilder.java @@ -77,4 +77,8 @@ public Edge packageInformation(Vertex from, Vertex to) { public Edge diagnostic(Vertex from, Vertex to) { return new Edge(generator.next(), Edge.T_DIAGNOSTIC, from.getId(), to.getId()); } + + public Edge belongsTo(Vertex from, Vertex to) { + return new Edge(generator.next(), Edge.BELONGSTO, from.getId(), to.getId()); + } } diff --git a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/Indexer.java b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/Indexer.java index cee5309..105920c 100644 --- a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/Indexer.java +++ b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/Indexer.java @@ -99,6 +99,12 @@ private void buildIndex(IPath path, IProgressMonitor monitor, LsifService lsif) final ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + Group groupVertex = lsif.getVertexBuilder().group(ResourceUtils.fixURI(path.toFile().toURI()), + ConflictResolution.TAKEDB, path.lastSegment(), ResourceUtils.fixURI(path.toFile().toURI())); + LsifEmitter.getInstance().emit(groupVertex); + LsifEmitter.getInstance().emit( + lsif.getVertexBuilder().event(Event.EventScope.Group, Event.EventKind.BEGIN, groupVertex.getId())); + for (IProject proj : projects) { if (proj == null) { return; @@ -116,15 +122,13 @@ private void buildIndex(IPath path, IProgressMonitor monitor, LsifService lsif) // ProjectConnection.getModel JavaLanguageServerPlugin.logException(e.getMessage(), e); } - Group groupVertex = lsif.getVertexBuilder().group(ResourceUtils.fixURI(path.toFile().toURI()), ConflictResolution.TAKEDB, javaProject.getElementName(), ResourceUtils.fixURI(path.toFile().toURI())); - LsifEmitter.getInstance().emit(groupVertex); - LsifEmitter.getInstance().emit( - lsif.getVertexBuilder().event(Event.EventScope.Group, Event.EventKind.BEGIN, groupVertex.getId())); + Project projVertex = lsif.getVertexBuilder().project(javaProject.getElementName()); LsifEmitter.getInstance().emit(projVertex); LsifEmitter.getInstance().emit( lsif.getVertexBuilder().event(Event.EventScope.Project, Event.EventKind.BEGIN, projVertex.getId())); + LsifEmitter.getInstance().emit(lsif.getEdgeBuilder().belongsTo(projVertex, groupVertex)); List sourceList = getAllSourceFiles(javaProject); dumpParallelly(sourceList, threadPool, projVertex, lsif, hasPackageInformation, monitor); @@ -132,10 +136,11 @@ private void buildIndex(IPath path, IProgressMonitor monitor, LsifService lsif) VisitorUtils.endAllDocument(lsif); LsifEmitter.getInstance().emit( lsif.getVertexBuilder().event(Event.EventScope.Project, Event.EventKind.END, projVertex.getId())); - LsifEmitter.getInstance().emit( - lsif.getVertexBuilder().event(Event.EventScope.Group, Event.EventKind.END, groupVertex.getId())); } + LsifEmitter.getInstance() + .emit(lsif.getVertexBuilder().event(Event.EventScope.Group, Event.EventKind.END, groupVertex.getId())); + threadPool.shutdown(); } diff --git a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/protocol/Edge.java b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/protocol/Edge.java index 342ba6a..117e4c6 100644 --- a/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/protocol/Edge.java +++ b/com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/protocol/Edge.java @@ -45,6 +45,8 @@ public class Edge extends Element { public final static String PACKAGEINFORMATION = "packageInformation"; + public final static String BELONGSTO = "belongsTo"; + private String outV; private String inV;