Commit graph

70 commits

Author SHA1 Message Date
Benjamin Woodruff
94e40d84ac Reorder position providers in documentation
PositionProvider is the best choice in most cases, so it should come
before WhitespaceInclusivePositionProvider in the documentation.
2019-10-17 14:59:52 -07:00
Benjamin Woodruff
9d68a58c17 Rename position provider classes
I discussed the high-level idea here with @DragonMinded a few months
ago, but this isn't set in stone. If people have better ideas for names,
I'd love to hear it.

Publicly-Visible Changes
------------------------

- SyntacticPositionProvider is deprecated. The new name is
  PositionProvider.
- BasicPositionProvider is deprecated. The new name is
  WhitespaceInclusivePositionProvider.
- Documentation is updated to better explain these renamed providers and
  how to use them.

The prefixes "Syntactic" and "Basic" were pretty bad because they're
just concepts that we made up for LibCST.

The idea for the new names is that most users will want the
SyntacticPositionProvider, and so we should name things so that the user
will naturally gravitate towards the correct choice.

There's some argument that we shouldn't even bother exposing
WhitespaceInclusivePositionProvider, but we already need to implement it
as a fallback for PositionProvider, and it might be useful for some
niche use-cases.

Once we have another major version bump, we can remove the old class
names. The old class names have already be removed from the
documentation so that new users aren't tempted to use them.

Internal-Only Changes
---------------------

- `PositionProvider` is now `_PositionProviderUnion`. This type alias
  was never a public API (and probably never will be).
- `BasicCodegenState` is now
  `WhitespaceInclusivePositionProvidingCodegenState`.
- `SyntacticCodegenState` is now `PositionProvidingCodegenState`.
2019-10-17 14:59:52 -07:00
Benjamin Woodruff
3c92a7b367 Tweak wording/formatting of the scope provider intro
Explaining the implementation details of scopes to someone unfamiliar
with compilers can be tricky. Hopefully this helps.

- Rephrased the definition of a scope to be more applicable to Python
  (remove references to "blocks"), and made it use an example for
  (hopefully) better clarity.
- New scopes are also created for comprehensions.
- Set a fixed width (400px) for the scope diagram, since it was too
  large before.
- Tweaked some tenses.
- Add a final call to action: "LibCST allows you to inspect these
  scopes"
