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

InitializationOptions.settings is incorrectly documented as an array #3243

Open
liblit-at-amazon opened this issue Aug 16, 2024 · 0 comments

Comments

@liblit-at-amazon
Copy link

The Initialize Request section of the "Running the JAVA LS server from the command line" wiki page describes the InitializationOptions.settings property as an array of JavaConfigurationSettings:

interface InitializationOptions {
        ...
        /**
         * Java LS configuration settings
         */
        settings?: JavaConfigurationSettings[];
}

However, an example given later in that section shows settings as a single JavaConfigurationSettings instance, not an array of multiple JavaConfigurationSettings instances:

InitializeParams: {
    ...
    "initializationOptions": {
        ...
        "settings": {
            "java": {
                ...
            }
        }
    },
    ...
}

In practice, I find that when I pass settings as an array of one JavaConfigurationSettings instance, its value is ignored. Conversely, if I pass settings directly as a single JavaConfigurationSettings instance, its value is used.

This line of code from the server's implementation also suggests that settings is expected to be a dictionary, not an array:

if (initializationOptions.get(SETTINGS_KEY) instanceof Map<?, ?> settings) {

Therefore, I believe that the documentation's declaration of interface InitializationOptions is incorrect. The value of the InitializationOptions.settings property should be a single JavaConfigurationSettings instance, not an array of JavaConfigurationSettings instances, as in:

interface InitializationOptions {
        ...
        /**
         * Java LS configuration settings
         */
        settings?: JavaConfigurationSettings;
}
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

No branches or pull requests

1 participant