##// END OF EJS Templates
Try to elide long completion based on user input....
Try to elide long completion based on user input. If what the user has typed is already in the completion and the completion is really long, try to elide what the user has already typed from the displayed text of the completion. Keep the first 3 and last 3 of what is already present. This will behave weirdly if all the completion have a common prefix as I believe prompt toolkit will insert the common prefix (or do we?). I'll have to check how to consider the common prefix as being typed.

File last commit:

r24535:23eb6b09
r25689:d5704fdc
Show More
fixup_whats_new_pr.py
46 lines | 1.1 KiB | text/x-python | PythonLexer
/ tools / fixup_whats_new_pr.py
"""
This tool is used during CI testing to make sure sphinx raise no error.
During development, we like to have whatsnew/pr/*.rst documents to track
individual new features. Unfortunately they other either:
- have no title (sphinx complains)
- are not included in any toctree (sphinx complain)
This fix-them up by "inventing" a title, before building the docs. At release
time, these title and files will anyway be rewritten into the actual release
notes.
"""
import glob
def main():
folder = 'docs/source/whatsnew/pr/'
assert folder.endswith('/')
files = glob.glob(folder+'*.rst')
print(files)
for filename in files:
print('Adding pseudo-title to:', filename)
title = filename[:-4].split('/')[-1].replace('-', ' ').capitalize()
with open(filename) as f:
data = f.read()
try:
if data and data.splitlines()[1].startswith('='):
continue
except IndexError:
pass
with open(filename, 'w') as f:
f.write(title+'\n')
f.write('='* len(title)+'\n\n')
f.write(data)
if __name__ == '__main__':
main()