OmniSharp/csharp-language-server-protocol

Use of WithInitializationOptions() in LSP Client

SebastianBolte opened this issue · 3 comments

Hi,

I'm using OmniSharp LSP Client to communicate with the jedi-language-server. I need to auto import a module and there is an initializationOption for this in the jedi-language-server. The parameter I have to give WithInitializationOptions() is from type object and I can't find an example how to use this function. What I have tried is this

`
List extraPathsList = new List() {

           @"path/to/the/module/I/want/to/autoImport",
        };

        Dictionary<string, object> extraPaths = new Dictionary<string, object>
        {
            { "extraPaths", extraPathsList }
        };

        List<string> autoImportModulesList = new List<string>() {
           "theModuleIWantToAutoImport",
        };

        Dictionary<string, object> autoImportModules = new Dictionary<string, object>
        {
            { "autoImportModules", autoImportModulesList }
        };

        Dictionary<string, object> initializationOptions = new Dictionary<string, object>
        {
            { "jediSettings", autoImportModules },
            { "workspace", extraPaths},
        };

`

but this doesn't work. Can you please give me an example how to create the parameter for WithInitializationOption()?

We use it in our tests over here, perhaps that helps?

What language server are you using? Is there only one initialization option? For the jedi language server this is a nested json structure with key value pairs. But probably the autoImportModule just doesn't do what I thought it did. For the ignorePatterns it works in the way as described above with the dictionaries. My hope was that I would get completions without having to import the module when I set autoImportModule.

I'm using the one that's written in that repository...PowerShell Editor Services is a language server written on top of this OmniSharp project. Right now it has two initialization options.