mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45447: Add syntax highlighting for .pyi
files in IDLE (GH-28950)
Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues. Add util.py to contain objects that are used in multiple idlelib modules and have no dependencies on any of them. Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
b70690bb37
commit
50cf4991c4
11 changed files with 83 additions and 3 deletions
|
@ -27,6 +27,7 @@ from idlelib import query
|
|||
from idlelib import replace
|
||||
from idlelib import search
|
||||
from idlelib.tree import wheel_event
|
||||
from idlelib.util import py_extensions
|
||||
from idlelib import window
|
||||
|
||||
# The default tab setting for a Text widget, in average-width characters.
|
||||
|
@ -757,7 +758,7 @@ class EditorWindow:
|
|||
if not filename or os.path.isdir(filename):
|
||||
return True
|
||||
base, ext = os.path.splitext(os.path.basename(filename))
|
||||
if os.path.normcase(ext) in (".py", ".pyw"):
|
||||
if os.path.normcase(ext) in py_extensions:
|
||||
return True
|
||||
line = self.text.get('1.0', '1.0 lineend')
|
||||
return line.startswith('#!') and 'python' in line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue