microsoft / microsoft/vscode-cpptools
Include directives with path containing Linux symbolic links not followed for symbols.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: LanguageService
When an include directive specifies a header file and includes some path information where one directory is a symbolic link then the file can't be found using "Go to Definition".
For example when attempting to right click and "Go to Definition" for the include directive:
#include <asm/arch/sys_proto.h>
The result is:
"No definition found for 'sys_proto'"
Depending where in the include directive you click you may see different fail messages like "No definition found for 'asm'"
There are no squiggly lines underneath the include directive it appears on some level the file can be found. As expected if I delete the file a red squiggle will appear to indicate the file is missing.
Additionally when I use "Go to Symbol in Workspace..." to find a symbol declared in 'sys_proto.h, like set_wdog_reset() then the symbol is successfully found.
In the above case the "arch" directory is actually a symbolic link pointing to a directory called "arch-mx6".
Right click and "Go to Definition" for all other include directives in c file work correctly.
System Setup
OS:
CentOS Linux release 7.4.1708 (Core) x86_64
VS Code Version:
Version: 1.29.0
Commit: 5f24c93878bd4bc645a4a17c620e2487b11005f9
Date: 2018-11-12T07:42:27.562Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
C/C++ Extension Version:
0.20.1
Other extensions:
None
To Reproduce
- Get Uboot source code (maybe from freescale/NXP)
- Open VSC and create a workspace pointing to the uboot source code directory
- Configure C++ extension worskpace settings such that C_Cpp.default.browse.path points to directory with uboot code and C_Cpp.default.includePath points to uboot "include" directory and "arch/arm/include" directory.
- Open /drivers/mmc/fsl_esdhc.c
- Right click on #include <asm/arch/sys_proto.h>
- See error message indicating sys_proto can't be found
Code Snippet
/*
- Copyright 2007, 2010-2011 Freescale Semiconductor, Inc
- Andy Fleming
- Copyright 2017 NXP
- Based vaguely on the pxa mmc code:
- (C) Copyright 2003
- Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
- SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
#include <common.h>
#include <command.h>
#include <errno.h>
#include <hwconfig.h>
#include <mmc.h>
#include <part.h>
#include <malloc.h>
#include <fsl_esdhc.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <dm.h>
#include <asm-generic/gpio.h>
#include <power/regulator.h>
#include <asm/arch/sys_proto.h>
Expected behaviour
When right clicking on an include directive and selecting "go to definition" the IDE would open the file specified in the include directive.
Additional context
My work space settings file is this:
{
"folders": [
{
"path": "/home/ian/Linux/Output/ramdisk/build/uboot-rel_imx_4.9.x_1.0.0_ga.rel_imx_4.9.x.18ian"
}
],
"settings": {
"files.exclude": {
"**/.o": true
},
"C_Cpp.default.browse.path":[
"/home/ian/Linux/Output/ramdisk/build/uboot-rel_imx_4.9.x_1.0.0_ga.rel_imx_4.9.x.18ian"
],
"C_Cpp.default.includePath": [
"/home/ian/Linux/Output/ramdisk/build/uboot-rel_imx_4.9.x_1.0.0_ga.rel_imx_4.9.x.18ian/arch/arm/include/",
"/home/ian/Linux/Output/ramdisk/build/uboot-rel_imx_4.9.x_1.0.0_ga.rel_imx_4.9.x.18ian/include"
],
"C_Cpp.default.intelliSenseMode": "gcc-x64",
"files.associations": {
"dm.h": "c",
"fdt_support.h": "c",
"malloc.h": "c",
"part.h": "c",
"gpio.h": "c",
"regulator.h": "c",
"wdt.h": "c",
"io.h": "c",
"common.h": "c",
"config.h": "c",
"command.h": "c",
"linker_lists.h": "c",
"compiler.h": "c"
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the reported U-Boot workspace, includePath and browse.path settings, focusing on Go to Definition for #include <asm/arch/sys_proto.h>. Compare this with Go to Symbol in Workspace and with other include directives, then trace the language-service path-resolution entry point. Done means Go to Definition opens the symlink-targeted header without breaking existing include navigation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100