Skip to content
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

Allow override of lexer in Syntax.from_path #1873

Merged
merged 4 commits into from
Jan 27, 2022
Merged

Conversation

darrenburns
Copy link
Member

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Adds ability to pass a lexer to Syntax.from_path

@darrenburns darrenburns linked an issue Jan 27, 2022 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2022

Codecov Report

Merging #1873 (d7f5acb) into master (e839bfb) will decrease coverage by 0.23%.
The diff coverage is 98.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1873      +/-   ##
==========================================
- Coverage   99.82%   99.58%   -0.24%     
==========================================
  Files          71       71              
  Lines        6943     7028      +85     
==========================================
+ Hits         6931     6999      +68     
- Misses         12       29      +17     
Flag Coverage Δ
unittests 99.58% <98.96%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/default_styles.py 100.00% <ø> (ø)
rich/syntax.py 99.27% <97.72%> (-0.34%) ⬇️
rich/pretty.py 99.71% <98.88%> (-0.29%) ⬇️
rich/__main__.py 100.00% <100.00%> (ø)
rich/_inspect.py 100.00% <100.00%> (ø)
rich/console.py 100.00% <100.00%> (ø)
rich/segment.py 99.34% <100.00%> (+0.05%) ⬆️
rich/table.py 100.00% <100.00%> (ø)
rich/traceback.py 92.92% <100.00%> (-6.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09f2fa8...d7f5acb. Read the comment docs.

@willmcgugan willmcgugan merged commit 232c8aa into master Jan 27, 2022
@willmcgugan willmcgugan deleted the syntax-from-path-lexer branch January 27, 2022 16:44
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 31, 2022
11.1.0 - 2022-01-28

Added

Add Syntax.guess_lexer, add support for more lexers (e.g. Django templates etc.) Textualize/rich#1869
Add lexer parameter to Syntax.from_path to allow for overrides Textualize/rich#1873

Fixed

Workaround for edge case of object from Faiss with no __class__ Textualize/rich#1838
Ensure Syntax always justifies left Textualize/rich#1872
Handle classes in inspect when methods=True Textualize/rich#1874
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add lexer option to Syntax.from_path
3 participants