951 Commits

Author SHA1 Message Date
Daniel Hahler
f36749776d Update parso to v0.3.2
Update submodule pythonx/parso 930ec08...a2b153e

    * pythonx/parso 930ec08...a2b153e (91):
      > Upgrade the Changelog
      > Escape a backslash properly
      > Bump the parso version to 0.3.2
      > f-string parts are also PythonLeaf instances
      > Fix get_start_pos_of_prefix
      > Remove dead code
      > Refactor f-string support
      > Fix: End detection for strings was mostly wrong, fixes #51
      > Fix f-string escapes, fixes #48
      > Tokenizer: Simplify end of string regexes
      > Add a comment from the Python3.7 code base
      > Fix diff parser: The previous fix was a bit off
      > Change fuzzer: Add ways to not always use correct parse input
      > Fix diff parser: issue with opening brackets
      > Async doesn't work in 3.4
      > Skip some tests for Python2.6 and Python3.3
      > Fix diff parser: DEDENT as error leaves should also be ignored and reparsed
      > Fix diff parser: error dedents in between nodes should be ignored for now when copying
      > Fix diff parser: Don't copy error nodes/leaves in the beginning, leads to strange issues in some cases
      > Diff fuzzer: Create a check to see if the errors make sense.
      > Fix diff parser: Don't copy DEDENT tokens at the beginning
      > Fix diff parser: Skip last leaves for last line offset leaves
      > Fix indentation error tokens
      > Fix diff parser: Avoid side effects for prefix
      > Fix tokenizer: backslashes sometimes led to newline token generation
      > Make lines easier copyable in the fuzzer
      > Fix tokenizer: Carriage returns after backslashes were not properly handled
      > Fix in diff parser: prefix calculation was wrong when copying nodes
      > Replace --print-diff with --print-code
      > Fix diff parser generation for empty files
      > Docopt should not be needed for tests
      > Fix tokenizer: Form feeds and multiline docstrings didn't work together
      > Fix diff parser: Need to calculate the prefix for the diff tokenizer better
      > Remove copied nodes stuff, to simplify some things
      > Fix newline endings and a few parser/copy counts
      > Feature: The diff parser fuzzer is now able to use random Python fragments
      > Fix: The Python 3.8 grammar did not include f-string support
      > Fix tokenizer: Closing parentheses in the wrong place should not lead to strange behavior
      > Fix end positions with error dedents
      > Fix diff parser tests for Python 2
      > Randomize the fuzzer a bit more with inserting characters
      > Simplify the regexes
      > Fix a regex clause that was totally wrong
      > Fix another tokenizer issue
      > Apply \r changes in syntax trees
      > Actually make \r usable
      > Fix split lines for Python code
      > Add \r as a valid linebreak for splitlines
      > Move split_lines tests around
      > Start generating really random strings with the fuzzer
      > Fix tokenizer: Dedents before error tokens are properly done, now.
      > Fix diff parser: Also check async with
      > Make the diff parser use a lot of different files by default
      > Fix diff parser: Forgot that with statments are also flows
      > Fix valid graph asserting for some dedents that are errors
      > Fix diff parser: If funcs are not copied, errors shouldn't either
      > Better documentation for the fuzz diff parser script
      > Rename a test
      > More verbose output for the diff fuzzer
      > Fix diff parser: error dedent issues
      > Fix diff parser: Avoid indentation issues
      > Use the right diff order in debug output
      > Fix diff parser: The prefix was wrong in some copy cases
      > Make fuzz parser compatible with Python 2
      > Make it possible to print all diffs in fuzzer
      > Introduce a redo flag 'only_last' to narrow down issues
      > Add docopt to testing dependencies
      > Rewrite the fuzz diff parser to cache errors (so we can re-run those)
      > Fix diff parser: Decorators were sometimes parsed without their functions
      > Fix tokenizer: Dedents should only happen after newlines
      > Usability for diff parser fuzzing
      > Fix for diff parser: Rewrite prefix logic and don't mutate prematurely
      > Fix diff parser: positioning of functions if decorators were removed
      > Ignore ERROR_DEDENT in graph validation
      > Add a small diff parser fuzzer
      > Fix diff parser: get_last_line was sometimes wrong
      > Fix error reporting order for diff issues
      > Clean up the test diff parser file
      > Avoid nasty side effects in creation of Node
      > Make parso errors even more informative
      > Fix diff parser get_last_line calculation
      > Fix graph asserting for error indents
      > Better checks for checking valid graphs
      > Create better ways for debugging the diff parser
      > Fix diff-parser: Copying parts of if else should not lead to the whole thing being copied
      > Reenable diff parser parser counting in all tests
      > Fix: Make the NodesStack to a NodesTree
      > Fix for diff parser : Make sure that start_pos are growing always The problem was that functions/classes were sometimes not well positioned. Now all diff tests are ensuring that leaves always grow.
      > Add a check to see if leaves have the right start positions
      > Add parso version to an exception
      > MNT: add grammar for python 3.8
