How to specify correct python version for Python Language Server when using multi-root workspace
Does anyone know how to specify correct Python version when use newest VSCode Python extension(ms-python.python
) with multi-root workspace?
My global python environment is 2.7 and my VSCode project's directory structure is like below:
root
├ .vscode
│
├ childA(Python2.7)
│ ├ .venv(virtualenv directory created by Pipenv)
│ └ .vscode
│
└ childB(Python3.7)
│ ├ .venv(virtualenv directory created by Pipenv)
└ .vscode
I set pythonPath both child directory's .vscode/settings.json
file like below:
"python.pythonPath": ".venv/bin/python"
Recently I updated VSCode Python extension, after that, under ChildB directory, Python extension always displays error message like below:
[Python] invalid syntax, parameter annotations require 3.x [E16]
I use type annotation like below:
def add(p1: int, p2: int)
return p1 + p2
This error message is returned by Python Language Server that I found here:
https://github.com/Microsoft/python-language-server/blob/7be329643299111cc1f0839d20aa9eb146b0d381/src/Analysis/Engine/Impl/Parsing/Parser.cs#L2088
When I doesn't use multi-root workspace, this error is not displayed.
I think newest Python extension can't recognize correct Python version that I set in .vscode/settings.json
when I use multi-root workspace.
I want Python Language Server to recognize correct Python version in childB directory.
Any suggestions?
python visual-studio-code
add a comment |
Does anyone know how to specify correct Python version when use newest VSCode Python extension(ms-python.python
) with multi-root workspace?
My global python environment is 2.7 and my VSCode project's directory structure is like below:
root
├ .vscode
│
├ childA(Python2.7)
│ ├ .venv(virtualenv directory created by Pipenv)
│ └ .vscode
│
└ childB(Python3.7)
│ ├ .venv(virtualenv directory created by Pipenv)
└ .vscode
I set pythonPath both child directory's .vscode/settings.json
file like below:
"python.pythonPath": ".venv/bin/python"
Recently I updated VSCode Python extension, after that, under ChildB directory, Python extension always displays error message like below:
[Python] invalid syntax, parameter annotations require 3.x [E16]
I use type annotation like below:
def add(p1: int, p2: int)
return p1 + p2
This error message is returned by Python Language Server that I found here:
https://github.com/Microsoft/python-language-server/blob/7be329643299111cc1f0839d20aa9eb146b0d381/src/Analysis/Engine/Impl/Parsing/Parser.cs#L2088
When I doesn't use multi-root workspace, this error is not displayed.
I think newest Python extension can't recognize correct Python version that I set in .vscode/settings.json
when I use multi-root workspace.
I want Python Language Server to recognize correct Python version in childB directory.
Any suggestions?
python visual-studio-code
yes. it'spls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.
– Yang K
Nov 16 '18 at 4:03
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' orstring_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?
– Kenta Katsumata
Nov 16 '18 at 4:29
add a comment |
Does anyone know how to specify correct Python version when use newest VSCode Python extension(ms-python.python
) with multi-root workspace?
My global python environment is 2.7 and my VSCode project's directory structure is like below:
root
├ .vscode
│
├ childA(Python2.7)
│ ├ .venv(virtualenv directory created by Pipenv)
│ └ .vscode
│
└ childB(Python3.7)
│ ├ .venv(virtualenv directory created by Pipenv)
└ .vscode
I set pythonPath both child directory's .vscode/settings.json
file like below:
"python.pythonPath": ".venv/bin/python"
Recently I updated VSCode Python extension, after that, under ChildB directory, Python extension always displays error message like below:
[Python] invalid syntax, parameter annotations require 3.x [E16]
I use type annotation like below:
def add(p1: int, p2: int)
return p1 + p2
This error message is returned by Python Language Server that I found here:
https://github.com/Microsoft/python-language-server/blob/7be329643299111cc1f0839d20aa9eb146b0d381/src/Analysis/Engine/Impl/Parsing/Parser.cs#L2088
When I doesn't use multi-root workspace, this error is not displayed.
I think newest Python extension can't recognize correct Python version that I set in .vscode/settings.json
when I use multi-root workspace.
I want Python Language Server to recognize correct Python version in childB directory.
Any suggestions?
python visual-studio-code
Does anyone know how to specify correct Python version when use newest VSCode Python extension(ms-python.python
) with multi-root workspace?
My global python environment is 2.7 and my VSCode project's directory structure is like below:
root
├ .vscode
│
├ childA(Python2.7)
│ ├ .venv(virtualenv directory created by Pipenv)
│ └ .vscode
│
└ childB(Python3.7)
│ ├ .venv(virtualenv directory created by Pipenv)
└ .vscode
I set pythonPath both child directory's .vscode/settings.json
file like below:
"python.pythonPath": ".venv/bin/python"
Recently I updated VSCode Python extension, after that, under ChildB directory, Python extension always displays error message like below:
[Python] invalid syntax, parameter annotations require 3.x [E16]
I use type annotation like below:
def add(p1: int, p2: int)
return p1 + p2
This error message is returned by Python Language Server that I found here:
https://github.com/Microsoft/python-language-server/blob/7be329643299111cc1f0839d20aa9eb146b0d381/src/Analysis/Engine/Impl/Parsing/Parser.cs#L2088
When I doesn't use multi-root workspace, this error is not displayed.
I think newest Python extension can't recognize correct Python version that I set in .vscode/settings.json
when I use multi-root workspace.
I want Python Language Server to recognize correct Python version in childB directory.
Any suggestions?
python visual-studio-code
python visual-studio-code
asked Nov 16 '18 at 3:12
Kenta KatsumataKenta Katsumata
61
61
yes. it'spls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.
– Yang K
Nov 16 '18 at 4:03
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' orstring_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?
– Kenta Katsumata
Nov 16 '18 at 4:29
add a comment |
yes. it'spls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.
– Yang K
Nov 16 '18 at 4:03
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' orstring_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?
– Kenta Katsumata
Nov 16 '18 at 4:29
yes. it's
pls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.– Yang K
Nov 16 '18 at 4:03
yes. it's
pls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.– Yang K
Nov 16 '18 at 4:03
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' or
string_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?– Kenta Katsumata
Nov 16 '18 at 4:29
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' or
string_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?– Kenta Katsumata
Nov 16 '18 at 4:29
add a comment |
1 Answer
1
active
oldest
votes
Settings for a multi-root workspace are not specified in a vscode/settings.json
file but in your .vscode-workspace
file.
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330894%2fhow-to-specify-correct-python-version-for-python-language-server-when-using-mult%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Settings for a multi-root workspace are not specified in a vscode/settings.json
file but in your .vscode-workspace
file.
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
add a comment |
Settings for a multi-root workspace are not specified in a vscode/settings.json
file but in your .vscode-workspace
file.
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
add a comment |
Settings for a multi-root workspace are not specified in a vscode/settings.json
file but in your .vscode-workspace
file.
Settings for a multi-root workspace are not specified in a vscode/settings.json
file but in your .vscode-workspace
file.
answered Nov 19 '18 at 20:34
Brett CannonBrett Cannon
1,7261129
1,7261129
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
add a comment |
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Thank you for your reply. But unfortunately it seems that VSCode intellicode plugin and Language Server doesn't recognize multi-root workspace at this time. github.com/Microsoft/vscode-extension-samples/tree/master/…
– Kenta Katsumata
Nov 21 '18 at 0:59
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
Correct, use Jedi in that case until support has been added: github.com/Microsoft/vscode-python/issues/3017 .
– Brett Cannon
Nov 21 '18 at 20:46
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
I see. Thanks a lot.
– Kenta Katsumata
Nov 22 '18 at 1:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330894%2fhow-to-specify-correct-python-version-for-python-language-server-when-using-mult%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
yes. it's
pls.childB_dir = ".vscode/settings.json"; pls.childB_dir.string_parse_multi_root()
. hope that helps.– Yang K
Nov 16 '18 at 4:03
@YangK Thank you for your reply. But I am confused. Is this a VSCode setting? I can' find 'pls' or
string_parse_multi_root
settings. Or, if this is a Python code, Where do I have to put this code?– Kenta Katsumata
Nov 16 '18 at 4:29