Skip to content

Commit

Permalink
Guess .pyi files as Python (#1996)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderben committed Sep 25, 2023
1 parent b584ea1 commit b9d05fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rouge/lexers/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class Python < RegexLexer
desc "The Python programming language (python.org)"
tag 'python'
aliases 'py'
filenames '*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac',
'*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE'
filenames '*.py', '*.pyi', '*.pyw', '*.sc', 'SConstruct', 'SConscript',
'*.tac', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE'
mimetypes 'text/x-python', 'application/x-python'

def self.detect?(text)
Expand Down
1 change: 1 addition & 0 deletions spec/lexers/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

it 'guesses by filename' do
assert_guess :filename => 'foo.py'
assert_guess :filename => 'foo.pyi'
assert_guess :filename => 'foo.pyw'
assert_guess :filename => '*.sc', :source => '# A comment'
assert_guess :filename => 'SConstruct'
Expand Down

0 comments on commit b9d05fd

Please sign in to comment.