Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Auto completion for references works only partially #23

Closed
twodrops opened this issue Jan 22, 2022 · 8 comments
Closed

Auto completion for references works only partially #23

twodrops opened this issue Jan 22, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@twodrops
Copy link

Auto completion of references using -> > works only if the target element is coming from a single file. If the target is present in multiple files or in multiple folders, auto-completion works only till the folder listing (no files or IDs under the folders are offered) .

No errors are thrown.

@danwos
Copy link
Contributor

danwos commented Jan 28, 2022

How can a target need be present in multiple files?

Is this because of some sort of variant management, so that during build time only one need-target file gets used?
Or because of the use of needextend?

However, as this information is coming from need.json, there data there must get misinterpreted by Open-Needs-IDE, or the data itself is already corrupted, then it's a bug in Sphinx-Needs.
Have to check this.

@danwos danwos added the bug Something isn't working label Jan 28, 2022
@danwos
Copy link
Contributor

danwos commented Feb 4, 2022

Example: 2 needs of type "req", one in "file_1.rst" and the other one in "file_2.rst". This is not supported.

@twodrops
Copy link
Author

twodrops commented Feb 4, 2022

Yes, this is what I meant. You just need two "reqs" in two different files and not in the same file and the feature does not work

@haiyangToAI haiyangToAI self-assigned this Feb 25, 2022
@haiyangToAI
Copy link
Contributor

haiyangToAI commented Mar 2, 2022

Hi @twodrops,

I tested it the above issue you mentioned. It works fine for me.

Here is the test scenario I had: 2 needs of type "req" in different rst file: need REQ_1 in index.rst, need REQ_2 in test.rst.

As you can see from the pictures below:

  1. In file index.rst, the auto completion feature : ->req>, works as expected

index_rst_works

  1. In file test.rst, it also works

test_rst_works_01

test_rst_works_02

  1. In a new created file test2.rst, it also works

test2_rst_works

One possible explanation for your issue, might be needs.json. Could you please check your "_build/needs/needs.json" for example? Is your needs.json contains those needs you expected?

@twodrops
Copy link
Author

I checked the needs and I can see that I have all the required needs present there. It must then be something else that is causing this. We can do some live testing with my example in our telco today :)

@haiyangToAI
Copy link
Contributor

Hi @twodrops,

After thoroughly investigation, I finally identified the issue, which has nothing to do with auto completion or needls.

The auto completion issue you experienced is because needs.json not got loaded. The reason that needs.json not loaded is because it failed to load declared needs_types from conf.py.

The reason why it failed to load needs_types from conf.py is because:

  • In the conf.py from sphinx-needs-basics, the user specified config for github needs_services, the code there expecting Github Enterprise credentials from environment variables.

This is also the reason why it works for me locally at the first place when I didn't test the sphinx-needs-basics repo.

Potential fix in the future might be to introduce another setting to get needs_types from conf.py.

@twodrops
Copy link
Author

@haiyangToAI Thanks for finding out the root cause. I suppose it was not all that easy to come to that conclusion. Great!
I had reported a similar issue here #24. I guess we need a general solution if conf.py is "reused" outside the context of sphinx-build by open-needs-ide.

@danwos
Copy link
Contributor

danwos commented Mar 30, 2022

Problem solved and / must be used to select sub-folders

@danwos danwos closed this as completed Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants