This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hello,
If I right click a referred function defined in a another C file and hit 'Go To Declaration', it goes to the declaration in the .h file.
However, if I right click and hit 'Go To Definition' it also goes to the declaration in the .h file. The expectation is that is goes to definition in the .c file.
The expectation is that is goes to definition in the .c file.
Yes, that is expected unless the source file is not available (i.e. part of a library, etc).
The "Go To Definition' typically works if the source is available and part of the project. Is this the case for your environment? Can you provide a little example where this is failing?
Hello Ki,
I can see that it works for a single core project but I have contrived a multi-core example (attached) which replicates the problem in our project.
Our multicore project uses some common code for two or more cores. Rather than maintain multiple copies of the same code in core projects, we keep a source code "repo" under the system project and then use links from the individual core projects. This seems to work well in both Eclipse and Theia from a compile and link perspective. However, the 'Go To Definition' (indexer?) cannot resolve the location of the definition in source code (.c) in the system project.
It can't be a blanket blindness of the files in the system project because 'Go To Declaration' works fine for opening the header in the system project, it's just the .c file which is a problem.
It can't be a blanket blindness of the files in the system project because 'Go To Declaration' works fine for opening the header in the system project
Since you have the path to the header file in the compiler include search path, the parser will know where the header file is.
However, the 'Go To Definition' (indexer?) cannot resolve the location of the definition in source code (.c) in the system project.
The issue is with linked files. I believe there is a current limitation with parsing linked files and this may be getting resolved in a future CCS version (I will need to check this). However if the source code is explicitly added to the project like you have in the example you provided, then it will find it.
However if the source code is explicitly added to the project like you have in the example you provided
Apologies, I made a mistake in the example. It wasn't my intention to add a copy of the file, I wanted to add a link. In Eclipse, the drag'n'drop prompts to copy or link the file but Theia just copies the file* which I overlooked at the time.
In any case, I agree it works for copied files but not for linked files. Let's hope it gets added in future.
I believe there is a current limitation with parsing linked files and this may be getting resolved in a future CCS version (I will need to check this).
I confirmed all of the above. It is a known limitation with the parser being used and it is something on our roadmap to address ourselves. Unfortunately I don't have any more details than that.