Commit graph

157 commits

Author SHA1 Message Date
Noorhteen Raja NJ
a52c364569
refactor: remove unused argument to parser (#4344) 2021-07-01 15:17:45 +03:00
Daniel Shimon
7f8aeefae8
tests: Run tests with the amalgamated xonsh (#4290)
* tests: Run tests with the amalgamated xonsh

* tests: Test xonsh loads correctly interactively

* tests: Ensure tests run from amalgamated xonsh

* environ: Separate $XONSH_DEBUG and $XONSH_NO_AMALGAMATE

* tests: Keep XONSH_NO_AMALGAMATE in a comment for ease of debugging

* tests: Fix monkeypatch for amalgamated code
2021-05-28 15:42:37 +03:00
Daniel Shimon
224fc55e41
Completion context (#4017)
* completion-context: Add CompletionContextParser placeholder

Implements the xonsh (tab-)completion context parser.
This parser is meant to parse a (possibly incomplete) command line.

* completers: tools: Implement ``contextual_completer`` decorator

This is used to mark completers that want to use the parsed completion context.

* completers: Enable using contextual completers in xonsh/completer.py

* completers: readline, ptk, jupyter: Enable using contextual completers

Pass ``multiline_text`` and ``cursor_index`` to ``Completer.complete()``

* parsers: base: Refactor out a ``raise_parse_error`` function

* tokenize: Enable ``tolerant`` mode

If ``tolerant`` is True, yield ERRORTOKEN instead of
    throwing an exception when encountering an error.

* lexer: Enable ``tolerant`` mode

Tokenize without extra checks (e.g. paren matching).
When True, ERRORTOKEN contains the erroneous string instead of an error msg.

* tests: lexer: Test ``tolerant`` mode

* completion-context: Implement simple CommandContext parsing

* completion-context: tests: Test simple CommandContext parsing

* completion-context: Implement parsing sub-commands

* completion-context: tests: Test parsing sub-commands

* completion-context: Add news file

* completion-context: parser: Add parser table path to relevant locations

Code-coverage, mypy ignore list, etc.

* completion-context: Implement parsing partial strings and line continuations

* completion-context: tests: Test parsing partial strings and line continuations

* completion-context: Convert ``Span`` object to a ``slice``

* completion-context: Refactor out ``create_command`` and ``cursor_in_span``

* completion-context: Implement handling empty commands

* completion-context: tests: Test handling empty commands

* completion-context: Implement handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: tests: Test handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: Implement handling python context

* completion-context: tests: Test handling python context

* completers: tools: Add `contextual_command_completer`

* completers: Make `complete_skipper` contextual

* completers: Make `complete_from_man` contextual

* completers: Make `complete_from_bash` contextual and add test

* completers: Make `complete_pip` contextual and update tests

* completers: Keep opening string quote if it exists

* completion-context: Handle cursor after a closing quote

For example - cursor at the end of ``ls "/usr/"``.
1. The closing quote will be appended to all completions.
 I.e the completion ``/usr/bin`` will turn into ``/usr/bin"``
2. If not specified, lprefix will cover the closing prefix.
 I.e for ``ls "/usr/"``, the default lprefix will be 6 to include the closing quote.

* completion-context: tests: Test handling cursor after a closing quote

* completion-context: Fix bug with multiple empty commands

e.g. `;;;`

* completion-context: tests: Speed up tests

From ~15 seconds to ~500 ms

* completion-context: Expand commands and subcommands

* completion-context: Simplify `commands` rules

* completion-context: Simplify `sub_expression` rules

* completion-context: Simplify editing a multi-command token

* completion-context: Inline `create_command`

* completion-context: Implement `contextual_command_completer_for` helper

* completers: Make `complete_cd`/`complete_rmdir` contextual and add tests

* completers: path: Don't append a double-backslash in a raw string

When completing a path, if a raw string is used (e.g. `r"C:\Windows\"`),
there's no reason to append a double-backslash (e.g. `r"C:\Windows\\"`).

* completers: Make `complete_xonfig`/`complete_xontrib` contextual and add tests

* completers: Make `complete_completer` contextual and add tests

* completers: Make `complete_import` contextual and add tests

* completion-context: Add python `ctx` attribute

* completion: tools: Simplify `RichCompletion` attributes handling

* completers: Make `base`, `python`, and `commands` contextual

* Add tests
* No need for `python_mode` completer anymore

* completion: tools: Add `append_space` attribute to `RichCompletion`

* completion-context: Get all lines in a main python context

* xontrib: jedi: Make the `jedi` completer contextual

* completers: tools: Remove `get_ptk_completer` and `PromptToolkitCompleter.current_document`

These aren't needed anymore now that contextual completers can access the multiline code (via `PythonContext.multiline_code`).

* completion-context: ptk: Expand aliases

* completion-context: jupyter: Expand aliases and fix line handling

* completer: Preserve custom prefix after closing quote

* completers: bash: Ensure bash completion uses the complete prefix

* completers: pip: Append a space after a pip command

* completers: pip: Prevent bad package name completions

* completers: Remove a common prefix from `RichCompletion` if `display` wasn't provided

* completion-context: Treat cursor at edge of `&& || | ;` as normal args

This will be used for completing a space

* completers: Complete end proc keywords correctly
2021-03-30 13:37:56 -04:00
Gil Forsyth
9bb91a0b4b
Cleanup remaining vended ptk bits (#4130) 2021-03-01 16:55:23 -05:00
Noorhteen Raja NJ
d44a352e0b
fix: update setup.py table generation function (#4044)
* fix: update setup.py table generation function

so that will work with relative paths
- update extras-requirement full
- remove invalid link

fixes #4039

* Update setup.py
2021-01-05 09:58:02 -05:00
Noortheen Raja
5b6ea6c993 feat: use PyperClipboard if available for ptk
closes #3989
2020-11-26 09:28:06 +05:30
Anthony Scopatz
3afd5430a0
Procs Initial Refactor (#3897)
* refectored builtins

* refectored posix and readers

* refectored posix and readers

* proxies

* pipelines

* basic procs import cleanup

* fixed / refactored tests

* procs docs

* amalgamate

* XONSH_DEBUG=1 in tests

* exclude xonsh.procs mypy

* Use `pip install` instead of `python setup.py install`

* Update docs/api/procs/pipelines.rst

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

Co-authored-by: Gil Forsyth <gil@forsyth.dev>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2020-10-20 10:21:11 -04:00
Jerzy Drozdz
bc924816a8 Updated prompt-toolkit version requirement 2020-10-19 14:29:17 +02:00
Bob Hyman
bed0011673 Move jup kernel spec from setup to xonfig; add doc. 2020-09-13 15:37:44 -04:00
Bob Hyman
f1d703d096 Merge branch 'master' into is_3622 2020-08-24 05:28:34 -04:00
Bob Hyman
9cd3f4bf18 Setup add [full] extras tag 2020-08-18 22:46:04 -04:00
Anthony Scopatz
7d1a7ea9cb fixed pip install && setup.py sdist to include generated files 2020-08-16 13:03:57 -05:00
Morten Enemark Lund
441c0a0c0a Fix vended prompt_toolkit packages not beeing installed with pip 2020-08-12 14:56:26 +02:00
Anthony Scopatz
377ab8d9de
Merge pull request #3662 from bobhy/is_3661
drop dependence on py.exe on Windows
2020-08-11 20:12:01 -04:00
Bob Hyman
224c555afe Document preference for pip install over setup.py. 2020-08-11 12:25:17 -04:00
Morten Enemark Lund
d855431f5e Exclude wcwidth from flake8/black tests 2020-08-10 12:43:25 +02:00
Bob Hyman
2f439fef21 install via pip install for best perf. 2020-08-09 23:05:21 -04:00
Bob Hyman
91f1962d28 Enable xonsh-cat for invocation directly from OS shell. 2020-08-08 02:33:07 -04:00
Bob Hyman
989db694a3 Use setuputils generated console scripts for xonsh and xonsh-cat 2020-08-08 00:53:44 -04:00
Morten Enemark Lund
6dcf619c01 Add vended ptk to pakages setup.py 2020-08-06 10:08:13 +02:00
Matthias Bussonnier
784c5286ef
Remove most of Python 3.5 compatibility code. (#3654)
There  now should not be any remaining  3,5 conditinal code.
We now directly use inspect's getouterframes, so remove it from
inspector

The 3.5 parser get merged into 3.6 and a number of global vaiable
referring to 3.5/3.6 are now gone.

The only remaining mention is appveyor test, which are anyway failing
but not being seen as so by GitHub, so I'll leave them alone.
2020-08-05 10:29:31 -04:00
Jason R. Coombs
f67c6e83ec Remove distutils fallback. Fixes #3638.
Also remove Python 2 compatibility imports.
2020-07-29 15:53:13 -04:00
Bob Hyman
53bfe8c99c
Add ptk3 (#3521)
* delete package ptk; rename ptk2 to ptk_shell.; leave ptk2 as alias for ptk_shell.
* SHELL_TYPE "prompt_toolkit" only; remove ptk1 specific behavior.
* Doc updates: eliminate reference to prompt-toolkit < 2.0
* update requirements files ptk>=2; test shell_style="none"
* fix ptk2 stub per code review
* Add ptk2 to list of packages to install.
2020-04-18 10:44:27 -04:00
Anthony Scopatz
9a3f0e5cb5 config interface improvement 2019-10-23 17:20:10 -04:00
Anthony Scopatz
6496c52336 some housekeeping for webconfig 2019-10-15 22:13:51 -04:00
Morten Enemark Lund
46cdf40b9b Remvoe win_unicode_console support
The new Windows terminal solves the problem
of unicode on windows much better
2019-10-07 22:21:13 +02:00
Jamie Bliss
83619d1745 Rewrite xontrib json stuff to be zipapp friendly 2019-06-17 14:46:28 -04:00
Anthony Scopatz
f1127ed916 Revert "updated setup.py for Python 3.4 (revert of 91ec14bb6d)"
This reverts commit 002a317951.
2019-05-14 17:41:35 -04:00
Anthony Scopatz
002a317951 updated setup.py for Python 3.4 (revert of 91ec14bb6d) 2019-05-14 17:32:31 -04:00
Anthony Scopatz
3e05159ba6 python_requires 2019-05-10 18:47:34 -04:00
Rodrigo Oliveira
91ec14bb6d Drop support for Python 3.4
Minimal required Python version is now 3.5.
2019-05-06 16:51:32 -03:00
Anthony Scopatz
94c09014ec version quotes 2018-08-30 09:25:36 -05:00
Anthony Scopatz
0557eecee0 black: the only color you need 2018-08-30 09:17:34 -05:00
Anthony Scopatz
8609bef403 cat overhaul 2018-08-08 20:24:06 -04:00
Morten Enemark Lund
6d6548dc58 Remove support of pygments <2.2 2018-08-01 22:22:08 +02:00
Anthony Scopatz
c033cba7a7 merge from master 2018-07-06 17:19:16 -04:00
christopher
bc869fff3d fix setup.py package_dir 2018-07-03 10:44:29 -04:00
christopher
851671d8fb add files and allow xonsh/lib in git 2018-07-03 10:37:44 -04:00
christopher
b9c5b09937 WIP: make xonsh standard lib 2018-06-28 11:28:28 -04:00
Anthony Scopatz
e144aa9f02 some updates to new model 2018-06-17 13:39:12 -04:00
Jonathan Slenders
8f382cdb1c Set prompt_toolkit version to <2.0.0 in requirements. 2018-02-15 20:45:19 +01:00
Joel Gerber
2abb24f4f6
Docstring and comment spelling corrections
A number of common spelling typos found within various docstrings and
comments found within source code files have been identified and resolved.
2017-06-07 11:51:17 -04:00
Gil Forsyth
bdf885ee7a update dependencies in setup.py and docs 2017-01-27 11:18:16 -05:00
Hugo Wang
314c92830e do not create empty file 2016-12-21 12:45:20 +08:00
Anthony Scopatz
cbb9c24959 Python-powered, cross-platform, Unix-gazing shell 2016-12-15 09:38:26 -08:00
Hugo Wang
76a8a8fb5c refactoring mainly for amalgamate 2016-11-23 21:40:44 +08:00
Hugo Wang
728dc5ac0b wip: adding history backend sqlite 2016-11-22 21:23:07 +08:00
Gordon Ball
5f7bd01e0b Patch setup:install_jupyter_root to respect the root param 2016-11-03 14:27:57 +01:00
Hugo Wang
ce330123a7 fix git cmd 2016-11-02 13:30:53 +08:00
Hugo Wang
53d1d46838 added commit date in xonfig 2016-11-02 12:24:43 +08:00