GeezerVison is showing github.com — Modifications to the linting, supported pep8 for linting. support for… · dannyzed/pythonVSCode@e548e1b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +7-5Lines changed: 7 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Python | 2 | 2 | Linting, Debugging, Intellisense, auto-completion, code formatting, rename references, view references, go to definition, and the like | | 3 | +Works on both Windows and Mac. | 3 | 4 |
| 4 | 5 | ##Features | 5 | | -* Linting (using PyLint) | | 6 | +* Linting (using PyLint and/or Pep8 with support for configuration files) | 6 | 7 | * Intellisense and auto completion | 7 | | -* Code formatting (using Autopep8) | | 8 | +* Code formatting (using Autopep8 or yapf, defaults to autopep8, with support for configuration files) | 8 | 9 | * Renaming | 9 | 10 | * Viewing references | 10 | | -* Going to definitins | | 11 | +* Going to definitions | 11 | 12 | * View signature and similar by hovering over a function or method | 12 | | -* Debugging using PDB (work in progress, please remove any and all issues) | 13 | 13 | * Debugging with support for local & global variables, arguments, expressions, watch window, stack information, break points | 14 | 14 |
| 15 | 15 | * Sorting imports | @@ -20,9 +20,11 @@ Linting, Debugging, Intellisense, auto-completion, code formatting, rename refer | 20 | 20 | ## Requirements | 21 | 21 | * Python is installed on the current system | 22 | 22 | * Path to Python is assumed to be in the current environment path. | 23 | | -* Pylint is installed for linting | | 23 | +* Pylint is installed for linting (optional, this can be turned off) | 24 | 24 | * - Install Pylint as follows: | 25 | 25 | * - pip install pylint | | 26 | +* Pep8 is installed for linting (optional, this can be turned off) | | 27 | +* - pip install pep8 | 26 | 28 | * Autopep8 is installed for code formatting | 27 | 29 | * - Install AutoPep8 as follows (ensure pep8 is installed): | 28 | 30 | * - pip install pep8 | |
Collapse file Copy file name to clipboard +181-105Lines changed: 181 additions & 105 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | | - "name": "python", | 3 | | - "displayName": "Python", | 4 | | - "description": "Python debugging, linting, auto complete, code formatting, sorting imports, go to definition, peek definition, signature view, rename symbol, etc", | 5 | | - "version": "0.0.4", | 6 | | - "publisher": "donjayamanne", | 7 | | - "license": "SEE LICENSE IN LICENSE or README.MD", | 8 | | - "homepage": "https://github.com/DonJayamanne/pythonVSCode/blob/master/README.md", | 9 | | - "repository": { | 10 | | - "type": "git", | 11 | | - "url": "https://github.com/DonJayamanne/pythonVSCode" | 12 | | - }, | 13 | | - "bugs": { | 14 | | - "url": "https://github.com/DonJayamanne/pythonVSCode/issues" | 15 | | - }, | 16 | | - "icon": "images/icon.png", | 17 | | - "galleryBanner": { | 18 | | - "color": "#0000FF", | 19 | | - "theme": "dark" | 20 | | - }, | 21 | | - "engines": { | 22 | | - "vscode": "^0.10.1" | 23 | | - }, | 24 | | - "categories": [ | 25 | | - "Languages", | 26 | | - "Debuggers", | 27 | | - "Linters", | 28 | | - "Other" | | 2 | + "name": "python", | | 3 | + "displayName": "Python", | | 4 | + "description": "Python debugging, linting, auto complete, code formatting, sorting imports, go to definition, peek definition, signature view, rename symbol, etc", | | 5 | + "version": "0.0.4", | | 6 | + "publisher": "donjayamanne", | | 7 | + "license": "SEE LICENSE IN LICENSE or README.MD", | | 8 | + "homepage": "https://github.com/DonJayamanne/pythonVSCode/blob/master/README.md", | | 9 | + "repository": { | | 10 | + "type": "git", | | 11 | + "url": "https://github.com/DonJayamanne/pythonVSCode" | | 12 | + }, | | 13 | + "bugs": { | | 14 | + "url": "https://github.com/DonJayamanne/pythonVSCode/issues" | | 15 | + }, | | 16 | + "icon": "images/icon.png", | | 17 | + "galleryBanner": { | | 18 | + "color": "#0000FF", | | 19 | + "theme": "dark" | | 20 | + }, | | 21 | + "engines": { | | 22 | + "vscode": "^0.10.1" | | 23 | + }, | | 24 | + "categories": [ | | 25 | + "Languages", | | 26 | + "Debuggers", | | 27 | + "Linters", | | 28 | + "Other" | | 29 | + ], | | 30 | + "activationEvents": [ | | 31 | + "onLanguage:python", | | 32 | + "onCommand:python.sortImports" | | 33 | + ], | | 34 | + "main": "./out/client/extension", | | 35 | + "contributes": { | | 36 | + "commands": [ | | 37 | + { | | 38 | + "command": "python.sortImports", | | 39 | + "title": "Python: Sort Imports" | | 40 | + } | 29 | 41 | ], | 30 | | - "activationEvents": [ | 31 | | - "onLanguage:python", | 32 | | - "onCommand:python.sortImports" | 33 | | - ], | 34 | | - "main": "./out/client/extension", | 35 | | - "contributes": { | 36 | | - "commands": [ | 37 | | - { | 38 | | - "command": "python.sortImports", | 39 | | - "title": "Python: Sort Imports" | 40 | | - } | 41 | | - ], | 42 | | - "debuggers": [ | 43 | | - { | 44 | | - "type": "python", | 45 | | - "label": "Python", | 46 | | - "enableBreakpointsFor": { | 47 | | - "languageIds": [ | 48 | | - "python" | 49 | | - ] | 50 | | - }, | 51 | | - "program": "./out/client/debugger/main.js", | 52 | | - "runtime": "node", | 53 | | - "configurationAttributes": { | 54 | | - "launch": { | 55 | | - "required": [ | 56 | | - "program" | 57 | | - ], | 58 | | - "properties": { | 59 | | - "program": { | 60 | | - "type": "string", | 61 | | - "description": "Workspace relative path to a text file.", | 62 | | - "default": "__init__.py" | 63 | | - }, | 64 | | - "stopOnEntry": { | 65 | | - "type": "boolean", | 66 | | - "description": "Automatically stop after launch.", | 67 | | - "default": true | 68 | | - } | 69 | | - } | 70 | | - } | 71 | | - }, | 72 | | - "initialConfigurations": [ | 73 | | - { | 74 | | - "name": "Python", | 75 | | - "type": "python", | 76 | | - "request": "launch", | 77 | | - "program": "__init__.py", | 78 | | - "stopOnEntry": true | 79 | | - } | 80 | | - ] | 81 | | - } | 82 | | - ], | 83 | | - "configuration": { | 84 | | - "type": "object", | 85 | | - "title": "Python Configuration", | | 42 | + "debuggers": [ | | 43 | + { | | 44 | + "type": "python", | | 45 | + "label": "Python", | | 46 | + "enableBreakpointsFor": { | | 47 | + "languageIds": [ | | 48 | + "python" | | 49 | + ] | | 50 | + }, | | 51 | + "program": "./out/client/debugger/main.js", | | 52 | + "runtime": "node", | | 53 | + "configurationAttributes": { | | 54 | + "launch": { | | 55 | + "required": [ | | 56 | + "program" | | 57 | + ], | 86 | 58 | "properties": { | 87 | | - "python.maxNumberOfProblems": { | 88 | | - "type": "number", | 89 | | - "default": 100, | 90 | | - "description": "Controls the maximum number of problems produced by the server." | 91 | | - } | | 59 | + "program": { | | 60 | + "type": "string", | | 61 | + "description": "Workspace relative path to a text file.", | | 62 | + "default": "__init__.py" | | 63 | + }, | | 64 | + "stopOnEntry": { | | 65 | + "type": "boolean", | | 66 | + "description": "Automatically stop after launch.", | | 67 | + "default": true | | 68 | + } | 92 | 69 | } | 93 | | - } | 94 | | - }, | 95 | | - "scripts": { | 96 | | - "vscode:prepublish": "node ./node_modules/vscode/bin/compile", | 97 | | - "compile": "node ./node_modules/vscode/bin/compile -watch -p ./ && installServerIntoExtension ./out ./src/server/package.json ./src/server/tsconfig.json" | 98 | | - }, | 99 | | - "dependencies": { | 100 | | - "tmp": "0.0.28", | 101 | | - "vscode-debugadapter": "^1.0.1", | 102 | | - "vscode-debugprotocol": "^1.0.1", | 103 | | - "vscode-languageserver": "^1.1.0", | 104 | | - "vscode-languageclient": "^1.1.0" | 105 | | - }, | 106 | | - "devDependencies": { | 107 | | - "typescript": "^1.6.2", | 108 | | - "vscode": "0.10.x" | | 70 | + } | | 71 | + }, | | 72 | + "initialConfigurations": [ | | 73 | + { | | 74 | + "name": "Python", | | 75 | + "type": "python", | | 76 | + "request": "launch", | | 77 | + "program": "__init__.py", | | 78 | + "stopOnEntry": true | | 79 | + } | | 80 | + ] | | 81 | + } | | 82 | + ], | | 83 | + "configuration": { | | 84 | + "type": "object", | | 85 | + "title": "Python Configuration", | | 86 | + "properties": { | | 87 | + "python.linting.enabled":{ | | 88 | + "type": "boolean", | | 89 | + "default": true, | | 90 | + "description": "Whether to lint Python files." | | 91 | + }, | | 92 | + "python.linting.pylintEnabled":{ | | 93 | + "type": "boolean", | | 94 | + "default": true, | | 95 | + "description": "Whether to lint Python files using pylint." | | 96 | + }, | | 97 | + "python.linting.pep8Enabled":{ | | 98 | + "type": "boolean", | | 99 | + "default": false, | | 100 | + "description": "Whether to lint Python files using pep8" | | 101 | + }, | | 102 | + "python.linting.lintOnTextChange":{ | | 103 | + "type": "boolean", | | 104 | + "default": true, | | 105 | + "description": "Whether to lint Python files when modified." | | 106 | + }, | | 107 | + "python.linting.lintOnSave":{ | | 108 | + "type": "boolean", | | 109 | + "default": true, | | 110 | + "description": "Whether to lint Python files when saved." | | 111 | + }, | | 112 | + "python.linting.maxNumberOfProblems":{ | | 113 | + "type": "number", | | 114 | + "default": 100, | | 115 | + "description": "Controls the maximum number of problems produced by the server." | | 116 | + }, | | 117 | + "python.linting.pylintCategorySeverity.convention":{ | | 118 | + "type": "string", | | 119 | + "default": "Hint", | | 120 | + "description": "Severity of Pylint message type 'Convention/C'. Possible values include Error, Hint, Warning and Information." | | 121 | + }, | | 122 | + "python.linting.pylintCategorySeverity.refactor":{ | | 123 | + "type": "string", | | 124 | + "default": "Hint", | | 125 | + "description": "Severity of Pylint message type 'Refactor/R'. Possible values include Error, Hint, Warning and Information." | | 126 | + }, | | 127 | + "python.linting.pylintCategorySeverity.warning":{ | | 128 | + "type": "string", | | 129 | + "default": "Warning", | | 130 | + "description": "Severity of Pylint message type 'Warning/W'. Possible values include Error, Hint, Warning and Information." | | 131 | + }, | | 132 | + "python.linting.pylintCategorySeverity.error":{ | | 133 | + "type": "string", | | 134 | + "default": "Error", | | 135 | + "description": "Severity of Pylint message type 'Error/E'. Possible values include Error, Hint, Warning and Information." | | 136 | + }, | | 137 | + "python.linting.pylintCategorySeverity.fatal":{ | | 138 | + "type": "string", | | 139 | + "default": "Error", | | 140 | + "description": "Severity of Pylint message type 'Fatal/F'. Possible values include Error, Hint, Warning and Information." | | 141 | + }, | | 142 | + "python.linting.pylintPath":{ | | 143 | + "type": "string", | | 144 | + "default": "pylint", | | 145 | + "description": "Path to Pylint, you can use a custom version of pylint by modifying this setting to include the full path." | | 146 | + }, | | 147 | + "python.linting.pep8Path":{ | | 148 | + "type": "string", | | 149 | + "default": "pep8", | | 150 | + "description": "Path to pep8, you can use a custom version of pep8 by modifying this setting to include the full path." | | 151 | + }, | | 152 | + "python.formatting.provider":{ | | 153 | + "type": "string", | | 154 | + "default": "autopep8", | | 155 | + "description": "Provider for formatting. Possible options include 'autopep8' and 'yapf'." | | 156 | + }, | | 157 | + "python.formatting.autopep8Path":{ | | 158 | + "type": "string", | | 159 | + "default": "autopep8", | | 160 | + "description": "Path to autopep8, you can use a custom version of autopep8 by modifying this setting to include the full path." | | 161 | + }, | | 162 | + "python.formatting.yapfPath":{ | | 163 | + "type": "string", | | 164 | + "default": "", | | 165 | + "description": "Path to yapf, you can use a custom version of yapf by modifying this setting to include the full path." | | 166 | + } | | 167 | + } | 109 | 168 | } | 110 | | -} | | 169 | + }, | | 170 | + "scripts": { | | 171 | + "vscode:prepublish": "node ./node_modules/vscode/bin/compile", | | 172 | + "compile": "node ./node_modules/vscode/bin/compile -watch -p ./ && installServerIntoExtension ./out ./src/server/package.json ./src/server/tsconfig.json" | | 173 | + }, | | 174 | + "dependencies": { | | 175 | + "named-js-regexp": "^1.3.1", | | 176 | + "tmp": "0.0.28", | | 177 | + "vscode-debugadapter": "^1.0.1", | | 178 | + "vscode-debugprotocol": "^1.0.1", | | 179 | + "vscode-languageclient": "^1.1.0", | | 180 | + "vscode-languageserver": "^1.1.0" | | 181 | + }, | | 182 | + "devDependencies": { | | 183 | + "typescript": "^1.6.2", | | 184 | + "vscode": "0.10.x" | | 185 | + } | | 186 | +} |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/completion.py +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -274,6 +274,13 @@ def _process_request(self, request): | 274 | 274 | sys.path.insert(0, path) | 275 | 275 | lookup = request.get('lookup', 'completions') | 276 | 276 |
| | 277 | + if lookup == 'names': | | 278 | + return self._write_response(self._serialize_definitions( | | 279 | + jedi.api.names( | | 280 | + source=request['source'], | | 281 | + path=request.get('path', '')), | | 282 | + request['id'])) | | 283 | + | 277 | 284 | script = jedi.api.Script( | 278 | 285 | source=request['source'], line=request['line'] + 1, | 279 | 286 | column=request['column'], path=request.get('path', '')) | |
Collapse file Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import yapf | | 2 | +yapf.run_main() |
|