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

Can Jedi provide location-based context information? #253

Closed
fyncor opened this issue Jun 25, 2013 · 3 comments
Closed

Can Jedi provide location-based context information? #253

fyncor opened this issue Jun 25, 2013 · 3 comments
Labels

Comments

@fyncor
Copy link

fyncor commented Jun 25, 2013

Hi,

I'd like to write a Vim plugin that can take a position in a source file, and returns its context.

For example, it will take (32, 47, 'foo.py'), and line column 47 in line 32 of foo.py is inside the method "bar()"of class "Qux", return something like "Qux.bar()".

What support does Jedi offer for that kind of functionality?

@tkf
Copy link
Contributor

tkf commented Jun 25, 2013

I don't think there is API for that. What you can do is to call defined_names (http://jedi.jedidjah.ch/en/latest/docs/plugin-api.html#api.defined_names) and search for the range in which the current point is. It's not ideal, though. I think adding an API for this would be nice.

@davidhalter
Copy link
Owner

👍 API would be nice. Something like jedi.Script.context. -> jedi.Script.context().qualified_name

@davidhalter
Copy link
Owner

This is finally possible with the Script().get_context(line, column) call. It will be nice to do stuff like "where am I exactly" and basically show the user a Definition.full_name`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants