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

Conversation

payne911
Copy link
Contributor

Purpose

There was no way for users to provide their own values for this object. Now they can by simply overriding this new method.
Feel free to modify this PR directly before merging.

Goals

Increase flexibility.

Approach

Usage is as follow:

class MyServerDefinition(ext: String, command: Array<String>) :
    RawCommandServerDefinition(ext, command) {

  override fun customizeInitializeParams(params: InitializeParams) {
    val applicationInfo: ApplicationInfo? =
        ApplicationManager.getApplication().getService(ApplicationInfo::class.java)
    val ideVersion: String? = applicationInfo?.fullVersion
    val ideName = ApplicationNamesInfo.getInstance().fullProductName
    params.clientInfo = ClientInfo(ideName, ideVersion)
  }
}

Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

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

This approach looks good!

IMO we can deprecate the getInitializationOptions () API along with the new one, as the users will now have the full control over the initialize params (so they can directly modify initialization options, if they want to). I'll send those changes in a separate PR, after merging this

@NipunaRanasinghe NipunaRanasinghe merged commit a5679cf into ballerina-platform:master May 13, 2023
dongwa added a commit to dongwa/lsp4intellij that referenced this pull request May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants