https://bugs.kde.org/show_bug.cgi?id=432573
Bug ID: 432573
Summary: Code folding not working properly for Python
Product: kate
Version: 20.12.1
Platform: Manjaro
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: folding
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 135464
--> https://bugs.kde.org/attachment.cgi?id=135464&action=edit
Screenshot of part of the code Mentioned above
SUMMARY
Code folding for 'def' keyword in python, not working properly. Some instances
of 'def' are left out of folding.
STEPS TO REPRODUCE
1. This part shows code folding,
def readable_bytes(n_bytes):
symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i + 1) * 10
for s in reversed(symbols):
if n_bytes >= prefix[s]:
value = int(float(n_bytes) / prefix[s])
return '%s%s' % (value, s)
return "%sB" % n_bytes
2. This part doesn't show code folding,
def get_processes_info(interval):
global average_number
global procs_cpu_average
# Sleeps for "interval"
time.sleep(interval)
procs = []
for p in psutil.process_iter():
try:
p.dict = p.as_dict([
'pid', # Unique ID
'username', # Owner
'nice', # Priority
'memory_percent', # Memory usage
'cpu_percent', # CPU usage
'name', # Description
'status', # For splitting processes according to
their status
])
.....
....
def print_header(procs):
global this_user
global cpu_cores
global header_message
global average_number
global procs_cpu_average
global change_priority_status
# Function that returns the no. of pipeline characters and space characters
(max. of 40)
def count_pipelines(perc):
dashes = "|" * int((float(perc) / 10 * 4.1))
empty_dashes = " " * (41 - len(dashes))
return dashes + empty_dashes
...
....
...
3. Above code is from "bpytop" source code on 'Github.
OBSERVED RESULT
Code folding should recognise 'def' keyword in python.
EXPECTED RESULT
Other editors correctly show Code folding.
SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Plasma
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
ADDITIONAL INFORMATION
--
You are receiving this mail because:
You are watching all bug changes.