Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add belongsTo edge and expand group #72

Merged
merged 3 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -116,26 +122,25 @@ 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<ICompilationUnit> sourceList = getAllSourceFiles(javaProject);

dumpParallelly(sourceList, threadPool, projVertex, lsif, hasPackageInformation, monitor);

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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down