Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions x-pack/plugins/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export const code = (kibana: any) =>
verbose: Joi.boolean().default(false),
}).default(),
repos: Joi.array().default([]),
java: Joi.object({
enableMavenImport: Joi.boolean().default(true),
enableGradleImport: Joi.boolean().default(true),
autoBuild: Joi.boolean().default(false),
}).default(),
maxWorkspace: Joi.number().default(5), // max workspace folder for each language server
disableScheduler: Joi.boolean().default(true), // Temp option to disable all schedulers.
enableGlobalReference: Joi.boolean().default(false), // Global reference as optional feature for now
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/code/server/lsp/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export class LanguageServerProxy implements ILanguageServerHandler {
}
public async initialize(
clientCapabilities: ClientCapabilities,
workspaceFolders: [WorkspaceFolder]
workspaceFolders: [WorkspaceFolder],
initOptions: any
): Promise<InitializeResult> {
const clientConn = await this.connect();
const rootUri = workspaceFolders[0].uri;
Expand All @@ -109,6 +110,7 @@ export class LanguageServerProxy implements ILanguageServerHandler {
workspaceFolders,
rootUri,
capabilities: clientCapabilities,
initializationOptions: initOptions,
};
return await clientConn.sendRequest('initialize', params).then(r => {
this.logger.info(`initialized at ${rootUri}`);
Expand Down
20 changes: 15 additions & 5 deletions x-pack/plugins/code/server/lsp/request_expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,22 @@ export class RequestExpander implements ILanguageServerHandler {
}

private async sendInitRequest(workspacePath: string) {
return await this.proxy.initialize({}, [
return await this.proxy.initialize(
{},
[
{
name: workspacePath,
uri: `file://${workspacePath}`,
},
],
{
name: workspacePath,
uri: `file://${workspacePath}`,
},
]);
settings: {
'java.import.gradle.enabled': this.serverOptions.java.enableGradleImport,
'java.import.maven.enabled': this.serverOptions.java.enableMavenImport,
'java.autobuild.enabled': this.serverOptions.java.autoBuild,
},
}
);
}

private handle() {
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/code/server/server_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export interface LspOptions {
detach: boolean;
verbose: boolean;
}

export interface JavaOptions {
enableMavenImport: boolean;
enableGradleImport: boolean;
autoBuild: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need have this, just always make it false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

export class ServerOptions {
public readonly workspacePath = resolve(this.config.get('path.data'), 'code/workspace');

Expand Down Expand Up @@ -39,6 +46,8 @@ export class ServerOptions {

public readonly lsp: LspOptions = this.options.lsp;

public readonly java: JavaOptions = this.options.java;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to security

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. java -> codeSecurity


public readonly repoConfigs: RepoConfigs = (this.options.repos as RepoConfig[]).reduce(
(previous, current) => {
previous[current.repo] = current;
Expand Down