Added JDT command for getting Java project

Also added a JDT Project cache in the Spring Boot LS
This commit is contained in:
nsingh
2018-03-09 12:05:31 -08:00
parent a305e2ce53
commit 591adec33d
13 changed files with 527 additions and 59 deletions

View File

@@ -15,7 +15,8 @@ import {HighlightService, HighlightParams} from './highlight-service';
import { log } from 'util';
import { tmpdir } from 'os';
import { JVM, findJvm, findJdk } from '@pivotal-tools/jvm-launch-utils';
import { registerClasspathService } from './classpath';
import { registerClasspathService } from './classpath-service';
import { registerProjectService } from './project-service';
let p2c = P2C.createConverter();
@@ -215,6 +216,7 @@ function setupLanguageClient(context: VSCode.ExtensionContext, createServer: Ser
}
return { applied: true};
});
registerProjectService(client);
registerClasspathService(client);
return client;
});

View File

@@ -0,0 +1,22 @@
'use strict';
import * as VSCode from 'vscode';
import { LanguageClient, RequestType } from 'vscode-languageclient';
export function registerProjectService(client : LanguageClient) : void {
let projectRequest = new RequestType<string, ProjectResponse, void, void>("sts/project");
client.onRequest(projectRequest, async (uri: string) => {
return await executeProjectCommand(uri);
});
}
async function executeProjectCommand(resourceUri : string) : Promise<ProjectResponse> {
return <ProjectResponse> (await VSCode.commands.executeCommand("java.execute.workspaceCommand", "sts.java.resolveProject", resourceUri));
}
interface ProjectResponse {
name: string,
uri : string
}