From b1accc8a4d8dbc965ae6ce3b0de8b1cebdd35ef3 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 1 Dec 2020 16:51:09 +0800 Subject: [PATCH 1/6] docs: readme wording tweaks Signed-off-by: Jack Cherng --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 871c528..4298d6e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # LSP-pyright -Python support for Sublime's LSP plugin provided through [microsoft/pyright](https://github.com/microsoft/pyright). +Python support for Sublime's LSP plugin provided through [microsoft/pyright](https://github.com/microsoft/pyright). ## Installation 1. Install [LSP](https://packagecontrol.io/packages/LSP) and [LSP-pyright](https://packagecontrol.io/packages/LSP-pyright) via Package Control. -1. Restart Sublime. -1. Configure pyright for your virtualenv. +2. Restart Sublime. +3. (Optional) Configure pyright for your `virtualenv`. ## Configuration @@ -20,9 +20,10 @@ Project specific settings can also be set for LSP-pyright (and all LSP plugins): - From the command palette `Project: Edit Project` -Your project will also require a `pyrightconfig.json` file, usually in the project root. +You may add a `pyrightconfig.json` file to your project root. -At a minimum, the file should define where your Python virtualenvs are located and the name of the one to use for your project: +At a minimum, the file should define where your Python `virtualenvs` are located +and the name of the one to use for your project: ```json { @@ -30,4 +31,5 @@ At a minimum, the file should define where your Python virtualenvs are located a "venv": "env" } ``` + Please see the [Pyright Docs](https://github.com/microsoft/pyright/blob/master/docs/configuration.md) for more options. From b9de1159b036534b2579d8ff1df708e2d74fa5c4 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 1 Dec 2020 16:53:47 +0800 Subject: [PATCH 2/6] docs: nits Signed-off-by: Jack Cherng --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4298d6e..d4d4b1d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Project specific settings can also be set for LSP-pyright (and all LSP plugins): - From the command palette `Project: Edit Project` You may add a `pyrightconfig.json` file to your project root. - At a minimum, the file should define where your Python `virtualenvs` are located and the name of the one to use for your project: From 9c213c0b7f986189b34934cbde36631b27225096 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 1 Dec 2020 17:25:16 +0800 Subject: [PATCH 3/6] docs: revert changes about virtualenv Signed-off-by: Jack Cherng --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d4d4b1d..ad5f857 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Project specific settings can also be set for LSP-pyright (and all LSP plugins): - From the command palette `Project: Edit Project` -You may add a `pyrightconfig.json` file to your project root. -At a minimum, the file should define where your Python `virtualenvs` are located -and the name of the one to use for your project: +Your project will also require a `pyrightconfig.json` file, usually in the project root. + +At a minimum, the file should define where your Python virtualenvs are located and the name of the one to use for your project: ```json { From 4dc0c6922568d0f2581ff997b2de6bc85ea87f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Tue, 1 Dec 2020 10:50:09 +0100 Subject: [PATCH 4/6] Update readme --- README.md | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ad5f857..331df0d 100644 --- a/README.md +++ b/README.md @@ -11,24 +11,47 @@ Python support for Sublime's LSP plugin provided through [microsoft/pyright](htt ## Configuration -There are some ways to configure the package and the language server. +> **TIP**: It's recommended to additionally install the `LSP-json` package which provides validation and auto-complete for +`LSP-pyright` settings and the `pyrightconfig.json` configuration file. + +Here are some ways to configure the package and the language server. - From `Preferences > Package Settings > LSP > Servers > LSP-pyright` - From the command palette `Preferences: LSP-pyright Settings` +- Project-specific configuration. From the command palette run `Project: Edit Project` +and add your settings in: -Project specific settings can also be set for LSP-pyright (and all LSP plugins): +```js +{ + "settings": { + "LSP": { + "LSP-pyright": { + "settings": { + // Put your settings here + } + } + } + } +} +``` +- Through a `pyrightconfig.json` configuration file (check [settings documentation](https://github.com/microsoft/pyright/blob/master/docs/configuration.md)) -- From the command palette `Project: Edit Project` +### Virtual environments -Your project will also require a `pyrightconfig.json` file, usually in the project root. +If your project needs to run and be validated within an virtual environment, the `pyrightconfig.json` file needs to be +present at the root of your project. -At a minimum, the file should define where your Python virtualenvs are located and the name of the one to use for your project: +The configuration file, at a minimum, should define where your Python virtualenvs are located and the name of the one to +use for your project: ```json { "venvPath": "/path/to/virtualenvs/", - "venv": "env" + "venv": "myenv" } ``` -Please see the [Pyright Docs](https://github.com/microsoft/pyright/blob/master/docs/configuration.md) for more options. +The `venv` option is only supported in the `pyrightconfig.json` file. The `venvPath` can be moved to other places like +project-specific configuration, in case you don't want to hard-code system-specific path in a shared project. + +Please see [Pyright Documentation](https://github.com/microsoft/pyright/blob/master/docs/configuration.md) for more options. From d3a4a27f78816204e821721bd2c683c00712d07d Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 1 Dec 2020 18:57:18 +0800 Subject: [PATCH 5/6] docs: some boring tweaks Signed-off-by: Jack Cherng --- README.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 331df0d..75127cc 100644 --- a/README.md +++ b/README.md @@ -18,28 +18,29 @@ Here are some ways to configure the package and the language server. - From `Preferences > Package Settings > LSP > Servers > LSP-pyright` - From the command palette `Preferences: LSP-pyright Settings` -- Project-specific configuration. From the command palette run `Project: Edit Project` -and add your settings in: +- Project-specific configuration. + From the command palette run `Project: Edit Project` and add your settings in: + + ```js + { + "settings": { + "LSP": { + "LSP-pyright": { + "settings": { + // Put your settings here + } + } + } + } + } + ``` -```js -{ - "settings": { - "LSP": { - "LSP-pyright": { - "settings": { - // Put your settings here - } - } - } - } -} -``` - Through a `pyrightconfig.json` configuration file (check [settings documentation](https://github.com/microsoft/pyright/blob/master/docs/configuration.md)) ### Virtual environments -If your project needs to run and be validated within an virtual environment, the `pyrightconfig.json` file needs to be -present at the root of your project. +If your project needs to run and be validated within a virtual environment, the `pyrightconfig.json` file needs to be +presented at the root of your project. The configuration file, at a minimum, should define where your Python virtualenvs are located and the name of the one to use for your project: From 6746303aee022f99396943e5c8bdc55f6260f3d6 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Tue, 1 Dec 2020 19:04:44 +0800 Subject: [PATCH 6/6] docs: fixup Signed-off-by: Jack Cherng --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75127cc..33cb55c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Here are some ways to configure the package and the language server. ### Virtual environments If your project needs to run and be validated within a virtual environment, the `pyrightconfig.json` file needs to be -presented at the root of your project. +present at the root of your project. The configuration file, at a minimum, should define where your Python virtualenvs are located and the name of the one to use for your project: