Oni: [Feature request] LSP: pass environment vars to the language server process

Created on 20 Jan 2018  路  2Comments  路  Source: onivim/oni

Expected outcome

Config entries like language.<language-identifier>.languageServer.env specify a group of additional environment variables for each language server when spawning its process.

Problems

pyls detects the env VIRTUAL_ENV to set up the completion scope/virtualenv. This is a crucial setting when pyls is installed in a different virtualenv to the project. I can start pyls by setting language.python.languageServer.command="/path/to/pyls_virtualenv/bin/pyls", but without setting VIRTUAL_ENV, the server by default supply completion in scope /path/to/pyls_virtualenv, not the one my project located.

bug daily-editor-blocker language-integration

Most helpful comment

It's possible to work around this using the env command:

{
  "language.python.languageServer.command": "/usr/bin/env",
  "language.python.languageServer.arguments": [
    "VIRTUAL_ENV=/Users/alex/.local/share/virtualenvs/backend-kydAUAQj", // <-- path here
    "/usr/local/bin/pyls"
  ]
}

All 2 comments

Thanks for the detailed issue, @Contextualist ! Having an option to override / pass down additional environment variables to the language server makes sense.

It's possible to work around this using the env command:

{
  "language.python.languageServer.command": "/usr/bin/env",
  "language.python.languageServer.arguments": [
    "VIRTUAL_ENV=/Users/alex/.local/share/virtualenvs/backend-kydAUAQj", // <-- path here
    "/usr/local/bin/pyls"
  ]
}
Was this page helpful?
0 / 5 - 0 ratings