Skip to content

Commit

Permalink
feat: Line-index, hover, decoration provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kgilpin committed May 24, 2022
1 parent 2b089e9 commit e72de09
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import { ClassMapWatcher } from './services/classMapWatcher';
import { ClassMapTreeDataProvider } from './tree/classMapTreeDataProvider';
import { ResolvedFinding } from './services/resolvedFinding';
import AppMapService from './appMapService';
import LineInfoIndex from './services/lineInfoIndex';
import registerDecorationProvider from './decorations/decorationProvider';
import registerHoverProvider from './hover/hoverProvider';

export async function activate(context: vscode.ExtensionContext): Promise<AppMapService> {
const workspaceServices = new WorkspaceServices(context);
Expand All @@ -37,7 +40,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<AppMap
}

const appmapCollectionFile = new AppMapCollectionFile();
let findingsIndex: FindingsIndex | undefined, classMapIndex: ClassMapIndex | undefined;
let findingsIndex: FindingsIndex | undefined,
classMapIndex: ClassMapIndex | undefined,
lineInfoIndex: LineInfoIndex | undefined;

{
const appmapWatcher = new AppMapWatcher({
Expand Down Expand Up @@ -67,6 +72,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<AppMap
if (findingsEnabled) {
classMapIndex = new ClassMapIndex();
findingsIndex = new FindingsIndex();
lineInfoIndex = new LineInfoIndex(findingsIndex, classMapIndex);

const findingsDiagnosticsProvider = new FindingsDiagnosticsProvider();
findingsIndex.on('added', (uri: vscode.Uri, findings: ResolvedFinding[]) =>
Expand All @@ -81,21 +87,26 @@ export async function activate(context: vscode.ExtensionContext): Promise<AppMap
treeDataProvider: findingsTreeProvider,
});

const classMapProvider = new ClassMapTreeDataProvider(classMapIndex);
vscode.window.createTreeView('appmap.views.codeObjects', {
treeDataProvider: classMapProvider,
});

registerDecorationProvider(context, lineInfoIndex);
registerHoverProvider(context, lineInfoIndex);

const classMapWatcher = new ClassMapWatcher({
onCreate: classMapIndex.addClassMapFile.bind(classMapIndex),
onChange: classMapIndex.addClassMapFile.bind(classMapIndex),
onDelete: classMapIndex.removeClassMapFile.bind(classMapIndex),
});
const classMapProvider = new ClassMapTreeDataProvider(classMapIndex);
vscode.window.createTreeView('appmap.views.codeObjects', {
treeDataProvider: classMapProvider,
});

const findingWatcher = new FindingWatcher({
onCreate: findingsIndex.addFindingsFile.bind(findingsIndex),
onChange: findingsIndex.addFindingsFile.bind(findingsIndex),
onDelete: findingsIndex.removeFindingsFile.bind(findingsIndex),
});

workspaceServices.enroll(classMapWatcher);
workspaceServices.enroll(findingWatcher);
}
Expand Down

0 comments on commit e72de09

Please sign in to comment.