From 2d5f7fd0726c0c452e3d2466fb5480b636d1ad92 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 20 Jan 2021 12:20:27 +0100 Subject: [PATCH] Move `onEnterRules` to `language-configuration.json` --- build/gulpfile.extensions.js | 1 - extensions/python/.vscodeignore | 5 ----- .../extension-browser.webpack.config.js | 20 ------------------- extensions/python/extension.webpack.config.js | 17 ---------------- extensions/python/language-configuration.json | 8 +++++++- extensions/python/package.json | 5 ----- extensions/python/src/pythonMain.ts | 17 ---------------- extensions/python/src/typings/ref.d.ts | 6 ------ extensions/python/tsconfig.json | 9 --------- 9 files changed, 7 insertions(+), 81 deletions(-) delete mode 100644 extensions/python/extension-browser.webpack.config.js delete mode 100644 extensions/python/extension.webpack.config.js delete mode 100644 extensions/python/src/pythonMain.ts delete mode 100644 extensions/python/src/typings/ref.d.ts delete mode 100644 extensions/python/tsconfig.json diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index 06b4672bd71..60d6a79c926 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -57,7 +57,6 @@ const compilations = [ 'microsoft-authentication/tsconfig.json', 'npm/tsconfig.json', 'php-language-features/tsconfig.json', - 'python/tsconfig.json', 'search-result/tsconfig.json', 'simple-browser/tsconfig.json', 'testing-editor-contributions/tsconfig.json', diff --git a/extensions/python/.vscodeignore b/extensions/python/.vscodeignore index b5c95d0fb64..fd575df1731 100644 --- a/extensions/python/.vscodeignore +++ b/extensions/python/.vscodeignore @@ -1,8 +1,3 @@ test/** -src/** -out/** -tsconfig.json -extension.webpack.config.js -extension-browser.webpack.config.js cgmanifest.json .vscode diff --git a/extensions/python/extension-browser.webpack.config.js b/extensions/python/extension-browser.webpack.config.js deleted file mode 100644 index 9ffa8d167e9..00000000000 --- a/extensions/python/extension-browser.webpack.config.js +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -//@ts-check - -'use strict'; - -const withBrowserDefaults = require('../shared.webpack.config').browser; - -module.exports = withBrowserDefaults({ - context: __dirname, - entry: { - extension: './src/pythonMain.ts' - }, - output: { - filename: 'pythonMain.js' - } -}); diff --git a/extensions/python/extension.webpack.config.js b/extensions/python/extension.webpack.config.js deleted file mode 100644 index 1467031c5a2..00000000000 --- a/extensions/python/extension.webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -//@ts-check - -'use strict'; - -const withDefaults = require('../shared.webpack.config'); - -module.exports = withDefaults({ - context: __dirname, - entry: { - pythonMain: './src/pythonMain.ts' - } -}); diff --git a/extensions/python/language-configuration.json b/extensions/python/language-configuration.json index 4717d09750b..8e3f541412f 100644 --- a/extensions/python/language-configuration.json +++ b/extensions/python/language-configuration.json @@ -46,5 +46,11 @@ "start": "^\\s*#\\s*region\\b", "end": "^\\s*#\\s*endregion\\b" } - } + }, + "onEnterRules": [ + { + "beforeText": "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$", + "action": { "indent": "indent" } + } + ] } diff --git a/extensions/python/package.json b/extensions/python/package.json index f39c3d62b23..678b887180f 100644 --- a/extensions/python/package.json +++ b/extensions/python/package.json @@ -6,9 +6,6 @@ "publisher": "vscode", "license": "MIT", "engines": { "vscode": "*" }, - "activationEvents": ["onLanguage:python"], - "main": "./out/pythonMain", - "browser": "./dist/browser/pythonMain", "extensionKind": [ "ui", "workspace", "web" ], "contributes": { "languages": [{ @@ -29,8 +26,6 @@ }] }, "scripts": { - "compile": "gulp compile-extension:python", - "watch": "gulp watch-extension:python", "update-grammar": "node ../../build/npm/update-grammar.js MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json" } } diff --git a/extensions/python/src/pythonMain.ts b/extensions/python/src/pythonMain.ts deleted file mode 100644 index b16021f5609..00000000000 --- a/extensions/python/src/pythonMain.ts +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -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 } - } - ] - }); -} \ No newline at end of file diff --git a/extensions/python/src/typings/ref.d.ts b/extensions/python/src/typings/ref.d.ts deleted file mode 100644 index 531d3c037dd..00000000000 --- a/extensions/python/src/typings/ref.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/// \ No newline at end of file diff --git a/extensions/python/tsconfig.json b/extensions/python/tsconfig.json deleted file mode 100644 index 296ddb38fcb..00000000000 --- a/extensions/python/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../shared.tsconfig.json", - "compilerOptions": { - "outDir": "./out" - }, - "include": [ - "src/**/*" - ] -} \ No newline at end of file