Команда «Свернуть все комментарии к блоку» не работает со строками документации Python в файлах с определенными правилам ⇐ Python

Программы на Python
Anonymous
Команда «Свернуть все комментарии к блоку» не работает со строками документации Python в файлах с определенными правилам

Сообщение Anonymous »

Команда VS Code Fold All Block Comments, похоже, случайным образом решала, работать или нет с тем или иным файлом Python, который я редактировал, пока я не смог определить это. Количество операторов импорта в верхней части файла влияло на поведение команды.
Команда отлично работает с файлом без импорта:

Код: Выделить всё

""" This is a docstring that should fold
when VS Code's Fold All Block Comments command
is executed on this file. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna"""

# This folds
Также работает с файлом с одним импортом:

Код: Выделить всё

import math

""" This is a docstring that should fold
when VS Code's Fold All Block Comments command
is executed on this file. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna"""

# Also folds
Но при втором вводе он уже не складывается командой...

Код: Выделить всё

import math
import tkinter

""" This is a docstring that should fold
when VS Code's Fold All Block Comments command
is executed on this file. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna"""

# Does not fold with Fold All Block Comments command.
Просто ради интереса, функция свертывания возвращается, если импорт разделен строкой документации:

Код: Выделить всё

import math

""" This is a docstring that should fold
when VS Code's Fold All Block Comments command
is executed on this file. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna"""
# I fold!

import tkinter

""" This is a docstring that should fold
when VS Code's Fold All Block Comments command
is executed on this file. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna"""
# I fold too!
Строка документации по-прежнему распознается как область сгиба во всех примерах, но не сворачивается автоматически с помощью команды. Что делать?

Подробнее здесь: https://stackoverflow.com/questions/768 ... s-in-files

Вернуться в «Python»