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

Allow users to customize the InitializeParams object for the "initialize" method #311

Merged
merged 3 commits into from
May 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.intellij.openapi.diagnostic.Logger;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.lsp4j.InitializeParams;
import org.wso2.lsp4intellij.client.connection.StreamConnectionProvider;

import java.io.IOException;
Expand Down Expand Up @@ -77,6 +78,15 @@ public void stop(String workingDir) {
public Object getInitializationOptions(URI uri) {
return null;
}

/**
* Use this method to modify the {@link InitializeParams} that was initialized by this library.
* The values assigned to the passed {@link InitializeParams} after this method ends will be the
* ones sent to the LSP server.
* @param params the parameters with some prefilled values.
*/
public void customizeInitializeParams(InitializeParams params) {
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ private InitializeParams getInitParams() {
new ClientCapabilities(workspaceClientCapabilities, textDocumentClientCapabilities, null));
initParams.setInitializationOptions(
serverDefinition.getInitializationOptions(URI.create(initParams.getRootUri())));
serverDefinition.customizeInitializeParams(initParams);

return initParams;
}
Expand Down