2019-01-25 01:21:33 +01:00
Brian Mego
7f4f2db260 Fixes incorrect documentation 2018-12-03 23:51:19 +01:00
Daniel Hahler
2f65c636f8 ftplugin: do not duplicate jedi_usages autocommands (#883)
Fixes https://github.com/davidhalter/jedi-vim/issues/882.
2018-11-08 08:43:28 +01:00
Daniel Hahler
b6dfc5fd49 Update submodule pythonx/parso e6bc924...930ec08
* pythonx/parso e6bc924...930ec08 (7):
      > Use SVG badges
      > tox.ini: simplify deps
      > tox: add pypy to envlist for tox-travis
      > setup.py: add "testing" extras_require
      > Add Python 3.7 stable to test matrix and update classifiers
      > Update usage.rst
      > Don't use invalid escape sequences in regex, see https://github.com/davidhalter/jedi-vim/issues/843
2018-10-14 17:55:56 +02:00
Daniel Hahler
2a43448f3b Update submodule pythonx/jedi a79a1fb...bd1010b
* pythonx/jedi a79a1fb...bd1010b (91):
      > Create a new 0.13.1 release
      > Fixed completions of global vars and tensorflow slowness, fixes #1228, #1116
      > The changelog date was wrong
      > Release notes for 0.13.0
      > Fix tensorflow issues with a few hacks (temporary), fixes #1195
      > If the VIRTUAL_ENV variable changes, need to reload the default environment, fixes #1201, #1200
      > Return SameEnvironment as a default, fixes #1226, #1196
      > Document that using the REPL autocompletion is only available on Linux/Mac, fixes #1184
      > Fix an issue with f-strings, fixes #1224
      > Ignore some errors that are happening when the Python process ends and its subprocesses are cleaned up
      > also remove crashes with pep 448 unpacking of lists and sets
      > Fixed crash (and now recognises correctly) {**d, "b": "b"}["b"]
      > Recognize {**d} as a dict instead of set
      > Add extras_require=testing
      > _get_virtual_env_from_var: use safe=False
      > tests: venv_path: use session scope
      > jedi/api/environment.py: minor flake8 fix
      > jedi.api.environment._SUPPORTED_PYTHONS: add 3.7
      > Removing a test from doctests, becaues it shouldn't be one
      > Refactor argument clinic usage
      > With the recent changes one performance optimization got lost
      > FunctionExecutionContext should use the parent if possible
      > Use anonymous instance arguments in a different way
      > Move some anonymous instance function execution stuff
      > Get rid of InstanceFunctionExecution, because it's really not needed
      > Use the InstanceArguments for super as well
      > Use InstanceArguments directly and not via InstanceFunctionExecution
      > Remove old garbage code
      > Don't use arguments that are not needed
      > Also move the remaining get_params to get_executed_params
      > get_params -> get_executed_params where possible
      > Subprocess error reporting improvements
      > Fix a recursion issue about compiled objects
      > Use a CompiledInstanceNameFilter that wraps the class name as well
      > Prefer Python 3 import over 2
      > Now it's actually possible to specify a pytest environment for the same Python version
      > Note that Python 3.3 support was dropped in Changelog
      > Drop support for EOL Python 3.3 (#1019)
      > Rewrite the pyc test
      > Fix an issue with stderr debugging of subprocesses
      > stderr of the child processes should be printed in debug output
      > Use close_fds for posix.
      > Remove some redundant code
      > Use names of classes to infer names of instances
      > Don't have execute and execute_evaluated on name
      > Fix an issue where __ prefixed variables where not hidden when accessed from a class
      > Bound methods are now working correctly in all Python versions. Therefore a test was wrong.
      > Remove a print in tests
      > BoundMethods now have access to the function that they are using
      > Remove another usage of is_class where it's not needed
      > FunctionContext should be created from a unified interface
      > Don't create a FunctionExecutionContext if it's not used.
      > Use TreeContext in a good way
      > Fix broken link in documentation
      > The implicit namespace package test from 4b276bae87a3170672f7ddb3e00f5851fe24d562 can only be used for Python 3.4+
      > The import resolution for namespace packages was wrong
      > Add a way to use the interpreter environment for tests
      > MergedExecutedParams -> DynamicExecutedParams
      > Fix a recursion error, fixes #1173
      > Remove two recursion tests again that will belong into a commit at a point where it is not failing anymore
      > Don't merge params if it's just one param
      > Add a repr for AnonymousArguments
      > Fix a doctest
      > Some minor flake8 fixes
      > Script.__repr__: include environment
      > Add params to CallSignature.__repr__
      > Environments are now always created on request
      > Improve Environment
      > Add max line length 100 to the config for flake8
      > tests: use monkeypatch.setenv
      > Don't test Python 3.3 on appveyor anymore, it's getting really hard to get all the right dependencies for it, because 3.3 is deprecated everywhere.
      > Mention that it's ok to have a line length of 100 characters in our files.
      > Don't use invalid escape sequences in regex, see https://github.com/davidhalter/jedi-vim/issues/843
      > subprocess: listen: exit normally with EOFError
      > Script: improve ValueError for column
      > The sys path might be lazy or not in a venv
      > The encoding parameter should be used again (includes test), fixes #1167
      > Remove source_encoding from documentation (see #1167)
      > Actually use the fast_parser setting again
      > Use an import name list as long as possible
      > Different _load_module API
      > Directly load modules if possible, with this it's not necessary anymore to use dotted_from_fs_path, also fixes #1013.
      > Don't mutate the sys.path. This is pretty nasty bug that fixes #1148
      > Don't follow builtin imports anymore by default when follow_imports is on (goto)
      > Add a changelog entry for the include_builtins change
      > additional_module_paths in usages never actually worked
      > Add include_builtins to usages, fixes #1131.
      > Finally make it possible to use auto_import_modules for packages
      > Test auto_import_modules in a very basic way
      > Fix a bug about fstring completion
      > Comprehensions are also possible arguments. Fixes 1146
2018-10-14 17:55:56 +02:00
Daniel Hahler
c6f05cd82c .coveragerc: concurrency = greenlet (#874)
Fixes https://github.com/neovim/python-client/issues/354
2018-08-16 16:37:00 +02:00
Daniel Hahler
132d8506ab tests: move/rename/cleanup vspec based tests (#860)
The main motivation is to being able to use normal/other pytest based
tests.

Therefore this moves everything from conftest into test_integration
itself.
2018-08-01 23:57:37 +02:00
Daniel Hahler
399c57ff72 Fix displaying of error information with shortmess+=F
When being initialized via ftplugin `set shortmess+=F` (default in
Neovim by now) causes the additional information (the full traceback) to
be silenced.

This patch uses `:unsilent` to always display it.

Ref: https://github.com/neovim/neovim/issues/8675
2018-08-01 22:50:23 +02:00
Daniel Hahler
1126ffde9b Makefile: make pip-install quiet 2018-08-01 22:50:23 +02:00
Daniel Hahler
88502891ba Report coverage (#863) 2018-07-30 22:45:06 +02:00
Dave Halter
b33392c8c8 Merge pull request #864 from blueyed/nvim (neovim testing)
Testing is now alow possible with Neovim
2018-07-30 18:09:45 +02:00
Daniel Hahler
ffec4d7fc5 Test with Neovim 2018-07-30 14:24:53 +02:00
Daniel Hahler
43a9a9b191 Fix test/signatures.vim: ensure there is no indent (nvim) 2018-07-30 14:24:53 +02:00
Daniel Hahler
e05f34646e Fix test/signatures.vim: take into account &ruler (nvim) 2018-07-30 14:24:53 +02:00
Daniel Hahler
713e78dd39 tests: harden/fix completions with regard to longest/nvim mostly 2018-07-30 14:24:53 +02:00
Daniel Hahler
e49638ffc8 Upgrade vim-vspec to 1.8.1 (#862)
This fixes some tests to make it work with the newer version.
2018-07-30 11:16:51 +02:00
Daniel Hahler
4c430ed536 Improve JediDebugInfo for envs (#858)
Improve JediDebugInfo for envs

This is taken out of https://github.com/davidhalter/jedi-vim/pull/836.
2018-07-28 01:46:12 +02:00
Daniel Hahler
40fc5ab27f test/signatures.vim: remove trailing spaces 2018-07-25 02:21:54 +02:00
Daniel Hahler
9a4a4f4074 Skip duplicate call signatures
I am seeing `p` twice for os.path.dirname, which seems to come from
Lib/posixpath.py and Lib/ntpath.py, as can be seen with `os.path.join`,
where I still see two with this patch:

```
            (path, *paths)
import os   (a, *p)
os.path.join()
```
2018-07-16 13:50:49 +02:00
Daniel Hahler
c6716c6392 Makefile: use a single venv 2018-07-15 21:22:29 +02:00
Daniel Hahler
5123dbbbc7 Fix flake8 issue 2018-07-15 20:57:27 +02:00
Daniel Hahler
ee0f759a2e qa: add flake8 to check make target 2018-07-15 20:57:27 +02:00
Daniel Hahler
66b6a20041 Factor out annotate_description
This uses d.type, but special-cases functions and statements.
2018-07-15 19:26:11 +02:00
Daniel Hahler
8e077adb2f show_goto_multi_results: use relpath
This helps Vim to display the path for unlisted buffers relative to cwd
in the quickfix list.
2018-07-15 19:26:11 +02:00
Dave Halter
e7cb9a186e Also add remove_usages on InsertEnter 2018-07-15 19:26:11 +02:00
Dave Halter
b5774a9554 Add an augroup for usages 2018-07-15 19:26:11 +02:00
Dave Halter
f0d80048f1 Remove usages after text has changed in normal mode 2018-07-15 19:26:11 +02:00
Dave Halter
9e2244c44e Use standout/reverse instead of yellow for jediUsages
It uses cterm=reverse, which is supported by current Neovim, and at
least for xterm and rxvt-unicode reverse and standout are the same.

See `infocmp`:

> smso=\E[7m / rev=\E[7m
2018-07-15 19:26:11 +02:00
Dave Halter
cc087ef463 Somehow show_goto_multi_results was called without arguments
This was obviously wrong and fixed by inserting the obvious param
2018-07-15 19:26:11 +02:00
Dave Halter
efaef9cee3 Rename was in the wrong spot when using it at the end of a line. 2018-07-15 19:26:11 +02:00
Dave Halter
58561d45f1 Fix renaming and also highlight the renamed classes. 2018-07-15 19:26:11 +02:00
Dave Halter
84b8eeb954 Highlight usages
Use matchaddpos to highlight usages in the current file.
2018-07-15 19:26:11 +02:00
Dave Halter
2bb7677b43 Make it clearer which versions make check requires 2018-07-14 15:39:02 +02:00
Dave Halter
81ada14f0b Upgrade jedi to 0.12.1, forgot to upgrade it when upgrading parso
a79a1fb Merge branch 'parso'
58141f1 Don't use requirements for now, and use the git version instead in tox
e0e2be3 Add a better comment about why people need to upgrade parso
1e7662c Prepare release of 0.12.1
68974ae Don't use internal parso APIs if possible
c208d37 Remove code that is no longer used, because parso was refactored.
3847406 Make jedi work with the next parso release
95f835a Force unicode when listing module names
282c6a2 Use highest possible pickle protocol
ea71ded Include stderr with "subprocess has crashed" exception (#1124)
106b11f Set stdout and stdin to binary mode on Python 2 and Windows
f9e90e8 Use system default buffering on Python 2
197aa22 Use cPickle on Python 2 if available
e96ebbe Add tests for DefaultDict support.
55941e5 Add support for DefaultDict on jedi_typing.py.
ff4a773 Parse correct AST attribute for version
70c2fce Replace distutils.spawn.find_executable with shutil.which
5dab97a Add an error message, see also #1139.
e2cd228 Dict comprehension items call should now work, fixes #1129
c1014e0 Fix flow analysis test
62a3f99 Fix a wrong branch check, fixes #1128
6ebe3f8 Drop 3.3 tests from travis
50812b5 A simple yield should not cause an error, fixes #1117
d10eff5 Travis: report coverage also to codecov.io
6748faa Fix _get_numpy_doc_string_cls: use cache
fc14aad Fix namespace autocompletion error
3c909a9 Travis: remove TOXENV=cov from allowed failures
b94b45c Environment._get_version: add msgs with exceptions
a95274d None/False/True are atom non-terminals in the syntax tree, fixes #1103
8d48e74 When searching submodules, use all of __path__, fixes #1105
9149956 Specially crafted docstrings sometimes lead to errors, fixes #1103
ba96c21 Follow up from the last async issue, fixes more related things about #1092.
8494164 Fix an async funcdef issue, fixes 1092.
4075c38 In some very rare cases it was possible to get an interpreter crash
because of this bug. Fixes #1087
0bcd170 Start using our own monkeypatch function for some things
ceb5509 Include function return type annotation in docstring if it is present
88243d2 Don't catch IndexError where we don't have to
5f37d08 Extend create_environment to accept an executable path
aa6857d check_fs: handle FileNotFoundError
2018-07-14 12:31:11 +02:00
Daniel Hahler
7cade1fb62 Update submodule pythonx/parso 6f385bd...e6bc924
* pythonx/parso 6f385bd...e6bc924 (44):
      > Use a setuptools that still supports py33
      > 3.1 release notes
      > Use one simple functions to check for funcdefs in diff parser
      > Make sure to treat async funcdefs the same way as normal funcdefs
      > Fix an issue in the diff parser
      > Asterisks in function definitions may be at the end of a func without a comma, fixes #44
      > Remove some TODOs that were fixed
      > Error recovery should not match the whole line in case of an invalid token, fixes #40
      > docs: enable searchbox
      > Merge branch 'pgen'
      > Merge branch 'master' of github.com:davidhalter/parso
      > Add docstring
      > Add some comments
      > Use a set instead of dict if it's not necessary
      > Simplify some code
      > Some refactorings for simplicity
      > Use NFAArc as a class
      > Some more renames
      > Another rename
      > Rename
      > Move the grammar parsing to a separate module
      > More renames
      > Rename
      > Separate generating dfas from parsing
      > Cleanup some names
      > Remove some code that is not used anymore
      > Some cleanups and documentation
      > Move out some more functions out of classes
      > Some more refactorings for clarification
      > Factor out start_symbol into a better position
      > Refactor out dfas
      > Document pgen grammars a bit better
      > addarc -> add_arc
      > Refactor some things in pgen
      > Move some initializations
      > Change license again. The year shouldn't matter
      > Make first private
      > Change copyright years
      > Remove some code from the grammar
      > Separate the grammar generation from the grammar parsing
      > In pgen now everything is named grammar and not c
      > Better recovery for online classes and functions
      > Fix one-line error recovery for all things that are using a suite
      > Add a debug function for first tokens
2018-07-10 14:46:01 +02:00
Daniel Hahler
1773837a11 syntax: use "hi def" everywhere
This allows for keeping user configuration.
2018-07-10 12:49:48 +02:00
Daniel Hahler
67fd8c6572 s:init_python: fix check for Python 2
Fixes https://github.com/davidhalter/jedi-vim/issues/841.
2018-07-08 04:31:58 +02:00
Daniel Hahler
d3d9a91ae6 init: improve handling of import errors (#840)
* jedi_vim.jedi_import_error: add location

This is useful for debugging.  It contains e.g. the path to parso, if
importing failed from there.

Example:

> Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: could not import jedi: cannot import name 'PythonTokenTypes' (in /…/jedi-vim/pythonx/jedi/jedi/api/completion.py:1). (in function jedi#init_python[3]..<SNR>44_init_python[27]..jedi#setup_python_imports, line 37)

* init: handle jedi_vim.jedi_import_error in Vim plugin

Using `set shortmess+=F` would suppress the `:echom` used in
`jedi_vim.no_jedi_warning` [1].

This patch makes `jedi#setup_python_imports` handle the error instead.

1: https://github.com/neovim/neovim/issues/8675

* Revisit error handling with loading jedi_vim

* jedi#debug_info: display parso submodule separately

* Fix jedi#reinit_python

* fixup! Revisit error handling with loading jedi_vim

* display_debug_info: handle exceptions with environment.get_sys_path

* fixup! Revisit error handling with loading jedi_vim

[ci skip]
2018-07-04 22:12:07 +02:00
Daniel Hahler
0361d6c633 s:init_python: handle g:jedi#force_py_version again (#834)
It was removed previously, since it now refers to the environment being
used.

This brings it back for now.

There could be a separate var for it later, and/or it needs changes
later (or rather the environment needs a new variable name, since it
should refer to the executable really) - but this is good for now I think.

Fixes https://github.com/davidhalter/jedi-vim/issues/833
2018-07-04 17:55:25 +02:00
Dave Halter
a54729ef63 Use the official Jedi goto API instead of multiple calls
Fixes #802.
2018-07-04 00:03:11 +02:00
tobaloidee
5f98bfb62e Add logo (#837)
This has been force-pushed.

See https://github.com/davidhalter/jedi-vim/pull/837 for other variants,
and the reason for force-pushing.
2018-06-26 18:07:14 +02:00
Daniel Hahler
745dc8a559 jedi#setup_python_imports: better SyntaxError handling
Uses `repr` for SyntaxErrors.

Related: https://github.com/neovim/python-client/pull/221
2018-06-23 11:28:41 +02:00
Vivian
84a5299c8f Fix spelling error 2018-05-29 19:33:30 +02:00
Daniel Hahler
d4006ab1bf Fix s:init_python
Just check for `has('python3')` / `has('python')`.

Fixes 72a2643f7c (r28922063).
2018-05-21 23:37:14 +02:00
Daniel Hahler
ed8153ef2b Update submodule pythonx/parso 579146b...6f385bd
* pythonx/parso 579146b...6f385bd (7):
      > Not testing Python 3.3 anymore on travis. It seems to be broken
      > Add a changelog for 0.2.1
      > Push the version
      > The diff parser was slighly off with prefixes, fixes #1121
      > A better repr for the endmarker
      > Merge branch 'master' of github.com:davidhalter/parso
      > Fix a prefix issue with error leafs.
2018-05-21 23:35:42 +02:00
Daniel Hahler
f07ff6a535 Fix flake8 W605: invalid escape sequence '\{w,d}' 2018-05-10 22:40:58 +02:00
Dave Halter
6781eb17da Small documentation change 2018-05-09 16:04:47 +02:00
Dave Halter
5ad782d920 Remove a strange sentence 2018-05-09 16:04:47 +02:00
Daniel Hahler
d75aaa470e Improve jedi_vim.get_environment
- cache current environment
- s/jedi.get_python_environment/jedi.get_system_environment: the former
  does not exist (renamed in https://github.com/davidhalter/jedi/commit/336087f)
- improve error display
2018-05-09 16:04:47 +02:00
Daniel Hahler
56eb0f6d63 Improve display_debug_info 2018-05-09 16:04:47 +02:00