Skip to content

Commit 8400efd

Browse files
authored
Add new Pylance setting (#7627)
* Add new Pylance setting * Add AI Code Actions * Update docs/python/settings-reference.md * Update docs/python/settings-reference.md
1 parent 2eec66c commit 8400efd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/python/settings-reference.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The language server settings apply when `python.languageServer` is `Pylance` or
5353
| Setting<br/>(python.analysis.) | Default | Description |
5454
| --- | --- | --- |
5555
| typeCheckingMode | off | Specifies the level of type checking analysis to perform. <br> Available values are `off`, `basic`, and `strict`. <br> When set to `off` no type checking analysis is conducted; unresolved imports/variables diagnostics are produced. <br> When set to `basic` non-type checking-related rules (all rules in `off`), as well as basic type checking rules are used. <br> When set to `strict` all type checking rules at the highest severity of error (including all rules in `off` and `basic` categories) are used. |
56+
| languageServerMode | default | Offers predefined configurations to optimize Pylance's performance based on the development needs. <br> Available values are `default` and `light`. <br> When set to `default`, the language server delivers sufficient functionality for most machines without overloading the system. <br> When set to `light`, it enables a lightweight, memory-efficient setup. This mode disables various features to make Pylance function more like a streamlined text editor, and it's ideal for those who do not require the full breadth of IntelliSense capabilities and prefer Pylance to be as resource-friendly as possible. <br> Default setting values are overriden to the following by each mode: <table> <tr> <th>Setting</th> <th>`light` mode</th> <th> `default` mode </th> </tr> <tr> <td>python.analysis.exclude</td> <td> ["**"] </td> <td> [] </td> <tr> <td>python.analysis.useLibraryCodeForTypes</td> <td>false</td> <td>true</td> <tr> <td> python.analysis.enablePytestSupport </td> <td>false</td> <td>true </td> <tr> <td> python.analysis.indexing </td> <td>false</td> <td>true </td></tr> </table> |
5657
| diagnosticMode | openFilesOnly | Specifies what code files the language server analyzes for problems. <br> Available values are `workspace` and `openFilesOnly`. |
5758
| include | [] | Paths of directories or files that should be included in analysis. <br> If no paths are specified, Pylance defaults to the directory that contains the workspace root. <br> Paths may contain wildcard characters such as `**` (a directory or multiple levels of directories), `*` (a sequence of zero or more characters), or `?` (a single character). |
5859
| exclude | [] | Paths of directories or files that should not be included in analysis. <br> These override the directories listed under the `python.analysis.include` setting, allowing specific subdirectories to be excluded. <br> Note that files listed in this `exclude` setting may still be included in the analysis if they are referenced/imported by source files that are not in the excluded list. <br> Paths may contain wildcard characters such as `**` (a directory or multiple levels of directories), `*` (a sequence of zero or more characters), or `?` (a single character). <br> If no exclude paths are specified, Pylance automatically excludes the following: `**/node_modules`, `**/\_\_pycache\_\_`, `.git` and any virtual environment directories. |
@@ -67,7 +68,8 @@ The language server settings apply when `python.languageServer` is `Pylance` or
6768
| completeFunctionParens | false | Adds parentheses to function completions. Accepted values are `true` and `false`. |
6869
| useLibraryCodeForTypes | true | Parses the source code for a package when a type stub is not found. Available values are `true` and `false`. |
6970
| autoImportCompletions | false | Controls the offering of auto imports in completions. Available values are `true` and `false`. |
70-
| importFormat | `absolute`| Defines the default format when auto importing modules. Accepted values are `absolute` or `relative`. |
71+
| importFormat | absolute | Defines the default format when auto importing modules. Accepted values are `absolute` or `relative`. |
72+
| aiCodeActions | true | Whether to enable specific AI-assisted code actions. Requires the [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extension to be enabled. <br> Accepted value is an object with a code action as key and a boolean as value. <br> Available code actions to use as keys: <ul> <li> `implementAbstractClasses`: enables code action to implement methods of classes inherited from an abstract class, using AI suggestions from GitHub Copilot to populate the method body. </li> </ul> Usage example: ```{"implementAbstractClasses": true}``` |
7173
| inlayHints.variableTypes | false | Whether to display inlay hints for variable types. Accepted values are `true` or `false`. |
7274
| inlayHints.functionReturnTypes | false | Whether to display inlay hints for function return types. Accepted values are `true` or `false`. |
7375
| inlayHints.callArgumentNames | false | Whether to display inlay hints for call argument names. Accepted values are `true` or `false`. |

0 commit comments

Comments
 (0)