Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #9

Merged
merged 5 commits into from
Nov 14, 2019
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A python code completion plugin for gedit. Built with the Jedi auto completion l
- Some refactoring tools

## Using
- Firstly, you need to install jedi. You can install it from your distro's package manager(search for python-jedi) or you can install it with pip:
- Firstly, you need to install jedi. You can install it from your distro's package manager(search for python3-jedi) or you can install it with pip:
```
pip install jedi
```
Expand Down
14 changes: 10 additions & 4 deletions gedi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):
def do_activate(self):
print("Gedi is activated.")
document = self.view.get_buffer()
document.connect("load", self.on_document_load)
document.connect("loaded", self.on_document_load)

if document.get_uri_for_display().endswith(self.py_extension):
self.completion_provider = GediCompletionProvider()
Expand All @@ -44,7 +44,7 @@ def do_activate(self):
def do_deactivate(self):
print("Gedi is deactivated.")

def on_document_load(self, document):
def on_document_load(self, document, p3=None, p4=None, p5=0, p6=0):
if document.get_uri_for_display().endswith(self.py_extension):
if self.completion_provider is None:
self.completion_provider = GediCompletionProvider()
Expand All @@ -71,9 +71,11 @@ def get_iter_correctly(self, context):
return context.get_iter()

def do_match(self, context):
#FIXME: check for strings and comments
iter = self.get_iter_correctly(context)
iter.backward_char()
buffer=iter.get_buffer()
if buffer.get_context_classes_at_iter(iter) != ['no-spell-check']:
return False
ch = iter.get_char()
if not (ch in ('_', '.') or ch.isalnum()):
return False
Expand All @@ -94,10 +96,14 @@ def do_populate(self, context):

for completion in Jedi.get_script(document).completions():
complete = completion.name
if jedi.__version__ <= (0,7,0):
doc=completion.doc
else:
doc=completion.docstring()
proposals.append(GtkSource.CompletionItem.new(completion.name,
completion.name,
self.get_icon_for_type(completion.type),
completion.docstring()))
doc))


context.add_proposals(self, proposals, True)
Expand Down