Merge pull request #9310 from DonJayamanne/pythonIndent
Auto indenting python code
This commit is contained in:
commit
01ea47c31e
18
extensions/python/.vscode/launch.json
vendored
Normal file
18
extensions/python/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outDir": "${workspaceRoot}/out",
|
||||
"preLaunchTask": "npm"
|
||||
}
|
||||
]
|
||||
}
|
30
extensions/python/.vscode/tasks.json
vendored
Normal file
30
extensions/python/.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
|
||||
// A task runner that calls a custom npm script that compiles the extension.
|
||||
{
|
||||
"version": "0.1.0",
|
||||
|
||||
// we want to run npm
|
||||
"command": "npm",
|
||||
|
||||
// the command is a shell script
|
||||
"isShellCommand": true,
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// we run the custom script "compile" as defined in package.json
|
||||
"args": ["run", "compile"],
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
}
|
1
extensions/python/.vscodeignore
Normal file
1
extensions/python/.vscodeignore
Normal file
|
@ -0,0 +1 @@
|
|||
test/**
|
|
@ -3,6 +3,8 @@
|
|||
"version": "0.1.0",
|
||||
"publisher": "vscode",
|
||||
"engines": { "vscode": "*" },
|
||||
"activationEvents": ["onLanguage:python"],
|
||||
"main": "./out/pythonMain",
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "python",
|
||||
|
@ -19,5 +21,9 @@
|
|||
"scopeName": "source.regexp.python",
|
||||
"path": "./syntaxes/Regular Expressions (Python).tmLanguage"
|
||||
}]
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:python",
|
||||
"watch": "gulp watch-extension:python"
|
||||
}
|
||||
}
|
||||
|
|
17
extensions/python/src/pythonMain.ts
Normal file
17
extensions/python/src/pythonMain.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { ExtensionContext, languages, IndentAction } from 'vscode';
|
||||
|
||||
export function activate(context: ExtensionContext): any {
|
||||
languages.setLanguageConfiguration('python', {
|
||||
onEnterRules: [
|
||||
{
|
||||
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,
|
||||
action: { indentAction: IndentAction.Indent }
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
10
extensions/python/src/typings/ref.d.ts
vendored
Normal file
10
extensions/python/src/typings/ref.d.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../src/typings/mocha.d.ts'/>
|
||||
/// <reference path='../../../../extensions/node.d.ts'/>
|
||||
/// <reference path='../../../../extensions/lib.core.d.ts'/>
|
||||
/// <reference path='../../../../extensions/declares.d.ts'/>
|
11
extensions/python/tsconfig.json
Normal file
11
extensions/python/tsconfig.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noLib": true,
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"outDir": "./out"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue