Skip to content

How to to use multiple workspacefolders? #653

@zerocewl

Description

@zerocewl

I'm trying to enable auto completion in the monaco editor from different custom python folders using python-lsp-server. For a single folder this works fine using the workspaceFolder setting from the clientConfig as suggested in the python example config. So for my requirements i tried to use workspaceFolders, but i can not manage to set more folders, i think i'm missing something on the client side.

In the languageClientConfig startOptions i used workspace/didChangeWorkspaceFolders which seems to work with python-lsp-server.

On the client side is no setting for workspaceFolders so i tried to implement a custom workspaceProvider together with a custom workspace file, but this setting seem not to be used at all.

e.g.

  const userConfig: UserConfig = {
    languageClientConfig: {
      options: {
        name: 'Python Language Server',
        $type: 'WebSocket',
        host: 'localhost',
        port: 9002,
        path: 'python',
        startOptions: {
          onCall: (languageClient?: MonacoLanguageClient) => {
            languageClient?.sendRequest(
              'workspace/didChangeConfiguration',
              pluginConfig
            );
            languageClient?.sendRequest('workspace/didChangeWorkspaceFolders', {
              event: {
                added: [
                  {
                    name: 'workspace',
                    uri: URI.file(customUrl).toString(),
                  },
                ],
                removed: [
                ],
              },
            });
          },
          reportStatus: true,
        },
      },
      clientOptions: {
...
    },
    wrapperConfig: {
      serviceConfig: {
        userServices: {
          ...getConfigurationServiceOverride(),
        },
        debugLogging: true,
        workspaceConfig: {
          workspaceProvider: {
            trusted: true,
            workspace: {
              label: 'workspace',
              workspaceUri: monaco.Uri.file(customUrl ?? ''),
            },
            async open() {
              return true;
            },
          },
        },
      },
 ...

Can you suggest what i'm missing here?
Is there any working example how to use multiple workspaceFolders?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions