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

Click the status bar icon to index workspace. #1898

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 13 additions & 12 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as querystring from 'querystring';
import { createHash } from 'crypto';
import * as os from 'os';

import { ExtensionContext, window, commands, workspace, Disposable, languages, IndentAction, env, Uri, ConfigurationTarget, InputBoxOptions } from 'vscode';
import { ExtensionContext, window, commands, workspace, Disposable, languages, IndentAction, env, Uri, ConfigurationTarget, InputBoxOptions, StatusBarItem } from 'vscode';
import {
LanguageClient, LanguageClientOptions, ServerOptions,
TransportKind,
Expand All @@ -35,6 +35,7 @@ let languageClient: LanguageClient;
let extensionContext: ExtensionContext;
let middleware:IntelephenseMiddleware;
let clientDisposable:Disposable;
let statusBar: StatusBarItem;

export async function activate(context: ExtensionContext) {

Expand Down Expand Up @@ -254,20 +255,20 @@ function enterLicenceKey(context:ExtensionContext) {
}

function registerNotificationListeners() {
let resolveIndexingPromise: () => void;
if (!statusBar) {
statusBar = window.createStatusBarItem();
statusBar.command = INDEX_WORKSPACE_CMD_NAME;
statusBar.text = '$(refresh) intelephense';
statusBar.tooltip = 'intelephense ' + VERSION.toString() + ' - Index workspace';
statusBar.show();
}
languageClient.onNotification(INDEXING_STARTED_NOTIFICATION.method, () => {
window.setStatusBarMessage('$(sync~spin) intelephense ' + VERSION.toString() + ' indexing ...', new Promise<void>((resolve, reject) => {
resolveIndexingPromise = () => {
resolve();
}
}));
statusBar.command = CANCEL_INDEXING_CMD_NAME;
statusBar.text = '$(sync~spin) intelephense ' + VERSION.toString() + ' indexing ...';
});

languageClient.onNotification(INDEXING_ENDED_NOTIFICATION.method, () => {
if (resolveIndexingPromise) {
resolveIndexingPromise();
}
resolveIndexingPromise = undefined;
statusBar.command = INDEX_WORKSPACE_CMD_NAME;
statusBar.text = '$(refresh) intelephense';
});
}

Expand Down