2019-10-15 18:02:51 -07:00
Jimmy Lai
5f8f5c5624 address review feedback form #94 2019-10-08 15:48:59 -07:00
Jimmy Lai
b690c591e5 [doc] add Scope Analysis tutorial 2019-10-08 15:48:59 -07:00
Jimmy Lai
9f8e69b1b3 [doc] use libcst.metadata for referencing metadata classes and add docstring for Scope magic functions 2019-10-08 15:48:59 -07:00
Jimmy Lai
13637b7d58 add docs for Assignments and Accesses 2019-10-08 15:48:59 -07:00
Christopher Hunt
6520d25816 Fix visitor helper function name pattern in docs 2019-10-04 21:40:52 -07:00
Jennifer Taylor
27b5a1d286 Improve removing nodes from parents in LibCST.
Add a RemoveFromParent() function as a convenience to returning RemovalSentinel.REMOVE.
Introduce a `deep_remove()` on CSTNode analogous to `deep_replace()` but for removing.
2019-10-02 15:43:48 -07:00
Jimmy Lai
7b96b070ca Organize document menu as three parts: introduction, tutorial and reference 2019-10-02 12:26:35 -07:00
Jennifer Taylor
32037efab9 Add a tutorial for matchers. 2019-10-01 15:28:58 -07:00
Jennifer Taylor
e2868f703b Add documentation to matchers. 2019-10-01 15:28:58 -07:00
Jimmy Lai
1488126df5 fix import asname support in get_qualified_names_for and add tests/docs 2019-10-01 14:24:20 -07:00
Jimmy Lai
0948108dce add binder link to notebook tutorial page 2019-10-01 13:41:29 -07:00
Jimmy Lai
6680c2d05f add nested function/class test cases and documents to Qualified Name Metadata 2019-09-30 12:03:19 -07:00
Jimmy Lai
50b3c61794 add docs of get_qualified_names_for 2019-09-30 12:03:19 -07:00
Jimmy Lai
4cde536678 add more test cases to ParentNodeProviderTest 2019-09-26 17:39:16 -07:00
Jimmy Lai
db6092dffd add docs of ParentNodeProvider 2019-09-26 17:39:16 -07:00
Mark Vismonte
a4b0527457 Add type to init in tutorial 2019-09-18 13:44:50 -07:00
Jimmy Lai
21e155e0aa [doc] use png file and fix typo 2019-09-16 19:53:22 -07:00
Jimmy Lai
02a831ff27 [doc] fix some typos and add simple Scope Provider introduction 2019-09-16 19:53:22 -07:00
Jimmy Lai
b4851a60a1 [doc] add scope introduction and examples 2019-09-16 19:53:22 -07:00
Jimmy Lai
ec68bdb147 update import paths in Jupyter notebook 2019-09-16 19:53:22 -07:00
Jimmy Lai
213b335cd5 move metadata providers its data structures to libcst.metadata 2019-09-16 19:53:22 -07:00
Jimmy Lai
d55a8bc060 update author in Sphinx conf.py 2019-09-16 19:53:22 -07:00
Jimmy Lai
612cbb0a9e add docstring to ScopeProvider 2019-09-16 19:53:22 -07:00
Jimmy Lai
966ab81a36 add ScopeProvider document 2019-09-16 19:53:22 -07:00
Jimmy Lai
0182902167 Fix some typos and add watchman config for pyre incremental check 2019-09-16 13:48:34 -07:00
Gareth T
41af9de31d [docs] Small update and corrections to documentation. (#55) 2019-09-03 10:30:08 -07:00
Jennifer Taylor
0d2b66a1e7 Add more documentation around attribute visitors.
Adds a bit more documentation to various pieces of attribute visitors.
Adds a section around traversal order of visitors given a tree.
2019-08-29 14:16:51 -07:00
jimmylai
70d6ca6513
[doc] improve metadata docs. (#50) 2019-08-28 13:41:31 -07:00
jimmylai
b19732938c
[metadata] add ExpressionContextProvider (#49)
* [metadata] add ExpressionContextProvider

* address comments
2019-08-27 19:07:28 -07:00
Benjamin Woodruff
f34d6a80fe Include ParserSyntaxError in parser documentation 2019-08-22 13:35:11 -07:00
Ray Zeng
68699e21d7 Add more examples and improve docstrings 2019-08-16 10:34:30 -07:00
Ray Zeng
e2f2eafc59 Add extended example for metadata and fix some docstrings 2019-08-16 10:34:30 -07:00
Ray Zeng
fa6bb4942c Moved metadata usage example into usage.ipynb 2019-08-16 10:34:30 -07:00
Ray Zeng
d91a79220b Fix some typing and improve some docstrings for metadata 2019-08-16 10:34:30 -07:00
Ray Zeng
f0b6e6c37d Re-organize metadata documentation and add a usage example 2019-08-16 10:34:30 -07:00
Ray Zeng
63ff16cb47 Add more metadata documentation 2019-08-16 10:34:30 -07:00
Ray Zeng
79f0ebc2a4 Add sphinx docs to metadata modules 2019-08-16 10:34:30 -07:00
jimmylai
611f45e596
[doc] use original_node instead of node for consistency 2019-08-14 14:57:26 -07:00
Benjamin Woodruff
90e4efb348 Add docs for MaybeSentinel and RemovalSentinel
These were referred to by other parts of the documentation, and they
provide core parts of our functionality, so we should have explicit
documentation for them.
2019-08-08 11:04:02 -07:00
Benjamin Woodruff
da7b9435ee Add logo and favicon to sphinx documentation
- The white logo variant shows up on the top of the sidebar.
- The favicon shows up when the page is loaded.
2019-08-07 13:32:31 -07:00
Benjamin Woodruff
ef0ce06e12 Remove unused sphinx plugins
It doesn't look like we need:

- `sphinx.ext.githubpages`
- `sphinx.ext.todo`
- `sphinx.ext.mathjax`

So I removed these and then sorted the list of extensions.
2019-08-06 19:39:43 -07:00
Benjamin Woodruff
647ef53f0e Finish documentation pass over expressions
This commit mostly focuses on f-strings, collections, comprehensions,
and subscripts/slices.

I added intersphinx support to the sphinx config so I could link to
`ast.literal_eval`.

I exported BaseSimpleComp, since I felt it had some documentation value.
2019-08-06 19:39:43 -07:00
Jennifer Taylor
101ff70857 Lots of work on Why LibCST section
Fixed Why LibCST printed example as it was out of date.
Unrolled README example into Why LibCST section to decouple since this page explicitly uses "fn(1, 2)" snippet and the readme is going to change.
Added justification and pros/cons to LibCST.
Added graphviz to render the non-default parts of LibCST tree (identical to how we render non-default parts of the AST).
2019-08-06 16:55:08 -07:00
jimmylai
6138e74542
[document] add jupyter based tutorial page
* [document] add jupyter based tutorial page

* add return type and fix typos
2019-08-06 16:34:03 -07:00
Jennifer Taylor
944f987b1f Better documentation for visitors. 2019-08-05 10:56:33 -07:00
Benjamin Woodruff
593968da65 Add the logo to the docs/source/_static/ directory 2019-08-05 10:44:17 -07:00
Jennifer Taylor
9ca3d39fb6 Rename Ellipses to Ellipsis to match AST and Python stuff. 2019-08-02 17:17:38 -07:00