Skip to content

Commit

Permalink
Format ts on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jan 5, 2023
1 parent 5f7152e commit 4081499
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/utils/parcelforvscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function activate(context: vscode.ExtensionContext) {
// Start the client. This will also launch the server
client.start();

addImportersView(client);
addImportersView(context, client);
}

export function deactivate(): Thenable<void> | undefined {
Expand Down
37 changes: 23 additions & 14 deletions packages/utils/parcelforvscode/src/importersView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@ import * as vscode from 'vscode';
import {LanguageClient, DocumentUri} from 'vscode-languageclient/node';
import {NotificationBuild, RequestImporters} from '@parcel/lsp-protocol';

export function addImportersView(client: LanguageClient) {
export function addImportersView(
context: vscode.ExtensionContext,
client: LanguageClient,
) {
let importersTreeProvider = new ImportersTreeProvider(client);
vscode.window.registerTreeDataProvider(
'importersView',
importersTreeProvider,
context.subscriptions.push(
vscode.window.registerTreeDataProvider(
'importersView',
importersTreeProvider,
),
);
context.subscriptions.push(
vscode.commands.registerCommand('importersView.focus', () => {
let activeEditor = vscode.window.activeTextEditor?.document.uri;
if (activeEditor) {
importersTreeProvider.setRoot(activeEditor.toString());
}
}),
);
vscode.commands.registerCommand('importersView.focus', () => {
let activeEditor = vscode.window.activeTextEditor?.document.uri;
if (activeEditor) {
importersTreeProvider.setRoot(activeEditor.toString());
}
});

// Clear after builds
client.onNotification(NotificationBuild, () => {
importersTreeProvider.setRoot(undefined);
});
context.subscriptions.push(
// Clear after builds
client.onNotification(NotificationBuild, () => {
importersTreeProvider.setRoot(undefined);
}),
);
}

export class ImportersTreeProvider implements vscode.TreeDataProvider<string> {
Expand Down

0 comments on commit 4081499

Please sign in to comment.