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

Show server tasks in terminal #1153

Merged
merged 2 commits into from
Nov 25, 2019
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
79 changes: 50 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preview": true,
"enableProposedApi": false,
"engines": {
"vscode": "^1.36.0"
"vscode": "^1.40.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -452,6 +452,11 @@
"command": "java.project.listSourcePaths",
"title": "List all Java source paths",
"category": "Java"
},
{
"command": "java.show.server.task.status",
"title": "Show Build Job Status",
"category": "Java"
}
],
"keybindings": [
Expand Down Expand Up @@ -541,13 +546,15 @@
},
"devDependencies": {
"@types/glob": "5.0.30",
"@types/lodash.findindex": "^4.6.6",
"@types/mocha": "^5.2.5",
"@types/node": "^6.0.40",
"@types/vscode": "^1.36.0",
"@types/vscode": "^1.40.0",
"@types/winston": "^2.4.4",
"gulp": "^4.0.0",
"gulp-decompress": "2.0.1",
"gulp-download": "0.0.1",
"lodash.findindex": "^4.6.0",
"mocha": "^5.2.0",
"ts-loader": "^5.3.1",
"tslint": "^5.11.0",
Expand Down
4 changes: 4 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,8 @@ export namespace Commands {
* Navigate To Super Method Command.
*/
export const NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND = 'java.action.navigateToSuperImplementation';
/**
* Show server task status
*/
export const SHOW_SERVER_TASK_STATUS = 'java.show.server.task.status';
}
25 changes: 9 additions & 16 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import { getJavaConfiguration } from './utils';
import { onConfigurationChange, excludeProjectSettingsFiles } from './settings';
import { logger, initializeLogFile } from './log';
import glob = require('glob');
import { serverTasks } from './serverTasks';
import { serverTaskPresenter } from './serverTaskPresenter';

let lastStatus;
let languageClient: LanguageClient;
const jdtEventEmitter = new EventEmitter<Uri>();
const cleanWorkspaceFileName = '.cleanWorkspace';
Expand Down Expand Up @@ -179,8 +180,9 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {

const item = window.createStatusBarItem(StatusBarAlignment.Right, Number.MIN_VALUE);
item.text = '$(sync~spin)';
item.command = Commands.OPEN_OUTPUT;
const progressBar = window.createStatusBarItem(StatusBarAlignment.Left, Number.MIN_VALUE + 1);
item.command = Commands.SHOW_SERVER_TASK_STATUS;

commands.executeCommand(Commands.SHOW_SERVER_TASK_STATUS);

let serverOptions;
const port = process.env['SERVER_PORT'];
Expand Down Expand Up @@ -213,8 +215,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
switch (report.type) {
case 'Started':
item.text = '$(thumbsup)';
p.report({ message: 'Finished' });
lastStatus = item.text;
commands.executeCommand('setContext', 'javaLSReady', true);
resolve({
apiVersion: '0.2',
Expand All @@ -225,8 +225,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
break;
case 'Error':
item.text = '$(thumbsdown)';
lastStatus = item.text;
p.report({ message: 'Finished with Error' });
toggleItem(window.activeTextEditor, item);
resolve({
apiVersion: '0.2',
Expand All @@ -236,22 +234,15 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
});
break;
case 'Starting':
p.report({ message: report.message });
break;
case 'Message':
item.text = report.message;
setTimeout(() => { item.text = lastStatus; }, 3000);
// message goes to progress report instead
break;
}
item.tooltip = report.message;
toggleItem(window.activeTextEditor, item);
});
languageClient.onNotification(ProgressReportNotification.type, (progress) => {
progressBar.show();
progressBar.text = progress.status;
if (progress.complete) {
setTimeout(() => { progressBar.hide(); }, 500);
}
serverTasks.updateServerTask(progress);
});
languageClient.onNotification(ActionableNotification.type, (notification) => {
let show = null;
Expand Down Expand Up @@ -437,6 +428,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {

context.subscriptions.push(commands.registerCommand(Commands.CLEAN_WORKSPACE, () => cleanWorkspace(workspacePath)));

context.subscriptions.push(commands.registerCommand(Commands.SHOW_SERVER_TASK_STATUS, () => serverTaskPresenter.presentServerTaskView()));

context.subscriptions.push(onConfigurationChange(languageClient, context));
toggleItem(window.activeTextEditor, item);
});
Expand Down
Loading