Commit graph

62 commits

Author SHA1 Message Date
Evgeny
076ea2583f
Add Semantic Prompt support to multiline continuation lines (#5065)
* fix: match the main return type to avoid a style class concat type error

Error: can only concatenate str (not "_TokenType") to str in prompt_toolkit/formatted_text/base.py, line 94, in <listcomp>
    [(style + " " + item_style, *rest) for item_style, *rest in result]

* feat: support semantic prompt sequences for the multiline prompt

* Ignore .python-version

* doc: add News item

* doc: add description for the new multiline prompt env vars
2023-02-21 14:41:39 +05:30
Andy Kipp
3cc6b29644 Update .gitignore 2023-02-11 22:44:29 +05:30
Gil Forsyth
013fa760a0
refactor(amalgamate): remove amalgamation (#4858)
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-07-04 10:40:16 +05:30
Noorhteen Raja NJ
ed4421ddf4
pr5-pep621 (#4803) 2022-05-10 11:39:43 -04:00
Noorhteen Raja NJ
3ce8c9b337
add py310 (#4270)
* chore: adding py310 to ci

though this will require code/parser changes, this is to prepare for
upcoming adoption

* fix: set python version as string

* fix: reference to master -> main

* fix: coverage is not reported in master

- disable amalgamation
	1. during coverage report tests
	2. qa tools like mypy may follow imports
- use python 3.9 for coverage and qa report. since it will have more
coverage and better typing support

* chore: use py3.10 with setup-py action

* chore: add news-item check job

* fix: py3.10 error while starting

the match statement is not supported.
while the syntax support is only upto py3.8

* fix: news-item checker

* chore: enable fail report for py310 tests

* test: add test for ptk_shell
2021-06-07 13:40:40 -04: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
Noorhteen Raja NJ
f4a7f1f22f
chore: bring back codcoverage report (#3998)
* chore: bring back codcoverage report

* chore: the run-tests.xsh script can't print to stdout

* test: combine coverage on multiple runs

* test: sort coverage report by coverage percent

* chore (ci): split test step

* docs: add news item for code-coverage

* chore: try coverage parallel

but this will not work with --append mode.
2020-12-18 09:04:42 -05:00
Anthony Scopatz
913077b0b0
Merge pull request #3960 from jnoortheen/use-individual-file-for-xontrib-meta
Use individual file for xontrib meta
2020-11-10 14:44:41 -06:00
Noortheen Raja
8dfcbf1dea chore: remove repeated entry in .gitignore 2020-11-10 11:05:55 +05:30
Gyuri Horak
31dd811ef0
re-apply original changes 2020-10-27 15:23:58 +01:00
Anthony Scopatz
f99bfe1c94
Revert "PTK support for custom themes" 2020-10-26 10:48:00 -05:00
Gyuri Horak
604ac6f562
support for PTK specific styles 2020-10-17 22:26:30 +02:00
Noortheen Raja
609e9304e9 feat: add mypy to project 2020-10-09 20:19:09 +05:30
Bob Hyman
9cd3f4bf18 Setup add [full] extras tag 2020-08-18 22:46:04 -04:00
anki-code
6026e1a2a3 Merge branch 'master' of https://github.com/xonsh/xonsh into rever_appimage 2020-08-12 13:29:03 +03:00
Anthony Scopatz
4bbd487af3 Merge branch 'master' into rever_appimage 2020-08-10 17:58:37 -05:00
Bob Hyman
8740b15462 Run same wc,pwd,cat from tests/bin on Windows.
Run without depending on py.exe
2020-08-10 01:43:51 -04:00
Bob Hyman
7e6e47163f perf tweaks per review 2020-07-21 19:00:22 -04:00
anki-code
7b67548586 Merge branch 'master' of https://github.com/xonsh/xonsh into rever_appimage 2020-05-17 17:14:59 +03:00
anki-code
8393784456 gitignore AppImage 2020-05-06 12:27:08 +03:00
Noorhteen Raja J
8e6d2fae7d
feat: added xontrib for directory history navigation (#3533)
closes #3530
2020-04-30 20:29:56 -04:00
Jerzy Drozdz
b37675a6e8
Loading rc in non-interactive login shell (#3422)
* Setting -l flag loads environment on non-interactive shell
* Added checking dash existance in sys.argv[0]
* Fixed -a switch behaviour
* Added tests for xexec
* Added test for python<3.7 on Windows
* Testing non existent command with mocked execvpe
2020-03-01 12:56:23 -05:00
Bob Hyman
423c2cdb01 News and gitignore chances to pass PR tests. 2019-12-06 10:39:22 -05:00
Anthony Scopatz
a7a4ecb9da added js dir 2019-10-23 16:39:36 -04:00
Anthony Scopatz
c1ddb67a5f app compiles! 2019-10-16 17:54:47 -04:00
Anthony Scopatz
4cd2717a45 initial elm app 2019-10-15 23:50:13 -04:00
christopher
7b3f8dedb7 add comment for gitignore 2018-07-03 10:47:58 -04:00
christopher
851671d8fb add files and allow xonsh/lib in git 2018-07-03 10:37:44 -04:00
Anthony Scopatz
9f355b140c lambda AST fixes 2018-04-03 21:57:30 -04:00
Anthony Scopatz
026adba3e0 add rever setup 2017-11-22 18:12:29 -05:00
Anthony Scopatz
13d507e4f8 fixed conflicts 2017-02-27 21:14:41 -05:00
laerus
4a2ff3aa58 conftest xonsh_builtins teardown 2017-02-27 21:44:58 +02:00
Anthony Scopatz
b0dce1af1e fixes and tests for bad globs 2017-02-26 21:54:39 -05:00
Anthony Scopatz
773069c4f5 Xonsh startup loading refactor 2017-02-13 00:25:38 -05:00
Anthony Scopatz
008085ee6b fixes alias redirection 2016-10-13 02:03:30 -04:00
Anthony Scopatz
0a0eab11a3 tests run, if though they fail 2016-09-06 22:46:04 -04:00
Jamie Bliss
3721204304 Add an autogenerated events listing 2016-08-27 22:25:29 -04:00
Anthony Scopatz
2cc56a62f8 ignore credential files 2016-08-15 23:21:57 -04:00
Anthony Scopatz
d2623b32a8 transfer from laptop 2016-08-15 16:26:37 -04:00
Leonardo Santagada
ebf0fb49b2 ignore idea files 2016-07-18 09:59:13 +02:00
Gil Forsyth
08d6112a46 add githash file to setup, manifest and gitignore 2016-06-26 09:46:43 -04:00
Gil Forsyth
6d98baa7d0 Merge branch 'master' into pytest_port 2016-06-23 15:52:53 -04:00
Konstantinos Tsakiltzidis
8a0c447d96 test_aliases 2016-06-22 22:45:42 +03:00
Konstantinos Tsakiltzidis
8f2e6d32e8 tests for -D & -i/added .coverage in .gitignore 2016-06-22 11:35:24 +03:00
Anthony Scopatz
cc1092cdd3 more work 2016-06-13 00:46:35 -04:00
Anthony Scopatz
50d8f0c5bd interim add 2016-05-11 00:42:36 -04:00
Randy Syring
9d8134bf52 ignore Komodo editor project files 2016-04-01 00:36:14 -04:00
Anthony Scopatz
2f925aa3f1 autogen config var docs 2016-01-06 01:55:40 -08:00
Anthony Scopatz
abb0f3fc3c some v3.5 updates 2015-09-13 12:17:11 -04:00
Michał Zając
ec703afacc Merge remote-tracking branch 'upstream/master' 2015-06-11 14:13:57 +02:00