OmniSharp / OmniSharp/csharp-language-server-protocol

Use of WithInitializationOptions() in LSP Client

Open
#873 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
638
Forks
109
Avg merge
1m
Merged PRs (30d)
2

Description

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()?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WithInitializationOptions() entry point and the issue's nested initializationOptions example, then compare its expected shape with the jedi-language-server initialization options. Done means documenting a working C# parameter example for the requested extraPaths and autoImportModules settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.