* refactor: remove usage of global variables in abbrevs.py
* chore: add flake8-mutable to prevent mutable defaults
* fix: abbrevs expand test
* refactor: add xonsh session singleton
* refactor: fix circular errors when using xonshSession as singleton
* refactor: remove black magicked builtin attributes
* style: black format tests as well
* refactor: update tests to use xonsh-session singleton
* refactor: update abbrevs to not use builtins
* test: remove DummyCommandsCache and patch orig class
* fix: failing test_command_completers
* test: use monkeypatch to update xession fixture
* fix: failing test_pipelines
* fix: failing test_main
* chore: run test suit as single invocation
* test: fix tests/test_xonsh.xsh
* refactor: remove builtins from docs/conf.py
* fix: mypy error in jobs
* fix: test error from test_main
* test: close xession error in test_command_completers
* chore: use pytest-cov for reporting coverage
this will include subprocess calls, and will increase coverage
* style:
* test_main: test lots of startup order combinations
This is based on the startup order described in
https://github.com/xonsh/xonsh/issues/4096#issuecomment-791991841
and adds an (ugly) parameterised test which tries lots of different
CLI combinations, and verifies which RC files (if any) get loaded,
and in what order.
* test_script_startup: skip on windows
* ast: Fix annotated assignment
* ast: Support annotated variable without a value
* tests: Test annotated assign statements
* news: Add annotated-assignment
* Add support for rc.d drop-in configuration directories
* main: change how --rc, --no-rc are handled
Explicitly pass --no-rc rather than signalling it as an empty --rc, to
indicate that we should suppress both XONSHRC and XONSHRCDIR in that
case.
* Rename XONSHRCDIR -> XONSHRC_DIR
* xonshrc_context: document setting env for XONSHRC_DIR
* main: --rc foo.xsh should suppress XONSHRC_DIR
* Add saving current working directory (cwd) to the history
* Added XONSH_HISTORY_SAVE_CWD and create PromptHistorySetting section
* news
* Move dummy history to the distinct file
* tests
* tests
Co-authored-by: a <a@a.a>
* fix: update failing commands-cache tests
in some cases, the thread updates the binaries faster than the next call
* chore: upgrade black to 21.5b0
* chore: upgrade mypy to 0.812 version
* fix: handle corrupt commands-cache file
* fix: parser-table output dir. this should be same as the defaults
* fix: flake8 error
* Added env variable to ignore ./ and ../ in filepath completion
* Changed ignore_dots to complete dots as always, never, or upon matching
* Updated news
* Added default 'matching'
* Update ignore_dots.rst
* black
* fix test
* tests
Co-authored-by: Bailey Morgan <bailey.mccarty.morgan@gmail.com>
Co-authored-by: a <a@a.a>
this uses https://github.com/Carreau/velin to try to autoreformat all
docstrings in xonsh/*.py
In particular in Parameters section the space before the colon is
necessary for numpydoc to properly find the name and the type.
When no type is there numpydoc says that colon should be removed.
This also try to find if there are typo in parameter names and fix them
when possible.
As a sideeffect of parsing with numpydoc and reconstructing the
docstring from the parsed data some whitespace information is lost; but
that has the advantage of making the whitespace rules uniform
everywhere.
* feat: use saved commands_cache between runs
this will speed-up startup time by a small factor (around 0.15s on my
system with ssd and ryzen5)
* test: update env-variable handling for cmds-cache tests
* refactor: add env-variable to control saving commands-cache
* refactor: mypy error fix for commands_cache
* fix: update handling max(iterable
* test: add tests for commands-cache new version
* docs: update env variable doc
* test: add more test for commands-cache caching behaviour
* Delete codecov.yml
codecov got hacked, rather badly, and we aren't going to send them anything ever again
* Remove codecov badge and remove from requirements
* 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
* Fix garbage collection of JSON history specified in seconds.
* Add news entry.
* Avoid possible off-by-one error
* Make size_over return value easier to reason about.
* Update gc_seconds test cases.
Co-authored-by: bhawkins <bhawkins@github.com>
* xoreutils: which: Make `which` command aware of ExecAlias
* aliases: exec-alias: Remove unneeded newline at end of src
It isn't needed for the exec to work
* news: Improve `which` output for ExecAlias
* update imphooks encoding regex to match the newer version at PEP 263
* fix: add proper backslash-escaping to the imphooks encoding regex
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
* Added ability to set XONSH_HISTORY_FILE before loading the history backend.
* black
* using XONSH_HISTORY_FILE
* tests
* black
* Convert WindowsPath to str
* Update xonsh/environ.py
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
* cleaning
* test sqlite
* test dummy
* typo
* fix 3.6
Co-authored-by: a <a>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>