-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix indentation on single-liners and f-strings in type formatting #1312
Changes from 30 commits
a764bc9
9d1b2cc
a91291a
bf266af
7bc6bd6
8ce8b48
e3a549e
92e8c1e
b540a1d
7b0573e
facb106
f113881
3e76718
6e85dc6
99e037c
3caeab7
eeb1f11
f5f78c7
88744da
65dde44
c513f71
ccb3886
106f4db
9e5cb43
e1da6a6
e78f0fb
725cf71
5cd6d45
27613db
8061a20
17dc292
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ import { | |
extensions, IndentAction, languages, Memento, | ||
OutputChannel, window | ||
} from 'vscode'; | ||
import { IS_ANALYSIS_ENGINE_TEST } from '../test/constants'; | ||
import { AnalysisExtensionActivator } from './activation/analysis'; | ||
import { ClassicExtensionActivator } from './activation/classic'; | ||
import { IExtensionActivator } from './activation/types'; | ||
|
@@ -75,7 +74,8 @@ export async function activate(context: ExtensionContext) { | |
const configuration = serviceManager.get<IConfigurationService>(IConfigurationService); | ||
const pythonSettings = configuration.getSettings(); | ||
|
||
const activator: IExtensionActivator = IS_ANALYSIS_ENGINE_TEST || !pythonSettings.jediEnabled | ||
const analysisEngineTest = process.env.VSC_PYTHON_ANALYSIS === '1'; | ||
const activator: IExtensionActivator = analysisEngineTest || !pythonSettings.jediEnabled | ||
? new AnalysisExtensionActivator(serviceManager, pythonSettings) | ||
: new ClassicExtensionActivator(serviceManager, pythonSettings); | ||
|
||
|
@@ -108,7 +108,11 @@ export async function activate(context: ExtensionContext) { | |
languages.setLanguageConfiguration(PYTHON.language!, { | ||
onEnterRules: [ | ||
{ | ||
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async)\b.*/, | ||
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except)\b.*:\s*\S+/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've created an issue (#1314) to ensure we try (some how) create tests to test this indentation. We've had to make changes to this area a number of times. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, yet to figure out how to simulate typing in VSC. |
||
action: { indentAction: IndentAction.None } | ||
}, | ||
{ | ||
beforeText: /^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async)\b.*:\s*/, | ||
action: { indentAction: IndentAction.Indent } | ||
}, | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move to
src/client/common/constants.ts
(that's where we haveisTestExecution()