message: feat(client): enable with coc-python
  close
  fix
diff: -import { commands, ExtensionContext, extensions, LanguageClient, LanguageClientOptions, ServerOptions, services, TransportKind, workspace } from 'coc.nvim';
  +import { commands, ExtensionContext, LanguageClient, LanguageClientOptions, ServerOptions, services, TransportKind, workspace } from 'coc.nvim';
  import { TextEdit, WorkspaceEdit } from 'vscode-languageserver-protocol';
  import { ProgressReporting } from './progress';
  export async function activate(context: ExtensionContext): Promise<void> {
  - const state = extensions.getExtensionState('coc-python');
  - if (state.toString() === 'activated') {
  - workspace.showMessage(`coc-python is installed and activated, coc-pyright will be disabled`, 'warning');
  - return;
  - }
  -
  const serverModule = context.asAbsolutePath('server/server.bundle.js');
  const debugOptions = { execArgv: ['--nolazy', '--inspect=6600'] };
  const serverOptions: ServerOptions = {
  run: { module: serverModule, transport: TransportKind.ipc },
  - debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
  + debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions },
  };
  const outputChannel = workspace.createOutputChannel('Pyright');
  const clientOptions: LanguageClientOptions = {
  documentSelector: [{ scheme: 'file', language: 'python' }],
  synchronize: {
  - configurationSection: ['python', 'pyright']
  + configurationSection: ['python', 'pyright'],
  },
  - outputChannel
  + outputChannel,
  };
  const client: LanguageClient = new LanguageClient('pyright', 'Pyright Server', serverOptions, clientOptions);
  @@ -39,7 +33,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
  const doc = await workspace.document;
  const cmd = {
  command: commandName,
  - arguments: [doc.uri.toString(), offset]
  + arguments: [doc.uri.toString(), offset],
  };
  const edits = await client.sendRequest<TextEdit[] | undefined>('workspace/executeCommand', cmd);
  @@ -49,8 +43,8 @@ export async function activate(context: ExtensionContext): Promise<void> {
  const wsEdit: WorkspaceEdit = {
  changes: {
  - [doc.uri]: edits
  - }
  + [doc.uri]: edits,
  + },
  };
  await workspace.applyEdit(wsEdit);
  })
  @@ -70,7 +64,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
  const cmd = {
  command,
  - arguments: [root, module]
  + arguments: [root, module],
  };
  client.sendRequest('workspace/executeCommand', cmd);
  })
  