# Issue with ms python language server and kak-lsp

**URL:** <https://discuss.kakoune.com/t/issue-with-ms-python-language-server-and-kak-lsp/1234>\
**Category:** Help\
**Tags:** language, lsp\
**Created:** [August 26, 2020, 7:48pm UTC](https://discuss.kakoune.com/t/issue-with-ms-python-language-server-and-kak-lsp/1234 "2020-08-26T19:48:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skewballfox](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/skewballfox/32/455_2.png) [@skewballfox](https://discuss.kakoune.com/u/skewballfox)\
**Post date:** [August 26, 2020, 7:48pm UTC](https://discuss.kakoune.com/t/issue-with-ms-python-language-server-and-kak-lsp/1234/1 "2020-08-26T19:48:56Z")

</div>

I would open an issue with kak-lsp or the language server but I’m having trouble figuring out what the issue even is.

I’m trying to switch from palantir’s python language server to microsoft’s after multiple issues with it crashing after updates and issues configuring 3rd party plugins (mypy and black) even with it working.

I changed the python section in `kak-lsp` to `command="Microsoft.Python.LanguageServer"`(which is currently symlinked to my local bin) instead of 'command=pyls`. I can launch it from the command line so at the very least I know it’s not crashing.

after realizing there was an issue when testing a few python files and not getting any notifications from the language server and enabled debug logging.

```auto
9468 | Aug 26 14:30:30.352 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_PYTHON, module: kak_lsp::project_root:46
9469 │ Aug 26 14:30:30.352 DEBG Routing editor request to Route { session: "55079", language: "python", root: "/home/daedalus/Workspace/Writing/journaling_tools" }, module: kak_lsp::session:
       │ 95
9470 │ Aug 26 14:30:30.352 DEBG Spawning a new controller for Route { session: "55079", language: "python", root: "/home/daedalus/Workspace/Writing/journaling_tools" }, module: kak_lsp::sess
       │ ion:117
9471 │ Aug 26 14:30:30.353 INFO Starting Language server `pyls `, module: kak_lsp::language_server_transport:21
9472 │ Aug 26 14:30:30.353 ERRO panic: panicked at 'Failed to start language server: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/language_server_transport.rs:2
       │ 2:21, module: kak_lsp:252
9473 │ Aug 26 14:30:32.199 DEBG From editor:
9474 │ session = "55079"
9475 │ client = ""
9476 │ buffile = ""
9477 │ filetype = ""
9478 │ version = 0
9479 │ method = "stop"

```

the issue seems to be it’s trying to default to `pyls` despite the toml being updated, and I used ripgrep to search for mentions of `pyls` starting in the kakrc directory through the plugins, and the only mention left in the lsp was in a comment inside `position.rs` so I’m not sure why it is trying to run that as the command.

---

<div class="post-metadata">

**Author:** ![bravekarma](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@bravekarma](https://discuss.kakoune.com/u/bravekarma)\
**Post date:** [August 26, 2020, 8:36pm UTC](https://discuss.kakoune.com/t/issue-with-ms-python-language-server-and-kak-lsp/1234/2 "2020-08-26T20:36:09Z")

</div>

If it is still looking for `pyls`, sounds like there is an issue with `kak-lsp.toml` that you changed. I believe it is supposed to be in `~/.config/kak-lsp/kak-lsp.toml`, is that where you changed the `command` for `[language.python]` entry? You can also follow the troubleshooting steps [here](https://github.com/ul/kak-lsp#troubleshooting) and see if you see anything different.

Not related to the issue you ran into, but I had to add certain initialization options to get it to work. I have [my changes here](https://github.com/caksoylar/dotfiles/commit/3457b0d585bef9aee087e974b591da0da3299d21) that I made when experimenting. Specifically, I believe you at least need the [`lsp_server_initialization_options` here](https://github.com/caksoylar/dotfiles/blob/3457b0d585bef9aee087e974b591da0da3299d21/kak/kakrc#L56-L58). FYI after that I still wasn’t sure if I got it to work correctly since it was returning fewer diagnostics than I expected and I wasn’t sure I got it to start properly every time, so I went back to `pyls`.

---

<div class="post-metadata">

**Author:** ![skewballfox](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/skewballfox/32/455_2.png) [@skewballfox](https://discuss.kakoune.com/u/skewballfox)\
**Post date:** [August 26, 2020, 9:10pm UTC](https://discuss.kakoune.com/t/issue-with-ms-python-language-server-and-kak-lsp/1234/3 "2020-08-26T21:10:38Z")

</div>

ahh. I made the config directory and copied the toml file from the plugin home to `~/.config/kak-lsp/` and now it’s reading the changes.

the new issue is `kak-lsp: python language server error: 'Object reference not set to an instance of an object.'` but that is kind of expected.

apparently users of the emacs `lsp-ui` plugin had to make some [changes](https://vxlabs.com/2018/11/19/configuring-emacs-lsp-mode-and-microsofts-visual-studio-code-python-language-server/#required-change-to-lsp-ui-docel) when migrating from palantir’s language server, so I figured it wouldn’t work out of the box.

Thanks btw, I didn’t realize kak-lsp was supposed to have it’s own config directory.

Edit: I didn’t realize you had already got this working, I just looked at the dotfiles. lol sorry about that, I probably need to get some food.
