Skip to content

Commit

Permalink
Merge pull request #1025 from davidhalter/jedi-api
Browse files Browse the repository at this point in the history
Use the new Jedi API
  • Loading branch information
davidhalter authored Dec 26, 2020
2 parents a17b033 + ea52ca5 commit 57757bd
Show file tree
Hide file tree
Showing 14 changed files with 370 additions and 255 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: ci
on: push

jobs:
tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup
run: |
sudo pip install pytest
vim --version
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- name: Run tests
run: 'make test'

code-quality:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Run tests
run: |
vim --version
make check
coverage:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install dependencies
run: |
sudo add-apt-repository ppa:neovim-ppa/stable -y
sudo apt-get update -q
sudo apt-get install neovim -y
sudo pip install pynvim pytest-cov
sudo pip list
nvim --version
- name: Run tests
run: |
make --keep-going test_coverage BUILD_VIRTUAL_ENV=$VIRTUAL_ENV
- name: Upload coverage data
run: |
coverage xml
bash <(curl -s https://codecov.io/bash) -X fix -f coverage.xml -F py${TRAVIS_PYTHON_VERSION//./}
17 changes: 5 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
dist: xenial
dist: bionic
language: python
python: 3.7
python: 3.8
env:
matrix:
- ENV=test
- ENV=check
- ENV=test_coverage
matrix:
include:
- env: ENV=test_coverage
python: 2.7
- env: ENV=test_coverage
python: 3.8
- ENV=test
- ENV=check
- ENV=test_coverage
install:
- |
if [ "$ENV" = "test" ]; then
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ get more information. If you set them to ``""``, they are not assigned.
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
A few examples of setting up your project:

.. code-block:: vim
let g:jedi#environment_path = "<leader>d"
Finally, if you don't want completion, but all the other features, use:

Expand Down
10 changes: 10 additions & 0 deletions autoload/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ let s:default_settings = {
\ 'popup_select_first': 1,
\ 'quickfix_window_height': 10,
\ 'force_py_version': "'auto'",
\ 'environment_path': "'auto'",
\ 'project_path': "'auto'",
\ 'smart_auto_mappings': 0,
\ 'use_tag_stack': 1
\ }
Expand Down Expand Up @@ -422,6 +424,14 @@ function! jedi#py_import(args) abort
PythonJedi jedi_vim.py_import()
endfun

function! jedi#choose_environment(args) abort
PythonJedi jedi_vim.choose_environment()
endfun

function! jedi#load_project(args) abort
PythonJedi jedi_vim.load_project()
endfun

function! jedi#py_import_completions(argl, cmdl, pos) abort
PythonJedi jedi_vim.py_import_completions()
endfun
Expand Down
12 changes: 12 additions & 0 deletions doc/jedi-vim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Contents *jedi-vim-contents*
6.12. force_py_version |g:jedi#force_py_version|
6.13. smart_auto_mappings |g:jedi#smart_auto_mappings|
6.14. use_tag_stack |g:jedi#use_tag_stack|
6.15. environment_path |g:jedi#environment_path|
7. Testing |jedi-vim-testing|
8. Contributing |jedi-vim-contributing|
9. License |jedi-vim-license|
Expand Down Expand Up @@ -506,6 +507,17 @@ definition with arbitrary changes to the |jumplist|.
Options: 0 or 1
Default: 1 (enabled by default)

------------------------------------------------------------------------------
6.15. `g:jedi#environment_path` *g:jedi#environment_path*

To use a specific virtualenv or a specific Python version it is possible to
set an interpreter.

Both setting the directory and setting a project is working.

Examples: "/usr/bin/python3.9", "venv", "../venv", "../venv/bin/python"
Default: "auto"

==============================================================================
7. Testing *jedi-vim-testing*

Expand Down
4 changes: 4 additions & 0 deletions plugin/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ endif
" Pyimport command
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)

command! -nargs=? -complete=file JediChooseEnvironment :call jedi#choose_environment(<q-args>)
command! -nargs=? -complete=file JediLoadProject :call jedi#load_project(<q-args>)


function! s:jedi_debug_info()
" Ensure the autoload file has been loaded (and ignore any errors, which
" will be displayed with the debug info).
Expand Down
2 changes: 1 addition & 1 deletion pythonx/jedi
Submodule jedi updated 176 files
Loading

0 comments on commit 57757bd

Please sign in to comment.