-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Section marks (#%%) not working as expected #11426
Comments
Thanks for the detailed report. Unfortunately this is very low priority to us, but you're welcome to send us a pull request to fix it. |
This more or less a duplicate of this issue #6379 The template function uses |
Ok, closing then. |
How about having a section variable to make sections in the template which will be replaced to #%% example template: @author: %(username)s #%(section)s Initialization of Libraries import sys, os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) #%(section)s Standalone Run if name == 'main': Output new file: @author: Tahasanul Abraham #%% Initialization of Libraries import sys, os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) #%% Standalone Run if name == 'main': To that I have just edited the plugin.py file from Anaconda3\Lib\site-packages\spyder\plugins\editor\widgets at line 1825 where the Dictionary Variable VARS will hold 3 keys instead of two.
Adding a pull request if the developers like it they can take it in. Thank you |
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
I've got a template that I've used for quite a long time for initial content. This is in
%USERNAME%\.spyder-py3\template.py
. In Spyder 4.0.1 I noticed that the section marks weren't working correctly. On investigation, it seems that an extra percent on the first section mark makes it work, which seems really weird to me.Compare the two images below. In each image, the left-hand side shows the template.py in Vim; the right-hand side shows what happens when you then create a new file in Spyder 4.0.1. The only difference between the bare template files as shown in Vim in the two images is that there's an extra % on line 5:
#%%
at the start of the line on the first (top) image vs#%%%
on the second (bottom) image. All the other section markers stay as#%%
.In the first image (with
#%%
on all sections), the sections aren't marked with a horizontal line in Spyder, in the second image (with#%%%
on the first section but not the others), all the sections are marked.What steps reproduce the problem?
%USERNAME%\.spyder-py3\template.py
(the attached file is the one without the extra % sign. I've uploaded it astemplate_py.txt
as github won't let me upload it to an issue as a python file.template_py.txt
What is the expected output? What do you see instead?
Should see section marks but don't.
Paste Traceback/Error Below (if applicable)
N/A
Versions
Dependencies
The text was updated successfully, but these errors were encountered: