Change:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Can the addition of the closing curly brace be whenever the opening curly brace is automatically initiated in an f-string in python? currently this doesn't happen and i need to add the closing curly brace when done - this feature would be useful --
Please add more details, e.g. a code sample.
apologies - I actually had but for some reason the main body of text wasn't posted. please see a below a code example - thank you. This is the current way in which the curly brace is interpreted in an f string. As you can see when you enter the opening curly brace, the closing one is not automatically inserted and i have to enter it manually.. it would be incredibly useful if the closing brace was automatically (in the same way automatic closing of brackets and braces is achieved outside of the print statement in the editor) to achieve something like: having said this - this is a trivial feature request, but i find myself using this a lot
is defined as bracket pair, also for when in strings, so I believe it should work.
Thank you for the reply! Hmm this doesn't for me unfortunately, is there a setting that needs to be activated?
does autoclose in strings in general e.g. https://user- But not at the position before the closing e.g. https://user- Relevant code:
ha! thank you, this is really interesting - i can confirm that it works when entering before the closing - funny because i have only ever really required the the braces before the closing comma (because this then creates a whitespace between the statement and the answer which is intended for visual purposes will this be treated as a bug to fix? again this obviously isn't critical. happy to close. thanks
This cannot be fixed at the moment. The behaviour is controlled by the autoCloseBefore property in the language configuration file, but quotes are not appropriate for that property. JavaScript and TypeScript make an exception for backticks.

Discussion:
this._electricChars = null; this.shouldAutoCloseBefore = { <del> quote: this._getShouldAutoClose(languageId, this.autoClosingQuotes), bracket: this._getShouldAutoClose(languageId, this.autoClosingBrackets) </del> <ins> quote: this._getShouldAutoClose(languageId, this.autoClosingQuotes, true), bracket: this._getShouldAutoClose(languageId, this.autoClosingBrackets, false) </ins> }; this.autoClosingPairs = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoClosingPairs();

return normalizeIndentation(str, this.indentSize, this.insertSpaces); } <del> private _getShouldAutoClose(languageId: string, autoCloseConfig: EditorAutoClosingStrategy): (ch: string) => boolean { </del> <ins> private _getShouldAutoClose(languageId: string, autoCloseConfig: EditorAutoClosingStrategy, forQuotes: boolean): (ch: string) => boolean { </ins> switch (autoCloseConfig) { case 'beforeWhitespace': return autoCloseBeforeWhitespace; case 'languageDefined': <del> return this._getLanguageDefinedShouldAutoClose(languageId); </del> <ins> return this._getLanguageDefinedShouldAutoClose(languageId, forQuotes); </ins> case 'always': return autoCloseAlways; case 'never':

} } <del> private _getLanguageDefinedShouldAutoClose(languageId: string): (ch: string) => boolean { const autoCloseBeforeSet = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoCloseBeforeSet(); </del> <ins> private _getLanguageDefinedShouldAutoClose(languageId: string, forQuotes: boolean): (ch: string) => boolean { const autoCloseBeforeSet = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoCloseBeforeSet(forQuotes); </ins> return c => autoCloseBeforeSet.indexOf(c) !== -1; }

return new AutoClosingPairs(this.characterPair.getAutoClosingPairs()); } <del> public getAutoCloseBeforeSet(): string { return this.characterPair.getAutoCloseBeforeSet(); </del> <ins> public getAutoCloseBeforeSet(forQuotes: boolean): string { return this.characterPair.getAutoCloseBeforeSet(forQuotes); </ins> } public getSurroundingPairs(): IAutoClosingPair[] {

export class CharacterPairSupport { <del> static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED = ';:.,=}])> nt'; </del> <ins> static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ';:.,=}])> nt'; static readonly DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = ''"`;:.,=}])> nt'; </ins> static readonly DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE = ' nt'; private readonly _autoClosingPairs: StandardAutoClosingPairConditional[]; private readonly _surroundingPairs: IAutoClosingPair[]; <del> private readonly _autoCloseBefore: string; </del> <ins> private readonly _autoCloseBeforeForQuotes: string; private readonly _autoCloseBeforeForBrackets: string; </ins> constructor(config: LanguageConfiguration) { if (config.autoClosingPairs) {

this._autoClosingPairs.push(new StandardAutoClosingPairConditional({ open: docComment.open, close: docComment.close || '' })); } <del> this._autoCloseBefore = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED; </del> <ins> this._autoCloseBeforeForQuotes = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES; this._autoCloseBeforeForBrackets = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS; </ins> this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs; }

return this._autoClosingPairs; } <del> public getAutoCloseBeforeSet(): string { return this._autoCloseBefore; </del> <ins> public getAutoCloseBeforeSet(forQuotes: boolean): string { return (forQuotes ? this._autoCloseBeforeForQuotes : this._autoCloseBeforeForBrackets); </ins> } public getSurroundingPairs(): IAutoClosingPair[] {

const autoClosePositions = [ 'var| a| |=| [|]|;|', <del> 'var| b| |=| `asd`|;|', 'var| c| |=| 'asd'|;|', 'var| d| |=| "asd"|;|', </del> <ins> 'var| b| |=| |`asd|`|;|', 'var| c| |=| |'asd|'|;|', 'var| d| |=| |"asd|"|;|', </ins> 'var| e| |=| /*3*/|	3|;|', 'var| f| |=| /**| 3| */3|;|', 'var| g| |=| (3+5|)|;|', <del> 'var| h| |=| {| a|:| 'value'| |}|;|', </del> <ins> 'var| h| |=| {| a|:| |'value|'| |}|;|', </ins> ]; for (let i = 0, len = autoClosePositions.length; i < len; i++) { const lineNumber = i + 1;

text: [ 'foo'hello'' ], <ins> editorOpts: { autoClosingBrackets: 'beforeWhitespace' }, </ins> languageId: languageId }, (editor, model, viewModel) => { assertType(editor, model, viewModel, 1, 4, '(', '(', `does not auto close @ (1, 4)`);