Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
### Project specific config ###
language: generic
language: python

env:
global:
- APM_TEST_PACKAGES=""
- ATOM_LINT_WITH_BUNDLED_NODE="true"

matrix:
- ATOM_CHANNEL=stable
- ATOM_CHANNEL=beta

os:
- linux
- osx
jobs:
include:
- os: linux
python: 3.7
env: ATOM_CHANNEL=stable
- os: linux
python: 3.7
env: ATOM_CHANNEL=beta
- os: osx
language: generic
env: ATOM_CHANNEL=stable
- os: osx
language: generic
env: ATOM_CHANNEL=beta


before_install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cd /usr/local/bin && mv python python.old && ln -s python3 python && cd -; fi

### Generic setup follows ###
script:
- pip3 install jedi
- curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh
- chmod u+x build-package.sh
- ./build-package.sh
Expand All @@ -30,7 +42,7 @@ git:

sudo: false

dist: trusty
dist: bionic

addons:
apt:
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ See [releases](https://github.com/sadovnychyi/autocomplete-python/releases) for

Jedi-driven release notes follow. For more about using the Kite completions engine see [kite.com](https://kite.com).

The package requires a recent version of [`jedi`](https://pypi.org/project/jedi/):

```sh
pip install jedi
```

## Demo
![Demo](https://cloud.githubusercontent.com/assets/193864/12288427/61fe2114-ba0f-11e5-9832-98869180d87f.gif)

# Features
## Features

* Works with :apple: Mac OSX, :penguin: Linux and :checkered_flag: Windows.
* Works with both :snake: Python 2 and 3.
Expand All @@ -29,7 +36,7 @@ Jedi-driven release notes follow. For more about using the Kite completions eng
* Rename across multiple files. It will not touch files outside of your project, but it will change VCS ignored files. I'm not responsible for any broken projects without VCS because of this.
![sample](https://cloud.githubusercontent.com/assets/193864/12288191/f448b55a-ba0c-11e5-81d7-31289ef5dbba.gif)

# Configuration
## Configuration

* If using a [virtualenv](https://virtualenv.pypa.io/en/latest/) with third-party packages, everything should "just work", but if it's not – use the `Python Executable Paths` and/or `Extra Paths For Packages` configuration options to specify the virtualenv's site-packages. Or launch Atom from the [activated virtualenv](https://virtualenv.pypa.io/en/latest/userguide.html#activate-script) to get completion for your third-party packages
* Be sure to check package settings and adjust them. Please read them carefully before creating any new issues
Expand All @@ -40,7 +47,7 @@ Jedi-driven release notes follow. For more about using the Kite completions eng
![image](https://cloud.githubusercontent.com/assets/193864/11631369/aafb34b4-9d3c-11e5-9a06-e8712a21474e.png)


# Common problems
## Common problems

* "Error: spawn UNKNOWN" on Windows
* Solution: Find your python executable and uncheck the "Run this program as an administrator". See issue [#22](https://github.com/sadovnychyi/autocomplete-python/issues/22)
Expand Down
16 changes: 9 additions & 7 deletions lib/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import sys
import json
import traceback
sys.path.append(os.path.dirname(__file__))

import jedi
# remove jedi from path after we import it so it will not be completed
sys.path.pop(0)

WORD_RE = re.compile(r'\w')
ARGUMENT_RE = re.compile(r'[a-zA-Z0-9_=\*"\']+')
Expand Down Expand Up @@ -88,10 +86,11 @@ def _get_call_signatures(self, script):
continue
if WORD_RE.match(param.name) is None:
continue
description = re.sub('param ', '', param.description)
try:
name, value = param.description.split('=')
name, value = description.split('=')
except ValueError:
name = param.description
name = description
value = None
if name.startswith('*'):
continue
Expand Down Expand Up @@ -319,9 +318,10 @@ def _set_request_config(self, config):
self.fuzzy_matcher = config.get('fuzzyMatcher', False)
jedi.settings.case_insensitive_completion = config.get(
'caseInsensitiveCompletion', True)
self.extra_paths = []
for path in config.get('extraPaths', []):
if path and path not in sys.path:
sys.path.insert(0, path)
self.extra_paths.append(path)

def _process_request(self, request):
"""Accept serialized request from Atom and write response.
Expand All @@ -337,7 +337,9 @@ def _process_request(self, request):

script = jedi.api.Script(
source=request['source'], line=request['line'] + 1,
column=request['column'], path=request.get('path', ''))
column=request['column'], path=request.get('path', ''),
project=jedi.api.Project(path, added_sys_path=self.extra_paths),
)

if lookup == 'definitions':
return self._write_response(self._serialize_definitions(
Expand Down
43 changes: 0 additions & 43 deletions lib/jedi/__init__.py

This file was deleted.

48 changes: 0 additions & 48 deletions lib/jedi/__main__.py

This file was deleted.

Loading