natebosch/vim-lsc

Question: Is there known way(s) to make Microsoft's python language server solutions work with vim-lsc?

JoeHFB opened this issue ยท 0 comments

Hello!

First off, thanks for all the hard work you guys do for this plugin.

Question

Is there known way(s) to make Microsoft's python language server solutions (microsoft python language server, pyright) work with vim-lsc?

Note: the full sample python file I played around with is on the bottom of this page

Why I'd like to see if it's possible to get them to work

I managed to get pyls and jedi-language-server to work, but:

  • pyls is sometimes so slow that it constantly locks up my vim when I type

Here I try to type pd. to get the various pandas functions autocomplete - note that my vim didn't even register the . - it just got stuck after pd
image

When it eventually does work, it shows the function signature, docs, etc, but it's just so slow ๐Ÿ˜ž

Here jedi-language-server - I did the exact same thing pd. and popped the autocomplete options pretty quickly. The first time took a bit, but the second time and after were almost instantaneous. Though... no documentation ๐Ÿ˜ž
image

What happened when I tried Microsoft's servers

1. pyright

  1. npm install -g pyright
  2. In my vimrc
    image
  3. ๐Ÿ˜ž
    image
  4. This error happens when I just move around

2. Micrsoft python language server

  1. I read this #163 issue, noticed that it was a year ago and the Microsoft issue he referenced was closed now
  2. And then I noticed that folks over at vim-lsp got this server to work
    https://github.com/mattn/vim-lsp-settings/blob/master/settings/pyls-ms.vim
  3. I cloned the server git repo, followed the build functions except I ran dotnet publish -c Release
    https://github.com/microsoft/python-language-server/blob/master/CONTRIBUTING.md#setup
  4. Still got the same error ๐Ÿ˜ž
    image
  5. Changed my vim-lsc section for python to do this based on the block in https://github.com/mattn/vim-lsp-settings/blob/master/settings/pyls-ms.vim#L7
let g:lsc_server_commands = {
  \ 'python' :{
  \     'command' :'pyright-langserver --stdio',
  \     'suppress_stderr' : v:true,
  \     'log_level' : -1,
    \   'message_hooks': {
        \     'initialize': {
        \       'initializationOptions': {
                \   'analysisUpdates': v:true,
                \   'asyncStartup': v:true,
                \   'displayOptions': {},
                \   'interpreter': {
                \      'properties': {
                \        'InterpreterPath': '/usr/bin/python3',
                \        'UseDefaultDatabase': v:true,
                \        'Version': 'Python 3.8.5',
                \      },
                \    },
                \}
        \    }
        \  },
  \  },
  1. Still go the same error ๐Ÿ˜ž

Simple python file that caused issues for me

from pandas import DataFrame, read_csv
import pandas as pd
import sys

print('Python version ' + sys.version)
print('Pandas version ' + pd.__version__)

test_csv_location = 'test.csv'
chunk_size = 10

for chunk in pd.read_csv(test_csv_location, chunksize=chunk_size):
    print(chunk)
    df = chunk.groupby('id')['value'].agg(size= len,list= lambda x: list(x))
    print(df)