Merge pull request #114628 from microsoft/alex/python-language-configuration

Move `onEnterRules` to `language-configuration.json`
This commit is contained in:
Alexandru Dima 2021-01-25 20:50:40 +01:00 committed by GitHub
commit 5a3fedf0c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 7 additions and 81 deletions

View file

@ -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',

View file

@ -1,8 +1,3 @@
test/**
src/**
out/**
tsconfig.json
extension.webpack.config.js
extension-browser.webpack.config.js
cgmanifest.json
.vscode

View file

@ -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'
}
});

View file

@ -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'
}
});

View file

@ -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" }
}
]
}

View file

@ -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"
}
}

View file

@ -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 }
}
]
});
}

View file

@ -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.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>

View file

@ -1,9 +0,0 @@
{
"extends": "../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./out"
},
"include": [
"src/**/*"
]
}