From b9d05fda0ecb1dafc363a45ee0b5a2eba8215c24 Mon Sep 17 00:00:00 2001 From: ryderben <145984245+ryderben@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:29:53 +1000 Subject: [PATCH] Guess .pyi files as Python (#1996) --- lib/rouge/lexers/python.rb | 4 ++-- spec/lexers/python_spec.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rouge/lexers/python.rb b/lib/rouge/lexers/python.rb index b47b64aa76..17337588be 100644 --- a/lib/rouge/lexers/python.rb +++ b/lib/rouge/lexers/python.rb @@ -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) diff --git a/spec/lexers/python_spec.rb b/spec/lexers/python_spec.rb index 4f79903f36..e305ffff62 100644 --- a/spec/lexers/python_spec.rb +++ b/spec/lexers/python_spec.rb @@ -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'