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

Completion: Support fields from imported files #5

Closed
julienduchesne opened this issue Dec 15, 2021 · 4 comments · Fixed by #93
Closed

Completion: Support fields from imported files #5

julienduchesne opened this issue Dec 15, 2021 · 4 comments · Fixed by #93
Labels
enhancement New feature or request

Comments

@julienduchesne
Copy link
Member

No description provided.

@rvignesh89
Copy link

I'd like to take a crack at this. I'm not too familiar with LSP nor this repo but from what I see, what needs to be done is,

  • FindNodeByPosition should include the importnode into the search stack
  • completionFromStack should fall back to searching through import node types if it's not local/self.
  • If it's an import we'll have to read the doc from the cache to get the fields which can be used to build the completion list.
  • The part I'm not very clear about is how does this work for nested fields.

If I'm too far off let me know and I'll stay away from this :) But for me having this would greatly help in navigating complex jsonnet libs!

julienduchesne added a commit that referenced this issue Oct 14, 2022
Progress towards #5
Logic is starting to leak out of the processing lib as I haven't found an interface that makes sense for this
Some of this should probably be re-architected. However, I believe it is good enough for now and tests are in-place if we want to refactor a bit
julienduchesne added a commit that referenced this issue Oct 20, 2022
* Completion from imports: Basic cases
Progress towards #5
Logic is starting to leak out of the processing lib as I haven't found an interface that makes sense for this
Some of this should probably be re-architected. However, I believe it is good enough for now and tests are in-place if we want to refactor a bit

* Better structure, fix lint

* Add unsupported case
@judahrand
Copy link

This feature would be an absolute game changer for us. Is there any more news on any work towards this?

@jemag
Copy link

jemag commented Feb 15, 2023

What is the current state of completion right now with the language-server?

From my experiments in Neovim and VsCode the only completion that I can get to work is from the std library. Although I did see #78, I am not sure if it adds other completion that I am missing out on at the moment.

In terms of tooling, I really think full completion support is a game changer, and would help make jsonnet less daunting for new comers/ease its adoption.

@julienduchesne
Copy link
Member Author

It works but only with a single level. So library. would work but library.obj. would not autocomplete. I'll work on adding full support this week

julienduchesne added a commit that referenced this issue May 1, 2023
Closes #5
Simplified the code in the process.
Completion was using it's own stack-walking code, I moved it to use the same thing as go-to-definition
julienduchesne added a commit that referenced this issue May 2, 2023
Closes #5
Simplified the code in the process.
Completion was using it's own stack-walking code, I moved it to use the same thing as go-to-definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants