Bug 330634 - Python str.format positional argument specifiers can be omitted
Summary: Python str.format positional argument specifiers can be omitted
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: Git
Platform: unspecified All
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-01 15:41 UTC by xOneca
Modified: 2016-01-31 16:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch updating tag substitution (2.77 KB, patch)
2014-02-01 15:46 UTC, xOneca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xOneca 2014-02-01 15:41:39 UTC
From http://docs.python.org/2/library/string.html#format-string-syntax:
> Changed in version 2.7: The positional argument specifiers can be omitted, so '{} {}' is equivalent to '{0} {1}'.

But current syntax highlighting doesn't reflect this.

Reproducible: Always

Steps to Reproduce:
"This looks good: {0}".format("good")
"This does not look good, but should: {}".format("good?")
"This also should be ok: {:s}".format("good?")
Actual Results:  
The two last strings are not correctly highlighted.

Expected Results:  
Correctly identify "{}" and "{:s}" as correct replacement fields and highlight them.

(Related to bug 317097)
Comment 1 xOneca 2014-02-01 15:46:45 UTC
Created attachment 84934 [details]
Patch updating tag substitution

Patch is respect to rev. 0d7032ff. (File version: 2.22)
Comment 2 Christoph Cullmann 2016-01-31 16:28:24 UTC
Git commit 2ee8046be4aa7a15fb739352d82c73a2949777db by Christoph Cullmann.
Committed on 31/01/2016 at 16:27.
Pushed by cullmann into branch 'master'.

Patch updating tag substitution

>From http://docs.python.org/2/library/string.html#format-string-syntax:

  Changed in version 2.7: The positional argument specifiers can be omitted, so
  '{} {}' is equivalent to '{0} {1}'.

M  +19   -18   src/syntax/data/python.xml

http://commits.kde.org/ktexteditor/2ee8046be4aa7a15fb739352d82c73a2949777db