How to specify correct python version for Python Language Server when using multi-root workspace












1















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?










share|improve this question























  • 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


















1















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?










share|improve this question























  • 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
















1












1








1








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 3:12









Kenta KatsumataKenta Katsumata

61




61













  • 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





















  • 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



















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














1 Answer
1






active

oldest

votes


















0














Settings for a multi-root workspace are not specified in a vscode/settings.json file but in your .vscode-workspace file.






share|improve this answer
























  • 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











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
});


}
});














draft saved

draft discarded


















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









0














Settings for a multi-root workspace are not specified in a vscode/settings.json file but in your .vscode-workspace file.






share|improve this answer
























  • 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
















0














Settings for a multi-root workspace are not specified in a vscode/settings.json file but in your .vscode-workspace file.






share|improve this answer
























  • 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














0












0








0







Settings for a multi-root workspace are not specified in a vscode/settings.json file but in your .vscode-workspace file.






share|improve this answer













Settings for a multi-root workspace are not specified in a vscode/settings.json file but in your .vscode-workspace file.







share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini